Fix validation steps for image files

This commit is contained in:
2026-04-09 20:44:21 +02:00
parent 68aea4ba00
commit 94ffcc5868
4 changed files with 23 additions and 45 deletions
+21 -3
View File
@@ -8073,7 +8073,7 @@ func TestBuildAndPackageIncludesCompiled2DAAndTopAssets(t *testing.T) {
"columns": ["Label"],
"rows": [{"id": 0, "Label": "TEST_LABEL"}]
}`+"\n")
writeFile(t, filepath.Join(root, "topdata", "assets", "gui", "testicon.tga"), "icon-data")
writeFile(t, filepath.Join(root, "topdata", "assets", "gui", "testicon.png"), "icon-data")
proj := testProject(root)
proj.Config.TopData.ReferenceBuilder = ""
@@ -8106,7 +8106,7 @@ func TestBuildAndPackageIncludesCompiled2DAAndTopAssets(t *testing.T) {
if key == "repadjust.2da" {
found2DA = true
}
if key == "testicon.tga" {
if key == "testicon.png" {
foundAsset = true
}
}
@@ -8114,13 +8114,31 @@ func TestBuildAndPackageIncludesCompiled2DAAndTopAssets(t *testing.T) {
t.Fatalf("expected repadjust.2da in top package")
}
if !foundAsset {
t.Fatalf("expected testicon.tga in top package")
t.Fatalf("expected testicon.png in top package")
}
if _, err := os.Stat(result.OutputTLKPath); err != nil {
t.Fatalf("expected packaged tlk output: %v", err)
}
}
func TestValidateProjectAcceptsPNGTopPackageAsset(t *testing.T) {
root := testProjectRoot(t)
mkdirAll(t, filepath.Join(root, "topdata", "data", "repadjust"))
mkdirAll(t, filepath.Join(root, "topdata", "assets", "gui"))
writeFile(t, filepath.Join(root, "topdata", "base_dialog.json"), "{}\n")
writeFile(t, filepath.Join(root, "topdata", "data", "repadjust", "base.json"), `{
"output": "repadjust.2da",
"columns": ["Label"],
"rows": [{"id": 0, "Label": "TEST_LABEL"}]
}`+"\n")
writeFile(t, filepath.Join(root, "topdata", "assets", "gui", "testicon.png"), "icon-data")
report := ValidateProject(testProject(root))
if report.HasErrors() {
t.Fatalf("expected png topdata asset to validate, got %#v", report.Diagnostics)
}
}
func TestBuildPackageRequiresExistingCompiledOutput(t *testing.T) {
root := testProjectRoot(t)
mkdirAll(t, filepath.Join(root, "topdata", "data", "repadjust"))