Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

test(render): four more fixtures get the criterion they were drawn for

esengine8c68e0683257
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e9433fbbf..c14dea19e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -202,11 +202,16 @@ published separately; it ships inside the editor.
looking at the shadow rather than at the scene.
New gate `check-fixture-scenes`: a fixture with no criterion behind it must be
- named, with what it would prove. Nine are (UI layout and text, KTX2
- orientation, parallax, pixel-perfect sampling) — that list is the work, and
- empty is where it is meant to end. Two more were neither: `platformer.esscene`
- and `space-shooter.esscene` were copies of golden project scenes, built out of
- game script components that do not exist in the fixture corpus.
+ named, with what it would prove. Four more of those fixtures now run: a KTX2
+ transcode is checked against the same image as a PNG, half by half, so one
+ arriving upside down is caught (the existing KTX2 criterion reads colour, which
+ a flip does not change); a parallax factor of 1 must leave a sprite where the
+ world put it; anchored UI panels must land on the edge they name; and a Text's
+ UINode box must keep its width. Four remain, three because what they would
+ prove is a glyph — a probe on one reads the host's font, not the engine. Two
+ other fixtures were neither driven nor worth driving: `platformer.esscene` and
+ `space-shooter.esscene` were copies of golden project scenes, built out of game
+ script components that do not exist in the fixture corpus.
- **The UI hit test took three mouse flags and threw them away.**
`uiHitTestWorld(world, x, y, mouseDown, mousePressed, mouseReleased)` carried
diff --git a/fixtures/scenes/ui-layout.textures.json b/fixtures/scenes/ui-layout.textures.json
new file mode 100644
index 000000000..0967ef424
--- /dev/null
+++ b/fixtures/scenes/ui-layout.textures.json
@@ -0,0 +1 @@
+{}
diff --git a/tools/check-fixture-scenes.mjs b/tools/check-fixture-scenes.mjs
index af9dac2fe..7000a7873 100644
--- a/tools/check-fixture-scenes.mjs
+++ b/tools/check-fixture-scenes.mjs
@@ -24,15 +24,15 @@ const SCENES = 'fixtures/scenes';
* entry here is a scene someone drew and nothing looks at.
*/
const UNDRIVEN = {
- 'ui-layout.esscene': 'flex layout across 25 nodes — no criterion since the layout gates moved to the editor checks',
- 'ui-node-absolute.esscene': 'absolute positioning inside a flex parent; see ui-layout',
- 'ui-text-effects.esscene': 'outline / shadow text styling; see ui-layout',
- 'ui-text-uinode.esscene': 'text sized by its UINode box; see ui-layout',
- 'ui-text-zorder.esscene': 'text drawn over and under its siblings; see ui-layout',
- 'ui-textinput.esscene': 'a focused TextInput with a caret; see ui-layout',
- 'ktx2-orientation.esscene': 'whether a transcoded KTX2 arrives the right way up — the ktx2 criterion checks colour, not orientation',
- 'parallax-control.esscene': 'a sprite parallax factor driven per axis',
- 'pixel-perfect.esscene': 'a texture sampled 1:1 at an integer camera position',
+ // Each of these would prove something about a GLYPH, and a probe on a glyph
+ // reads the host's font — it says as much about the machine as the engine.
+ // They need a criterion shaped for text, not a point.
+ 'ui-text-effects.esscene': 'outline and shadow on a glyph',
+ 'ui-text-zorder.esscene': 'a text drawn over the panel it sits on',
+ 'ui-textinput.esscene': 'the glyphs and caret inside an SDF input field',
+ // Pixel-perfect snapping moves a solid-colour sprite by less than a fifth of
+ // a pixel here: the fixture has no texture whose sampling would show it.
+ 'pixel-perfect.esscene': 'a camera at a fractional position snapped to whole pixels',
};
const drivers = [];
diff --git a/tools/renderScenes.mjs b/tools/renderScenes.mjs
index eb14e126b..bd6bc5a76 100644
--- a/tools/renderScenes.mjs
+++ b/tools/renderScenes.mjs
@@ -236,6 +236,26 @@ export const SCENES = [
// light-aim migration in a real frame too. Lit at 180, not 255: a directional
// light carries its Lambert term.
{ id: "shadow2d-directional", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/mat-lit-shadow-dir.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/mat-lit-shadow-dir.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.25,\"y\":0.5,\"rgb\":[0,180,0],\"tol\":40},{\"x\":0.75,\"y\":0.5,\"rgb\":[0,0,0],\"tol\":40}]" } },
+ // The same red-over-blue image as a PNG and as a KTX2, side by side: a
+ // transcode that arrives upside down swaps the KTX2 pair and nothing else,
+ // which a criterion probing only one half — or only the colours — cannot see.
+ { id: "ktx2-orientation", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/ktx2-orientation.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/ktx2-orientation.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "4", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.2333,\"y\":0.35,\"rgb\":[220,20,20],\"tol\":25},{\"x\":0.7667,\"y\":0.35,\"rgb\":[220,20,20],\"tol\":25},{\"x\":0.2333,\"y\":0.65,\"rgb\":[20,20,220],\"tol\":25},{\"x\":0.7667,\"y\":0.65,\"rgb\":[20,20,220],\"tol\":25}]" } },
+ // parallax 1 = the sprite belongs to the world, so a camera 200 to its right
+ // leaves it 200 to the left of centre. Read as 0 it would be pinned to the
+ // camera and sit in the middle, which is what the second probe refuses.
+ { id: "parallax-control", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/parallax-control.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/parallax-control.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.1667,\"y\":0.5,\"rgb\":[0,255,0],\"tol\":30},{\"x\":0.5,\"y\":0.5,\"rgb\":[0,0,0],\"tol\":20}]" } },
+ // Three absolutely-positioned boxes inside one flex panel, each a different
+ // colour in a different corner: an inset read off the wrong edge moves one of
+ // them onto the panel's grey, which no single-corner probe would notice.
+ { id: "ui-absolute", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/ui-node-absolute.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/ui-node-absolute.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "4", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.05,\"y\":0.1,\"rgb\":[217,64,64],\"tol\":25},{\"x\":0.95,\"y\":0.1,\"rgb\":[64,204,89],\"tol\":25},{\"x\":0.5,\"y\":0.95,\"rgb\":[77,115,230],\"tol\":25},{\"x\":0.5,\"y\":0.5,\"rgb\":[31,31,38],\"tol\":20}]" } },
+ // Four anchored panels, one per edge, each its own colour: an anchor resolved
+ // against the wrong edge moves one onto the black behind it. The probes avoid
+ // the labels — what this proves is where a box lands, not how a glyph looks.
+ { id: "ui-anchor-layout", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/ui-layout.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/ui-layout.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "4", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.08,\"y\":0.08,\"rgb\":[41,82,143],\"tol\":25},{\"x\":0.78,\"y\":0.08,\"rgb\":[143,41,82],\"tol\":25},{\"x\":0.5,\"y\":0.92,\"rgb\":[41,122,62],\"tol\":25},{\"x\":0.36,\"y\":0.78,\"rgb\":[102,41,122],\"tol\":25}]" } },
+ // A Text sized by its UINode box: the box is what is checked, across its width
+ // and just outside it, so a box that collapsed or grew is caught without
+ // asking a glyph to land on a given pixel.
+ { id: "ui-text-box", tier: "pr", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/ui-text-uinode.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/ui-text-uinode.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "4", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.36,\"y\":0.36,\"rgb\":[46,51,71],\"tol\":20},{\"x\":0.64,\"y\":0.36,\"rgb\":[46,51,71],\"tol\":20},{\"x\":0.5,\"y\":0.7,\"rgb\":[0,0,0],\"tol\":15}]" } },
{ id: "material-lit", tier: "nightly", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/mat-lit.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/mat-lit.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.5,\"y\":0.5,\"rgb\":[0,255,0],\"tol\":50}]" } },
{ id: "material-lit-point", tier: "pr", webgpu: { ESTELLA_VERIFY_EXPECT: "[{\"x\":0.5,\"y\":0.5,\"rgb\":[0,253,0],\"tol\":25},{\"x\":0.75,\"y\":0.5,\"rgb\":[0,52,0],\"tol\":25}]" }, env: { ESTELLA_VERIFY_SCENE: "/scenes/mat-lit-point.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/mat-lit-point.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.5,\"y\":0.5,\"rgb\":[0,255,0],\"tol\":50},{\"x\":0.75,\"y\":0.5,\"rgb\":[0,64,0],\"tol\":60}]" } },
{ id: "material-lit-normal", tier: "nightly", webgpu: true, env: { ESTELLA_VERIFY_SCENE: "/scenes/mat-lit-normal.esscene", ESTELLA_VERIFY_MANIFEST: "/scenes/mat-lit-normal.textures.json", ESTELLA_VERIFY_W: "256", ESTELLA_VERIFY_H: "256", ESTELLA_VERIFY_STEPS: "2", ESTELLA_VERIFY_EXPECT: "[{\"x\":0.333,\"y\":0.5,\"rgb\":[0,252,0],\"tol\":45},{\"x\":0.667,\"y\":0.5,\"rgb\":[0,36,0],\"tol\":50}]" } },