mirror of
https://github.com/Matysh/houseplan-card
synced 2026-09-29 03:09:36 +00:00
test(2.5d): drive the label-metrics smoke through the public zoom controls (#665)
Validate on c93b3a90 failed no-new-private-writes: the smoke moved the
camera by writing card._view. It now presses the header zoom buttons
(data-hp zoom-fit / zoom-in) until the label font has at least doubled
(14 -> 38 px on the demo stand) and reads the private camera state only to
wait for the transition. Same assertions; the mutant
iso-room-label-44-box-centres-name still turns it red
(gapMatchesFlatAtEveryZoom, gapIsZoomIndependent).
Issue: #665
User-Visible: no
This commit is contained in:
@@ -30,25 +30,27 @@ const out = await page.evaluate(async () => {
|
||||
const metrics = label.querySelector('.rlmetrics').getBoundingClientRect();
|
||||
return { id: label.dataset.id, name: name.height, gap: metrics.top - name.bottom };
|
||||
});
|
||||
// Two cameras around the same centre: the label font follows the zoom.
|
||||
const atZooms = async () => {
|
||||
const base = { ...card._view };
|
||||
const rows = [];
|
||||
for (const factor of [1.6, 0.35]) {
|
||||
const w = base.w * factor;
|
||||
const h = base.h * factor;
|
||||
card._view = { x: base.x + (base.w - w) / 2, y: base.y + (base.h - h) / 2, w, h };
|
||||
card.requestUpdate();
|
||||
await card.updateComplete;
|
||||
await frame();
|
||||
await frame();
|
||||
rows.push(measure());
|
||||
}
|
||||
card._view = base;
|
||||
card.requestUpdate();
|
||||
// Two cameras through the public zoom controls: fit, then zoomed in until
|
||||
// the label font has at least doubled (the font follows the zoom).
|
||||
const settleCamera = async () => {
|
||||
for (let guard = 0; card._cameraTransition?.active && guard < 90; guard++) await frame();
|
||||
await card.updateComplete;
|
||||
await frame();
|
||||
return rows;
|
||||
};
|
||||
const press = async (hp) => {
|
||||
root().querySelector(`[data-hp="${hp}"]`)?.click();
|
||||
await settleCamera();
|
||||
};
|
||||
const atZooms = async () => {
|
||||
await press('zoom-fit');
|
||||
const first = measure();
|
||||
let last = first;
|
||||
for (let step = 0; step < 8 && last[0] && last[0].name < first[0].name * 2.2; step++) {
|
||||
await press('zoom-in');
|
||||
last = measure();
|
||||
}
|
||||
await press('zoom-fit');
|
||||
return [first, last];
|
||||
};
|
||||
|
||||
await window.__hpTest.setVolumetricView(false);
|
||||
|
||||
Reference in New Issue
Block a user