From 47951e85db0265377120a9c392d2489d7f50c149 Mon Sep 17 00:00:00 2001 From: Matysh Date: Mon, 7 Sep 2026 03:50:36 +0300 Subject: [PATCH] test: close PDF export witness gaps Issue: #53 User-Visible: no --- scripts/mutation-gate.mjs | 2 +- src/pdf/pdf-date.ts | 1 - test/pdf-scene.test.mjs | 9 +++++++++ test/pdf-svg-path.test.mjs | 2 -- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/mutation-gate.mjs b/scripts/mutation-gate.mjs index 52ad1fc3..c858fb41 100644 --- a/scripts/mutation-gate.mjs +++ b/scripts/mutation-gate.mjs @@ -128,7 +128,7 @@ const MUTANT_DEFINITIONS = [ { id: 'pdf-dimensions-ignore-toggle', guard: 'npx tsc -p tsconfig.test.json && node scripts/fix-test-build.mjs ' - + '&& node --test --test-name-pattern="respects names/dimensions" test/pdf-scene.test.mjs', + + '&& node --test --test-name-pattern="dimensions switch removes" test/pdf-scene.test.mjs', because: 'turning dimensions off must remove the external dimension chain as well as room labels', patches: [{ file: 'src/pdf/pdf-scene.ts', diff --git a/src/pdf/pdf-date.ts b/src/pdf/pdf-date.ts index 3abc2d1d..8eb85578 100644 --- a/src/pdf/pdf-date.ts +++ b/src/pdf/pdf-date.ts @@ -5,4 +5,3 @@ export function pdfLocalDate(value: Date): string { const day = String(value.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; } - diff --git a/test/pdf-scene.test.mjs b/test/pdf-scene.test.mjs index a6921ad7..d4dd06c4 100644 --- a/test/pdf-scene.test.mjs +++ b/test/pdf-scene.test.mjs @@ -103,6 +103,15 @@ test('shared wall architecture is emitted once and devices never enter the PDF s && command.text.includes('secret-device-marker'))); }); +test('dimensions switch removes the external chain from physical walls', () => { + const texts = (dimensions) => sharedPage({ + dimensions, roomNames: false, decor: false, backdrop: false, + }).commands.filter((command) => command.kind === 'text').map((command) => command.text) + .filter((value) => value !== '1 m' && /^[-+]?\d+(?:[.,]\d+)?\s(?:m|cm|ft|in)$/.test(value)); + assert.ok(texts(true).length > 0, 'the thick outer wall has a dimension chain'); + assert.deepEqual(texts(false), [], 'the option removes every dimension value'); +}); + test('backdrop is below physical architecture and disappears with its option', () => { const raster = { id: 'backdrop', bytes: new Uint8Array([0xff, 0xd8, 0xff, 0xd9]), diff --git a/test/pdf-svg-path.test.mjs b/test/pdf-svg-path.test.mjs index dca70aaa..c471a5ef 100644 --- a/test/pdf-svg-path.test.mjs +++ b/test/pdf-svg-path.test.mjs @@ -15,7 +15,6 @@ test('every designer furniture path converts to finite PDF vector operations', ( } } }); - test('arc and affine transforms become deterministic cubic paths', () => { const first = transformSvgPath('M0 5A5 5 0 1 1 10 5Z', { a: 2, b: 0, c: 0, d: 3, e: 7, f: 11, @@ -27,4 +26,3 @@ test('arc and affine transforms become deterministic cubic paths', () => { assert.ok(first.some((operation) => operation.op === 'C')); assert.deepEqual(first.at(-1), { op: 'Z' }); }); -