ci-platforms / darwin amd64 smoke (push) Skipped
GitHub / linux amd64 native GitHub-hosted native CI: success
ci-platforms / windows amd64 smoke (push) Skipped
GitHub / windows amd64 native GitHub-hosted native CI: success
GitHub / darwin arm64 native GitHub-hosted native CI: success
GitHub / darwin amd64 native GitHub-hosted native CI: success
ci / checks (push) Failing after 1h21m34s
ci / native-authoring (push) Skipped
ci-platforms / darwin arm64 smoke (push) Skipped
github-native / gitea-pending (push) Skipped
github-native / darwin amd64 native (push) Skipped
github-native / linux amd64 native (push) Skipped
github-native / windows amd64 native (push) Skipped
github-native / darwin arm64 native (push) Skipped
github-native / gitea-result (push) Skipped
ci / build (amd64, linux, ubuntu-24.04) (push) Successful in 12m4s
ci / release (push) Skipped
Add dockable Art tools, animation and previews, guarded asset workflows, and the Web Asset Studio built on the shared Art Core. Expand English and Russian documentation, interactive Try scenes, examples and editor icons. Add audio waveform navigation, source analysis, guarded previews and a browser Worker mixer. Preserve source changes and recovery with bounded checks, and strengthen native, browser and interoperability CI. Prepare version 0.12.5 and manually built native artifact candidates. Fix the production site image demo build dependency. Reuse immutable scene indices when capturing keyframes. Wait for real Persist save/load completion in component tests. Stabilize browser Game View captures outside pointer hover. Aseprite interchange and persistent Audio EDL recovery remain limited; the artifact workflow does not publish releases or change stable.
98 lines
2.8 KiB
Go
98 lines
2.8 KiB
Go
package editor
|
|
|
|
import (
|
|
"encoding/json"
|
|
"image/png"
|
|
"io/fs"
|
|
"testing"
|
|
|
|
"aego/engine/res"
|
|
)
|
|
|
|
// Check the embedded images, not just the SVG source or the icon-use list: a
|
|
// missing or blank baked region otherwise silently becomes a letter fallback.
|
|
func TestArtIconsAreBakedAtBothScales(t *testing.T) {
|
|
ids := []string{
|
|
"file.art", "panel.art_tools", "panel.art_timeline", "ui.hidden",
|
|
"tool.pencil", "tool.eraser", "tool.fill", "tool.line", "tool.rectangle",
|
|
"tool.ellipse", "tool.gradient", "tool.selection", "tool.wand", "tool.eyedropper", "tool.select_ellipse", "tool.lasso", "ui.curve", "comp.polygon",
|
|
}
|
|
data, err := fs.ReadFile(res.FS(), "icons/icons.json")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
var manifest struct {
|
|
Atlases []struct {
|
|
Scale int `json:"scale"`
|
|
File string `json:"file"`
|
|
Icons []struct {
|
|
ID string `json:"id"`
|
|
Size int `json:"size"`
|
|
X int `json:"x"`
|
|
Y int `json:"y"`
|
|
W int `json:"w"`
|
|
H int `json:"h"`
|
|
} `json:"icons"`
|
|
} `json:"atlases"`
|
|
}
|
|
if err := json.Unmarshal(data, &manifest); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
seenScales := map[int]bool{}
|
|
for _, atlas := range manifest.Atlases {
|
|
if atlas.Scale != 1 && atlas.Scale != 2 {
|
|
continue
|
|
}
|
|
if seenScales[atlas.Scale] {
|
|
t.Fatalf("duplicate icon atlas scale %d", atlas.Scale)
|
|
}
|
|
seenScales[atlas.Scale] = true
|
|
file, err := res.FS().Open("icons/" + atlas.File)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
image, err := png.Decode(file)
|
|
file.Close()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, id := range ids {
|
|
for _, size := range []int{16, 24} {
|
|
found := 0
|
|
for _, icon := range atlas.Icons {
|
|
if icon.ID != id || icon.Size != size {
|
|
continue
|
|
}
|
|
found++
|
|
if icon.W != size*atlas.Scale || icon.H != size*atlas.Scale || icon.X < 0 || icon.Y < 0 || icon.X+icon.W > image.Bounds().Dx() || icon.Y+icon.H > image.Bounds().Dy() {
|
|
t.Fatalf("%s %d@%dx has an invalid region: %+v", id, size, atlas.Scale, icon)
|
|
}
|
|
ink := false
|
|
for y := icon.Y; y < icon.Y+icon.H && !ink; y++ {
|
|
for x := icon.X; x < icon.X+icon.W; x++ {
|
|
_, _, _, alpha := image.At(x, y).RGBA()
|
|
ink = ink || alpha != 0
|
|
}
|
|
}
|
|
if !ink {
|
|
t.Errorf("%s %d@%dx is blank", id, size, atlas.Scale)
|
|
}
|
|
if id == "file.art" && size == 16 && atlas.Scale == 1 {
|
|
_, _, _, pencil := image.At(icon.X+6, icon.Y+10).RGBA()
|
|
_, _, _, paper := image.At(icon.X+4, icon.Y+8).RGBA()
|
|
if pencil != 0 || paper == 0 {
|
|
t.Error("art document icon lost its pencil cutout")
|
|
}
|
|
}
|
|
}
|
|
if found != 1 {
|
|
t.Errorf("%s %d@%dx: found %d atlas regions", id, size, atlas.Scale, found)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if !seenScales[1] || !seenScales[2] {
|
|
t.Fatalf("missing 1x or 2x atlas: %v", seenScales)
|
|
}
|
|
}
|