e2e: add tablet and foldable viewports to the layout matrix

Z Fold cover/inner (portrait-ish and landscape-ish), Pixel Fold inner, half-folded
flex posture (841x400), dual-screen spanned, iPad Air and iPad Pro 12.9. All pass
the reachability assertions; the dead-band limit now scales with screen height.
MATRIX_ONLY="WxH,WxH" runs a subset.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8
This commit is contained in:
Claude 2026-10-10 18:07:21 +00:00
parent a5bd09d505
commit 962189419a

View file

@ -14,6 +14,23 @@ for (const [w, h] of [[320, 568], [360, 640], [375, 667], [390, 844], [414, 896]
} }
SIZES.push([1280, 720, 'mouse', 10], [1024, 768, 'mouse', 10], [800, 600, 'mouse', 10], [640, 400, 'mouse', 10]); // desktop windows (incl. 200% zoom of 1280x800) SIZES.push([1280, 720, 'mouse', 10], [1024, 768, 'mouse', 10], [800, 600, 'mouse', 10], [640, 400, 'mouse', 10]); // desktop windows (incl. 200% zoom of 1280x800)
SIZES.push([320, 568, 'touch', 6], [667, 375, 'touch', 6], [390, 844, 'touch', 6], [1280, 720, 'mouse', 6]); // the palette as it ships today SIZES.push([320, 568, 'touch', 6], [667, 375, 'touch', 6], [390, 844, 'touch', 6], [1280, 720, 'mouse', 6]); // the palette as it ships today
// tablets and foldables (CSS px). Near-square unfolded screens sit right on the portrait/landscape switch; the half-folded
// "flex" posture is a very short wide viewport; the cover screen is a narrow tall phone.
SIZES.push(
[344, 800, 'touch', 6], // Galaxy Z Fold cover screen
[690, 830, 'touch', 6], // Galaxy Z Fold inner screen, portrait-ish
[830, 690, 'touch', 6], // ... and landscape-ish
[701, 841, 'touch', 6], [841, 701, 'touch', 6], // Pixel Fold inner screen
[841, 400, 'touch', 6], // half-folded flex posture
[1114, 705, 'touch', 6], // dual-screen device spanned across both panels
[820, 1180, 'touch', 6], [1180, 820, 'touch', 6], // iPad Air
[1024, 1366, 'touch', 6], [1366, 1024, 'touch', 6], // iPad Pro 12.9
);
// MATRIX_ONLY="344x800,690x830" runs just those sizes (quick local runs)
if (process.env.MATRIX_ONLY) {
const only = process.env.MATRIX_ONLY.split(',');
for (let i = SIZES.length - 1; i >= 0; i--) if (!only.includes(SIZES[i][0] + 'x' + SIZES[i][1])) SIZES.splice(i, 1);
}
// pretend the game ships 10 towers and 8 maps (the sim is untouched: clones of existing definitions) // pretend the game ships 10 towers and 8 maps (the sim is untouched: clones of existing definitions)
function stressContent() { function stressContent() {
@ -140,7 +157,7 @@ module.exports = async function ({ browser, url: URL, out: OUT }) {
check(!hud.tbOver && !hud.clipped, 'top bar content overflows or is cut off'); check(!hud.tbOver && !hud.clipped, 'top bar content overflows or is cut off');
// stacked (portrait) layout: the stage hugs the board (no dead band above/below it, touch-4 / visual-10) and the cells are not smaller than before // stacked (portrait) layout: the stage hugs the board (no dead band above/below it, touch-4 / visual-10) and the cells are not smaller than before
const lay = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(), r = NW.app.renderer, b = r.board, rot = r.rot > 0; return { stacked: matchMedia('(orientation: portrait), (max-width: 760px) and (min-height: 521px)').matches, deadY: st.height - (rot ? b.cols : b.rows) * r.cellSizePx(), cell: r.cellSizePx() }; }); const lay = await page.evaluate(() => { const st = document.getElementById('stage').getBoundingClientRect(), r = NW.app.renderer, b = r.board, rot = r.rot > 0; return { stacked: matchMedia('(orientation: portrait), (max-width: 760px) and (min-height: 521px)').matches, deadY: st.height - (rot ? b.cols : b.rows) * r.cellSizePx(), cell: r.cellSizePx() }; });
if (lay.stacked) check(lay.deadY <= 26, `stage has ${Math.round(lay.deadY)}px of dead band above/below the board`); if (lay.stacked) check(lay.deadY <= Math.max(26, h * 0.025), `stage has ${Math.round(lay.deadY)}px of dead band above/below the board`); // 26px on phones, 2.5% of the height on big tablets
const minCell = { '320x568': 11.5, '360x640': 14.3, '375x667': 15, '390x844': 19.5, '414x896': 21, '768x1024': 27 }[`${w}x${h}`]; const minCell = { '320x568': 11.5, '360x640': 14.3, '375x667': 15, '390x844': 19.5, '414x896': 21, '768x1024': 27 }[`${w}x${h}`];
if (minCell && touch) check(lay.cell >= minCell, `board cells are ${lay.cell.toFixed(1)}px, expected at least ${minCell}px`); if (minCell && touch) check(lay.cell >= minCell, `board cells are ${lay.cell.toFixed(1)}px, expected at least ${minCell}px`);
if (touch) console.log(` ${w}x${h} cell ${lay.cell.toFixed(1)}px, stage dead band ${Math.round(lay.deadY)}px`); if (touch) console.log(` ${w}x${h} cell ${lay.cell.toFixed(1)}px, stage dead band ${Math.round(lay.deadY)}px`);