test: close PDF export witness gaps

Issue: #53
User-Visible: no
This commit is contained in:
Matysh
2026-09-07 03:50:36 +03:00
parent d277eeb73b
commit 47951e85db
4 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -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',
-1
View File
@@ -5,4 +5,3 @@ export function pdfLocalDate(value: Date): string {
const day = String(value.getDate()).padStart(2, '0');
return `${year}-${month}-${day}`;
}
+9
View File
@@ -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]),
-2
View File
@@ -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' });
});