mirror of
https://github.com/Matysh/houseplan-card
synced 2026-07-31 08:28:31 +00:00
v1.50.2: the v1.50.1 review (HP-1501-01, HP-1501-02)
- HP-1501-01: v1.50.1 bounded layout positions and left room rectangles, polygon vertices, view_box and opening coordinates on bare _finite — the same absurd-magnitude failure, one schema over. _GEOM (±4) covers them all now, opening angles get ±360. And because a store may already hold such a vertex from before the door existed, contentBounds applies its canvas envelope to room geometry exactly as it does to device positions: the point renders where it is, the frame ignores it, a space of nothing but absurd points falls back to the whole canvas. - HP-1501-02: a repair matching zero positions answered ok/moved:0 and replaced the one-deep backup with an empty one — a typo right after repairing the wrong space destroyed the promised way back. Empty match is nothing_to_repair now: no write, no revision bump, backup intact. Old test fixtures carried view_box [0,0,100,100] from the render-unit days; they now use the normalised box the product actually stores.
This commit is contained in:
@@ -144,4 +144,24 @@ test('contentBounds: never degenerate, never unbounded (HP-1500-03)', () => {
|
||||
// ...but a device a bit past the canvas edge still counts (the gate sensor)
|
||||
const near = contentBounds(room, 0.05, [[1100, 500]]);
|
||||
assert.ok(near.x + near.w > 1050, 'slightly outside the canvas still stretches the frame');
|
||||
|
||||
// HP-1501-01: the same envelope guards ROOM GEOMETRY — the server refuses
|
||||
// absurd vertices now, but a store may hold one from before that door
|
||||
// existed, and a legacy 1e100 vertex must not frame the plan into a dot
|
||||
const legacy = spaceModels({ spaces: [{
|
||||
id: 's', view_box: [0, 0, 1, 1],
|
||||
rooms: [
|
||||
{ id: 'ok', poly: [[0.4, 0.4], [0.6, 0.4], [0.6, 0.6], [0.4, 0.6]] },
|
||||
{ id: 'bad', poly: [[0, 0], [1e100, 0], [1, 1]] },
|
||||
],
|
||||
}], markers: [] })[0];
|
||||
const lb = contentBounds(legacy);
|
||||
assert.ok(lb.w < 1500 && lb.h < 1500, 'the absurd vertex does not command the frame');
|
||||
assert.ok(lb.x <= 400 && lb.x + lb.w >= 600, 'the sane room is still inside it');
|
||||
// a space where EVERY point is absurd falls back to the whole canvas
|
||||
const allBad = spaceModels({ spaces: [{
|
||||
id: 's', view_box: [0, 0, 1, 1],
|
||||
rooms: [{ id: 'b', poly: [[1e100, 1e100], [2e100, 1e100], [2e100, 2e100]] }],
|
||||
}], markers: [] })[0];
|
||||
assert.equal(contentBounds(allBad), null, 'the caller keeps the full canvas');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user