Accessories unhardcoded

This commit is contained in:
2026-05-28 09:58:35 +02:00
parent c7dc81b80f
commit 311bb8a3d0
6 changed files with 471 additions and 55 deletions
+56
View File
@@ -1360,6 +1360,62 @@ func TestValidateLayoutRejectsInvalidAutogenConsumerConfig(t *testing.T) {
}
}
func TestValidateLayoutRejectsInvalidHeadVisualeffectsConfig(t *testing.T) {
root := t.TempDir()
mkdirAll(t, filepath.Join(root, "src"))
mkdirAll(t, filepath.Join(root, "build"))
proj := &Project{
Root: root,
Config: Config{
Module: ModuleConfig{Name: "Test", ResRef: "test"},
Paths: PathConfig{Source: "src", Build: "build"},
Autogen: AutogenConfig{
Consumers: []AutogenConsumerConfig{
{
ID: "head_visualeffects",
Producer: "head_visualeffects",
Dataset: "visualeffects",
Mode: "head_visualeffects",
Root: "vfxs",
Include: []string{"head_jewels/**/*.mdl"},
Derive: AutogenDeriveConfig{Kind: "model_stem", GroupFrom: "first_path_segment"},
Manifest: AutogenManifestConfig{
ReleaseTag: "head-vfx-manifest-current",
AssetName: "sow-head-vfx-manifest.json",
CacheName: "sow-head-vfx-manifest.json",
},
HeadVisualeffects: HeadVisualeffectsConfig{
Groups: map[string]HeadVisualeffectGroupConfig{
"head_jewels": {
ModelColumns: []string{"Imp Root M Node"},
},
},
StripModelPrefixes: []string{""},
ModelColumn: "Imp HeadCon Node",
},
},
},
},
},
}
err := proj.ValidateLayout()
if err == nil {
t.Fatal("expected head visualeffects validation error")
}
for _, needle := range []string{
"autogen.consumers[0].head_visualeffects.groups[head_jewels].prefix",
"autogen.consumers[0].head_visualeffects.groups[head_jewels].model_columns[0]",
"autogen.consumers[0].head_visualeffects.strip_model_prefixes[0]",
"autogen.consumers[0].head_visualeffects.model_column",
} {
if !strings.Contains(err.Error(), needle) {
t.Fatalf("expected validation error to mention %s, got %v", needle, err)
}
}
}
func TestValidateLayoutAcceptsGeneratedTopData2DAConfig(t *testing.T) {
root := t.TempDir()
mkdirAll(t, filepath.Join(root, "assets"))