Cover which tilemap layer and texture frame get a collision fill
f4cc681 fills tilemap solids only for the selected map and layer, and
texture collision only for the selected frame. Neither the scene view
wiring nor the texture canvas had a test for that.
- __gm.tilemap.solids() now reports the cells that were filled, and
__gm.texture.drawInfo() counts the filled outlines.
- e2e 40l-iii: a selected tile fills nothing. The map selected with
the upper layer fills only cell (4,0), with the lower layer only the
3x3 block. Two selected objects fill nothing again.
- e2e 42: a selected frame fills its one outline. Deselected it fills
none, while the outline stays visible.
- README check total goes from 1375 to 1377. CI confirmed 1375, the
new total is counted, not yet measured.
Tests:
- ./check.sh: 159 files, 2337 tests, CHECK EXIT 0
- e2e 39-43: ALL PASSED, 147 checks (before 145)
- Counter checks: a scene view that fills every map fails only the
tilemap check. A texture canvas that fills every frame fails only
the texture check.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8f29b88cc9
commit
c1a6d63edb
5 files changed
+96
-7
No files matched your search
@@ -998,6 +998,55 @@ export async function tilemap(t) {
|
||||
);
|
||||
await shot('40-tilemap-solid');
|
||||
|
||||
// 40l-iii. The outline shows on every map, the tint only on the map being painted, and there only
|
||||
// where the layer picked in the panel blocks: the block on the lower, (4, 0) on the upper.
|
||||
const tinted = async () =>
|
||||
(await json(`__gm.tilemap.solids(${JSON.stringify(MAP_OBJECT)})`))?.filled ?? null;
|
||||
const tintedByTile = await tinted();
|
||||
await select({ kind: 'object', holderId: 'scene1', objectIds: [MAP_OBJECT], objectId: MAP_OBJECT });
|
||||
await settle();
|
||||
const layerIds = (await json(`__gm.tilemap.layers(${JSON.stringify(made.id)})`)).map((l) => l.id);
|
||||
const tintOf = async (row) => {
|
||||
const spot = await inPanel(t, `__gm.tilemap.layerRowAt(${row})`);
|
||||
if (spot) await click(spot.name.x, spot.y);
|
||||
await settle();
|
||||
// No layer chosen means the topmost is painted on, as the panel has it.
|
||||
const chosen = (await json('__gm.tilemap.paint()')).layerId;
|
||||
return { layer: layerIds.includes(chosen) ? chosen : layerIds.at(-1), filled: await tinted() };
|
||||
};
|
||||
const tintRows = [await tintOf(0), await tintOf(1)];
|
||||
const expectedTint = {
|
||||
[layerIds[0]]: [{ x: 0, y: 0, w: 3, h: 3 }],
|
||||
[layerIds[1]]: [{ x: 4, y: 0, w: 1, h: 1 }],
|
||||
};
|
||||
const besideMap = await json(
|
||||
`__gm.state.activeScene.objects.find((o) => o.id !== ${JSON.stringify(MAP_OBJECT)} && !o.parentId).id`,
|
||||
);
|
||||
await select({
|
||||
kind: 'object',
|
||||
holderId: 'scene1',
|
||||
objectIds: [MAP_OBJECT, besideMap],
|
||||
objectId: MAP_OBJECT,
|
||||
});
|
||||
await settle();
|
||||
const tintedWithTwo = await tinted();
|
||||
await select({ kind: 'asset', assetId: 'at-grass' });
|
||||
await settle();
|
||||
check(
|
||||
'only the selected map is tinted, and only where the layer painted on blocks',
|
||||
tintedByTile === null &&
|
||||
tintedWithTwo === null &&
|
||||
layerIds.length === 2 &&
|
||||
new Set(tintRows.map((r) => r.layer)).size === 2 &&
|
||||
tintRows.every(
|
||||
(r) =>
|
||||
JSON.stringify(r.filled?.rects) === JSON.stringify(expectedTint[r.layer]) &&
|
||||
r.filled.outlines === 0 &&
|
||||
r.filled.oneWay.length === 0,
|
||||
),
|
||||
JSON.stringify({ tintedByTile, tintRows, tintedWithTwo }),
|
||||
);
|
||||
|
||||
// In the game a crate of its own walks into the block: the seeded Crate sprite with a 100 × 60
|
||||
// collider and the Mover (ArrowRight moves its owner, colliding with solids) below it. Its own
|
||||
// rather than the seeded red crate, which an earlier step of a full run may have removed. It
|
||||
|
||||
@@ -327,6 +327,17 @@ export async function shapes(t) {
|
||||
unselected.sheetOutlines === 1 && restored.sheetOutlines === 2 && (await drawInfo()).sheetOutlines === 1,
|
||||
JSON.stringify({ unselected: unselected.sheetOutlines, restored: restored.sheetOutlines }),
|
||||
);
|
||||
// Every frame's outlines show, but only the selected frame's are tinted, so the tint does not lie
|
||||
// over the whole sheet.
|
||||
check(
|
||||
"only the selected frame's collision outlines are tinted",
|
||||
beforeDrag.filled.overlay === 1 &&
|
||||
beforeDrag.filled.sheet === 0 &&
|
||||
unselected.sheetOutlines === 1 &&
|
||||
unselected.filled.sheet === 0 &&
|
||||
unselected.filled.overlay === 0,
|
||||
JSON.stringify({ selected: beforeDrag.filled, unselected: unselected.filled }),
|
||||
);
|
||||
const area = await json('__gm.texture.rect()');
|
||||
const beforePan = await drawInfo();
|
||||
const [px, py] = [Math.round(area.x + area.w / 2), Math.round(area.y + area.h / 2)];
|
||||
|
||||
Reference in new issue
Block a user