Files
aego/app/edit/export_metadata_test.go
sanspie a6822156cd
ci-platforms / windows amd64 smoke (push) Skipped
ci / release (push) Successful in 8m58s
ci-platforms / darwin amd64 smoke (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
ci / checks (push) Successful in 4m46s
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 13m28s
Finish Stage 12 editor fixes and refreshed platformer
2026-11-05 17:36:42 +03:00

36 lines
1.2 KiB
Go

package edit
import (
"testing"
gameexport "aego/app/export"
"aego/asset/pipeline"
"aego/core/log"
"aego/engine/problems"
)
func TestExportRejectsUnsavedMetadataWorkingOverlay(t *testing.T) {
p := newProject(t)
pl, err := pipeline.Open(p, pipeline.NewImporterRegistry(), log.Nop())
if err != nil {
t.Fatal(err)
}
defer pl.Close()
// The loader may display a private Undo generation while the pipeline retains the saved artifact; export must reject this even for .meta changes.
for _, path := range []string{"assets/platform_height.png.meta", "assets/effects/Dust.aepreset"} {
t.Run(path, func(t *testing.T) {
x := &exporter{p: p, pl: pl, dirtySources: func() []string { return []string{path} }}
snapshot := x.Prepare().(*gameexport.Snapshot)
if len(snapshot.DirtySources) != 1 || snapshot.DirtySources[0] != path {
t.Fatal("working generation was silently omitted from export snapshot")
}
for _, d := range x.Check(snapshot, "release") {
if d.Code == gameexport.CodeDirtySource && d.Severity == problems.Error && d.Subject.File == path {
return
}
}
t.Fatal("export accepted a different generation from the dirty document")
})
}
}