diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b477a0c..33ea76d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,7 +119,7 @@ jobs: npm run render:fonts -- --package-root output/font-baseline-consumer/node_modules/fullbleed --out output/font-baseline npm run verify:fonts -- --evidence-root output/font-baseline --allow-legacy-metadata npm run render:fonts - npm run verify:fonts -- --baseline output/font-baseline --reviewed-layout test/fixtures/inline-layout-2.5.50.json + npm run verify:fonts -- --baseline output/font-baseline --reviewed-layout test/fixtures/inline-layout-2.5.51.json - name: Verify installed custom font families against explicit faces run: | npm run render:families @@ -131,6 +131,13 @@ jobs: python tools/verify-page-margin-fonts.py output/page-margin-baseline --negative-control node tools/render-page-margin-fonts.mjs python tools/verify-page-margin-fonts.py output/page-margin-fonts + - name: Verify font cascade and the published font-selection failure + run: | + npm install --prefix output/font-cascade-baseline-consumer --ignore-scripts --no-audit --no-fund --save-exact fullbleed@0.9.3 + node tools/render-font-cascade.mjs --package-root output/font-cascade-baseline-consumer/node_modules/fullbleed --out output/font-cascade-baseline + python tools/verify-font-cascade.py output/font-cascade-baseline --negative-control + node tools/render-font-cascade.mjs + python tools/verify-font-cascade.py output/font-cascade - name: Verify generated counters and the published contents-wrapper failure run: | npm install --prefix output/generated-counters-baseline-consumer --ignore-scripts --no-audit --no-fund --save-exact fullbleed@0.9.2 @@ -179,8 +186,11 @@ jobs: output/font-subsets/ output/font-families/ output/page-margin-fonts/ + output/font-cascade/ output/page-margin-baseline/ output/page-margin-baseline-consumer/package-lock.json + output/font-cascade-baseline/ + output/font-cascade-baseline-consumer/package-lock.json output/generated-counters/ output/generated-counters-baseline/ output/generated-counters-baseline-consumer/package-lock.json @@ -252,11 +262,13 @@ jobs: run: | python -m pip install pypdf==6.19.0 pypdfium2==5.14.0 fonttools==4.65.0 pillow==12.3.0 npm run render:fonts - npm run verify:fonts -- --reviewed-layout test/fixtures/inline-layout-2.5.50.json + npm run verify:fonts -- --reviewed-layout test/fixtures/inline-layout-2.5.51.json npm run render:families npm run verify:families node tools/render-page-margin-fonts.mjs python tools/verify-page-margin-fonts.py output/page-margin-fonts + node tools/render-font-cascade.mjs + python tools/verify-font-cascade.py output/font-cascade node tools/render-generated-counters.mjs python tools/verify-generated-counters.py output/generated-counters npm run render:inline @@ -295,6 +307,7 @@ jobs: output/font-subsets/ output/font-families/ output/page-margin-fonts/ + output/font-cascade/ output/inline-wrapping/ output/generated-counters/ output/standard-fonts/ diff --git a/README.md b/README.md index 41a7852..7ae78c3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,11 @@ no Python, Rust compiler, browser, or system fonts. MIT licensed. Use `fullbleed` in Node.js, `fullbleed/browser` in a web application, or [`fullbleed/cloudflare`](docs/cloudflare.md) inside a Cloudflare Worker. -Package **0.9.3** wraps the published **Fullbleed 2.5.50** engine. +Package **0.9.4** wraps the published **Fullbleed 2.5.51** engine. + +A winning `font-family` declaration now replaces an earlier variable-based +family. If its variable cannot resolve, the text inherits its parent +family instead of reviving a declaration that lost the cascade. Numbering continues through `display: contents` wrappers, including their children and pseudo-elements. Selectors and inherited styles retain their @@ -15,7 +19,7 @@ document-tree ancestry. Generated CSS counter labels follow document order, including a closing `::after` label that counts the preceding items. This applies to ordinary PDF rendering and fixed or reflow batches. See the -[counter authoring guide](https://github.com/fullbleed-engine/fullbleed-official/blob/v2.5.50/docs/generated-content.md) +[counter authoring guide](https://github.com/fullbleed-engine/fullbleed-official/blob/v2.5.51/docs/generated-content.md) for an example and the remaining scope and list-marker limitations. [Try the browser playground](https://docs.fullbleed.dev/playground/) ยท diff --git a/engine/Cargo.lock b/engine/Cargo.lock index 37c3f10..aae1110 100644 --- a/engine/Cargo.lock +++ b/engine/Cargo.lock @@ -4,9 +4,9 @@ version = 4 [[package]] name = "fullbleed" -version = "2.5.50" +version = "2.5.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc15549f1bb796d9112e16edd646a078e53f744fe561575b04c8c8cc6d3eeb7c" +checksum = "4e85636557d237263eaf721e55a9f1a6d9827318bb8759147d7e2bfc7cfa5b2c" dependencies = [ "fullbleed_audit_contract", "subsetter", @@ -15,7 +15,7 @@ dependencies = [ [[package]] name = "fullbleed-node-adapter" -version = "0.9.3" +version = "0.9.4" dependencies = [ "fullbleed", "serde_json", diff --git a/engine/Cargo.toml b/engine/Cargo.toml index 8d7e7f4..6bd2b33 100644 --- a/engine/Cargo.toml +++ b/engine/Cargo.toml @@ -1,12 +1,12 @@ [package] name = "fullbleed-node-adapter" -version = "0.9.3" +version = "0.9.4" edition = "2024" license = "MIT" publish = false [dependencies] -fullbleed = { version = "=2.5.50", features = ["svg_raster"] } +fullbleed = { version = "=2.5.51", features = ["svg_raster"] } serde_json = "=1.0.154" [profile.release] diff --git a/examples/cloudflare/package.json b/examples/cloudflare/package.json index c070b26..098b969 100644 --- a/examples/cloudflare/package.json +++ b/examples/cloudflare/package.json @@ -11,6 +11,6 @@ "test": "node --test test/request.test.mjs", "test:worker": "node test/worker.mjs" }, - "dependencies": { "fullbleed": "0.9.3" }, + "dependencies": { "fullbleed": "0.9.4" }, "devDependencies": { "wrangler": "4.151.3" } } diff --git a/package-lock.json b/package-lock.json index 685ef13..e3e4769 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "fullbleed", - "version": "0.9.3", + "version": "0.9.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "fullbleed", - "version": "0.9.3", + "version": "0.9.4", "license": "MIT", "dependencies": { "@bjorn3/browser_wasi_shim": "0.4.2" diff --git a/package.json b/package.json index d2a4dc8..48be487 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fullbleed", - "version": "0.9.3", + "version": "0.9.4", "description": "Generate PDFs from HTML/CSS, components or JSX in Node.js, browsers and Cloudflare Workers, with bundled fonts and PNG previews.", "type": "module", "main": "./src/index.cjs", @@ -140,7 +140,7 @@ "access": "public" }, "fullbleed": { - "engineVersion": "2.5.50" + "engineVersion": "2.5.51" }, "devDependencies": { "@types/node": "22.20.5", diff --git a/test/fixtures/font-cascade-2.5.51.json b/test/fixtures/font-cascade-2.5.51.json new file mode 100644 index 0000000..a6a02ac --- /dev/null +++ b/test/fixtures/font-cascade-2.5.51.json @@ -0,0 +1,170 @@ +{ + "schema": "fullbleed.font_cascade.v1", + "cases": [ + { + "name": "later-rule", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Courier" + ], + "pages": 1 + }, + { + "name": "specificity", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Courier" + ], + "pages": 1 + }, + { + "name": "important", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Courier" + ], + "pages": 1 + }, + { + "name": "inline", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Courier" + ], + "pages": 1 + }, + { + "name": "shorthand", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Courier" + ], + "pages": 1 + }, + { + "name": "inherit", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Times-Roman" + ], + "pages": 1 + }, + { + "name": "unset", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Times-Roman" + ], + "pages": 1 + }, + { + "name": "initial", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Helvetica" + ], + "pages": 1 + }, + { + "name": "variable-wins", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Helvetica" + ], + "pages": 1 + }, + { + "name": "missing-variable", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Times-Roman" + ], + "pages": 1 + }, + { + "name": "inherit-fallback", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Times-Roman" + ], + "pages": 1 + }, + { + "name": "unset-fallback", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Times-Roman" + ], + "pages": 1 + }, + { + "name": "initial-fallback", + "html": "Font cascade witness
Font witness
", + "css": "", + "expectedBaseFonts": [ + "Helvetica" + ], + "pages": 1 + } + ], + "scope": "Explicit Base-14 fonts through actual PDF text operators; no complete CSS conformance claim.", + "engineVersion": "2.5.51", + "sourceCommit": "2c292b6dcb56245848f537b5c64e3294895b945e", + "negativeControl": { + "packageVersion": "0.9.3", + "engineVersion": "2.5.50", + "actualBaseFonts": { + "later-rule": [ + "Helvetica" + ], + "specificity": [ + "Helvetica" + ], + "important": [ + "Helvetica" + ], + "inline": [ + "Helvetica" + ], + "shorthand": [ + "Helvetica" + ], + "inherit": [ + "Helvetica" + ], + "unset": [ + "Helvetica" + ], + "initial": [ + "Courier" + ], + "variable-wins": [ + "Helvetica" + ], + "missing-variable": [ + "Courier" + ], + "inherit-fallback": [ + "Courier" + ], + "unset-fallback": [ + "Courier" + ], + "initial-fallback": [ + "Helvetica" + ] + } + } +} diff --git a/test/fixtures/generated-counters-2.5.51.json b/test/fixtures/generated-counters-2.5.51.json new file mode 100644 index 0000000..dea9010 --- /dev/null +++ b/test/fixtures/generated-counters-2.5.51.json @@ -0,0 +1,516 @@ +{ + "schema": "fullbleed.generated_counter_fixture.v1", + "engineVersion": "2.5.51", + "sourceCommit": "2c292b6dcb56245848f537b5c64e3294895b945e", + "sourceTestSha256": "9de2d75bd7723f9738623e941f10d08b38a2880ecb01c5f667bb59ddad4a2ae3", + "font": { + "name": "Inter-Variable.ttf", + "sha256": "29160a80ff49ddcab2c97711247e08b1fab27a484a329ce8b813d820dc559031" + }, + "scope": "70 reviewed core document cases, including 11 display: contents cases. HTML list controls preserve Fullbleed behavior; no general browser parity claim.", + "newCases": [ + "contents-before-reset-new-name", + "contents-counter-order", + "contents-nested-wrappers", + "contents-physical-container-scope", + "contents-physical-sibling-scopes", + "contents-inherited-counter", + "contents-wrapper-mutations-ignored", + "contents-selector-ancestry", + "contents-after-new-counter", + "contents-hidden-wrapper", + "contents-page-boundary" + ], + "cases": [ + { + "name": "block-after-read", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: block }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[2]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "block-after-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: block }.root::after { counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "block-before-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: block }.root::before { counter-increment: n 3 }", + "expectedCounterText": "B[3]I[4]FirstI[5]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "block-both-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: block }.root::before { counter-increment: n 3 } .root::after { counter-increment: n 4 }", + "expectedCounterText": "B[3]I[4]FirstI[5]SecondA[9]T[9]Tail", + "pagesPerRecord": 1 + }, + { + "name": "block-after-set", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: block }.root::after { counter-set: n 8 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[8]T[8]Tail", + "pagesPerRecord": 1 + }, + { + "name": "block-before-reset", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: block }.root::before { counter-reset: n 5 }", + "expectedCounterText": "B[5]I[1]FirstI[2]SecondA[2]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "block-after-reset", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: block }.root::after { counter-reset: n 9 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[9]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "block-empty-before", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: block }.root::before { content: ''; counter-increment: n 3 }", + "expectedCounterText": "I[4]FirstI[5]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "block-empty-after", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: block }.root::after { content: ''; counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondT[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "block-quotes-and-counters", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: block }.root::before { content: open-quote 'B[' counter(n) ']' } .root::after { content: 'A[' counter(n) ']' close-quote }", + "expectedCounterText": "{B[0]I[1]FirstI[2]SecondA[2]}T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-block-after-read", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline-block }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[2]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-block-after-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline-block }.root::after { counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-block-before-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline-block }.root::before { counter-increment: n 3 }", + "expectedCounterText": "B[3]I[4]FirstI[5]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-block-both-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline-block }.root::before { counter-increment: n 3 } .root::after { counter-increment: n 4 }", + "expectedCounterText": "B[3]I[4]FirstI[5]SecondA[9]T[9]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-block-after-set", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline-block }.root::after { counter-set: n 8 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[8]T[8]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-block-before-reset", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline-block }.root::before { counter-reset: n 5 }", + "expectedCounterText": "B[5]I[1]FirstI[2]SecondA[2]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-block-after-reset", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline-block }.root::after { counter-reset: n 9 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[9]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-block-empty-before", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline-block }.root::before { content: ''; counter-increment: n 3 }", + "expectedCounterText": "I[4]FirstI[5]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-block-empty-after", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline-block }.root::after { content: ''; counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondT[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-block-quotes-and-counters", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline-block }.root::before { content: open-quote 'B[' counter(n) ']' } .root::after { content: 'A[' counter(n) ']' close-quote }", + "expectedCounterText": "{B[0]I[1]FirstI[2]SecondA[2]}T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-after-read", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[2]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-after-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline }.root::after { counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-before-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline }.root::before { counter-increment: n 3 }", + "expectedCounterText": "B[3]I[4]FirstI[5]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-both-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline }.root::before { counter-increment: n 3 } .root::after { counter-increment: n 4 }", + "expectedCounterText": "B[3]I[4]FirstI[5]SecondA[9]T[9]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-after-set", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline }.root::after { counter-set: n 8 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[8]T[8]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-before-reset", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline }.root::before { counter-reset: n 5 }", + "expectedCounterText": "B[5]I[1]FirstI[2]SecondA[2]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-after-reset", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline }.root::after { counter-reset: n 9 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[9]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-empty-before", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline }.root::before { content: ''; counter-increment: n 3 }", + "expectedCounterText": "I[4]FirstI[5]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-empty-after", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline }.root::after { content: ''; counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondT[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-quotes-and-counters", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline }.root::before { content: open-quote 'B[' counter(n) ']' } .root::after { content: 'A[' counter(n) ']' close-quote }", + "expectedCounterText": "{B[0]I[1]FirstI[2]SecondA[2]}T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-after-read", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[2]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-after-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents }.root::after { counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-before-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents }.root::before { counter-increment: n 3 }", + "expectedCounterText": "B[3]I[4]FirstI[5]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-both-increment", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents }.root::before { counter-increment: n 3 } .root::after { counter-increment: n 4 }", + "expectedCounterText": "B[3]I[4]FirstI[5]SecondA[9]T[9]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-after-set", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents }.root::after { counter-set: n 8 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[8]T[8]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-before-reset", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents }.root::before { counter-reset: n 5 }", + "expectedCounterText": "B[5]I[1]FirstI[2]SecondA[2]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-after-reset", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents }.root::after { counter-reset: n 9 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[9]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-empty-before", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents }.root::before { content: ''; counter-increment: n 3 }", + "expectedCounterText": "I[4]FirstI[5]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-empty-after", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents }.root::after { content: ''; counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondT[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-quotes-and-counters", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents }.root::before { content: open-quote 'B[' counter(n) ']' } .root::after { content: 'A[' counter(n) ']' close-quote }", + "expectedCounterText": "{B[0]I[1]FirstI[2]SecondA[2]}T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "block-before-reset-new-name", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: block } body { counter-reset: none } .root::before { counter-reset: n 5 }", + "expectedCounterText": "B[5]I[6]FirstI[7]SecondA[7]T[0]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-block-before-reset-new-name", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline-block } body { counter-reset: none } .root::before { counter-reset: n 5 }", + "expectedCounterText": "B[5]I[6]FirstI[7]SecondA[7]T[0]Tail", + "pagesPerRecord": 1 + }, + { + "name": "inline-before-reset-new-name", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: inline } body { counter-reset: none } .root::before { counter-reset: n 5 }", + "expectedCounterText": "B[5]I[6]FirstI[7]SecondA[7]T[0]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-before-reset-new-name", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents } body { counter-reset: none } .root::before { counter-reset: n 5 }", + "expectedCounterText": "B[5]I[6]FirstI[7]SecondA[7]T[7]Tail", + "pagesPerRecord": 1 + }, + { + "name": "hidden-subtree", + "html": "

Record {{name}}

FirstHiddenSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[2]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "invisible-counter", + "html": "

Record {{name}}

FirstHiddenSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n", + "expectedCounterText": "B[0]I[1]FirstI[3]SecondA[3]T[3]Tail", + "pagesPerRecord": 1 + }, + { + "name": "suppressed-pseudo", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root::after { display: none; counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondT[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "no-generated-box", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root::after { content: none; counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondT[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "nested-counter-stack", + "html": "

Record {{name}}

First
Inner
Second
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.nest { counter-reset: n 5 } .nest::after { content: \"N[\" counters(n, \".\") \"]\"; counter-increment: n 2 }", + "expectedCounterText": "B[0]I[1]FirstI[6]InnerN[1.8]I[2]SecondA[2]T[2]Tail", + "pagesPerRecord": 1 + }, + { + "name": "table-cell-after", + "html": "

Record {{name}}

FirstSecondTail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root::after { counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[5]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "anonymous-cell-after", + "html": "

Record {{name}}

First
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root::after { counter-increment: n 3 }", + "expectedCounterText": "B[0]FirstA[3]T[3]Tail", + "pagesPerRecord": 1 + }, + { + "name": "replaced-counter", + "html": "

Record {{name}}

\"\"
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nimg::before { content: counter(n); counter-increment: n 99 }", + "expectedCounterText": "T[4]Tail", + "pagesPerRecord": 1 + }, + { + "name": "counter-format", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root::after { content: 'A[' counter(n, upper-roman) ']'; counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[V]T[5]Tail", + "pagesPerRecord": 1 + }, + { + "name": "root-counter", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nhtml { counter-reset: n 7 } body { counter-reset: none }", + "expectedCounterText": "B[7]I[8]FirstI[9]SecondA[9]T[9]Tail", + "pagesPerRecord": 1 + }, + { + "name": "parent-counter-priority", + "html": "

Record {{name}}

First
Second
End
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.reset { counter-reset: n 5 } .reset::before { content: \"R[\" counter(n) \"]\" }", + "expectedCounterText": "R[5]FirstI[1]SecondT[1]End", + "pagesPerRecord": 1 + }, + { + "name": "pagination", + "html": "

Record {{name}}

First
Second
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.next { break-before: page } .root::after { counter-increment: n 3 }", + "expectedCounterText": "B[0]I[1]FirstI[2]SecondA[5]T[5]Tail", + "pagesPerRecord": 2 + }, + { + "name": "list-start-value", + "html": "

Record {{name}}

  1. First
  2. Second
  3. Third
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nol { list-style: none } li::before { content: counter(list-item) ':' }", + "expectedCounterText": "3:First8:Second9:Third", + "pagesPerRecord": 1 + }, + { + "name": "list-value-whitespace", + "html": "

Record {{name}}

  1. First
  2. Second
  3. Third
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nol { list-style: none } li::before { content: counter(list-item) ':' }", + "expectedCounterText": "3:First8:Second9:Third", + "pagesPerRecord": 1 + }, + { + "name": "list-reversed", + "html": "

Record {{name}}

  1. First
  2. Second
  3. Third
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nol { list-style: none } li::before { content: counter(list-item) ':' }", + "expectedCounterText": "3:First2:Second1:Third", + "pagesPerRecord": 1 + }, + { + "name": "literal-control", + "html": "

Record {{name}}

B[0]FirstA[2]

", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n", + "expectedCounterText": "B[0]FirstA[2]", + "pagesPerRecord": 1 + }, + { + "name": "contents-counter-order", + "html": "

Record {{name}}

One

Two

Three

", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nbody { counter-reset: none }\n.contents { display: contents }\n.count { counter-increment: n }\n.count::before { content: 'C=' counter(n) }\n", + "expectedCounterText": "C=1OneC=2TwoC=3Three", + "pagesPerRecord": 1 + }, + { + "name": "contents-nested-wrappers", + "html": "

Record {{name}}

One

Two

Three

", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nbody { counter-reset: none }\n.contents { display: contents }\n.count { counter-increment: n }\n.count::before { content: 'C=' counter(n) }\n", + "expectedCounterText": "C=1OneC=2TwoC=3Three", + "pagesPerRecord": 1 + }, + { + "name": "contents-physical-container-scope", + "html": "

Record {{name}}

One

Two

Three

", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nbody { counter-reset: none }\n.contents { display: contents }\n.count { counter-increment: n }\n.count::before { content: 'C=' counter(n) }\n", + "expectedCounterText": "C=1OneC=2TwoC=1Three", + "pagesPerRecord": 1 + }, + { + "name": "contents-physical-sibling-scopes", + "html": "

Record {{name}}

One

Two

Three

", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nbody { counter-reset: none }\n.contents { display: contents }\n.count { counter-increment: n }\n.count::before { content: 'C=' counter(n) }\n.contents { display: block }", + "expectedCounterText": "C=1OneC=1TwoC=1Three", + "pagesPerRecord": 1 + }, + { + "name": "contents-inherited-counter", + "html": "

Record {{name}}

One

Two

Three

", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nbody { counter-reset: none }\n.contents { display: contents }\n.count { counter-increment: n }\n.count::before { content: 'C=' counter(n) }\nbody { counter-reset: n 7 }", + "expectedCounterText": "C=8OneC=9TwoC=10Three", + "pagesPerRecord": 1 + }, + { + "name": "contents-wrapper-mutations-ignored", + "html": "

Record {{name}}

One

Two

Three

", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nbody { counter-reset: none }\n.contents { display: contents }\n.count { counter-increment: n }\n.count::before { content: 'C=' counter(n) }\nbody { counter-reset: n } .contents { counter-reset: n 99; counter-set: n 88; counter-increment: n 17 }", + "expectedCounterText": "C=1OneC=2TwoC=3Three", + "pagesPerRecord": 1 + }, + { + "name": "contents-selector-ancestry", + "html": "

Record {{name}}

One

Two

Three

", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nbody { counter-reset: none }\n.contents { display: contents }\n.count { counter-increment: n }\n.count::before { content: 'C=' counter(n) }\n.count { counter-increment: none } .contents > .count { counter-increment: n }", + "expectedCounterText": "C=1OneC=2TwoC=3Three", + "pagesPerRecord": 1 + }, + { + "name": "contents-after-new-counter", + "html": "

Record {{name}}

FirstSecond
Tail
", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\n.root { display: contents } body { counter-reset: none } .root::before { content: none } .root::after { counter-reset: n 9 }", + "expectedCounterText": "I[1]FirstI[2]SecondA[9]T[9]Tail", + "pagesPerRecord": 1 + }, + { + "name": "contents-hidden-wrapper", + "html": "

Record {{name}}

One

Hidden

Two

Three

", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nbody { counter-reset: none }\n.contents { display: contents }\n.count { counter-increment: n }\n.count::before { content: 'C=' counter(n) }\n", + "expectedCounterText": "C=1OneC=2TwoC=3Three", + "pagesPerRecord": 1 + }, + { + "name": "contents-page-boundary", + "html": "

Record {{name}}

One

Two

Three

", + "css": "@page { size: 600px 400px; margin: 12px }\n* { margin: 0; padding: 0 }\nbody { font: 18px Inter; line-height: 1.5; counter-reset: n; quotes: \"{\" \"}\" }\n.root::before { content: 'B[' counter(n) ']' }\n.root::after { content: 'A[' counter(n) ']' }\n.item { counter-increment: n }\n.item::before { content: 'I[' counter(n) ']' }\n.tail::before { content: 'T[' counter(n) ']' }\nbody { counter-reset: none }\n.contents { display: contents }\n.count { counter-increment: n }\n.count::before { content: 'C=' counter(n) }\n", + "expectedCounterText": "C=1OneC=2TwoC=3Three", + "pagesPerRecord": 2 + } + ] +} diff --git a/test/fixtures/inline-layout-2.5.51.json b/test/fixtures/inline-layout-2.5.51.json new file mode 100644 index 0000000..5bace3f --- /dev/null +++ b/test/fixtures/inline-layout-2.5.51.json @@ -0,0 +1,94 @@ +{ + "schema": "fullbleed.reviewed_inline_layout.v1", + "engineVersion": "2.5.51", + "source": "https://crates.io/crates/fullbleed/2.5.51", + "reason": "Engine 2.5.51 must preserve the reviewed inline-layout PDF, preview and text expectations. Expected outputs are unchanged.", + "fonts": [ + { + "name": "Inter-Variable.ttf", + "path": "fonts/Inter-Variable.ttf", + "bytes": 876576, + "sha256": "29160a80ff49ddcab2c97711247e08b1fab27a484a329ce8b813d820dc559031" + }, + { + "name": "DMSerifDisplay-Regular.ttf", + "path": "fonts/DMSerifDisplay-Regular.ttf", + "bytes": 76580, + "sha256": "8cc3643535edf039aa5d95440a8542735e9197e4f4b8d9303e980fefbf5ab616" + }, + { + "name": "DMSerifDisplay-Italic.ttf", + "path": "fonts/DMSerifDisplay-Italic.ttf", + "bytes": 71208, + "sha256": "df74c0ac387baeaeb0fe4f2324e1668e6a3ed8c09cd9796fe162c71753e19e45" + }, + { + "name": "BebasNeue-Regular.ttf", + "path": "fonts/BebasNeue-Regular.ttf", + "bytes": 61400, + "sha256": "08e4623805102d819f58601e46e345648846075e363b2ceb23313c2d1c83ec73" + }, + { + "name": "NotoSansMath-Regular.ttf", + "path": "fonts/NotoSansMath-Regular.ttf", + "bytes": 590904, + "sha256": "80b61fd613d3519197e64fff6f7e71fdc7f3e6526440ea4115b554ef7fd59af7" + } + ], + "fixtures": { + "invoice": { + "htmlSha256": "195725eeeb32c521e19b47dbacbb55048bebb6df8566ab135cdc41fbf33fe57a", + "cssSha256": "cda22b39ab1f7a1eeac7cd76d162b05cd3568c2430c099123ba30a2fbd58a296", + "pages": 1, + "text": "Northstar\nStudio\nD E S I G N W I T H D I R E C T I O N\nB R A N D\nD I G I T A L\nE X P E R I E N C E S\nT H A T M A T T E R .\n42 Cedar Avenue\nPortland, OR 97205\nhello@example.invalid\nnorthstar.example.invalid\nINVOICE\nGOOD WORK.\nCLEAR DETAILS.\nLET'S MAKE\nWHAT'S NEXT.\nP R E P A R E D F O R\nMaple & Finch\nAttn. Avery Morgan\nPortland, Oregon\nT H E P R O J E C T\nAutumn launch\nBrand workshop, digital\ndesign & handoff\nI N V O I C E N S - 1 0 4 2\nIssued \u00b7 01 October 2026\nDue \u00b7 31 October 2026\nCurrency \u00b7 USD\nDESCRIPTION HOURS RATE AMOUNT\nDiscovery & brand workshop\nPositioning, priorities, and a clear creative direction\n8 $125.00 $1,000.00\nDigital design & implementation\nA cohesive visual system, from layout to launch\n6 $95.00 $570.00\nReview & studio handoff\nFinal refinements, documentation, and delivery\n2 $150.00 $300.00\nA little clarity.\nA lot of possibility.\nThank you for inviting us\nto help shape your next chapter.\nSubtotal $1,870.00\nTax \u00b7 0% in this sample $0.00\nT O T A L D U E \u00b7 U S D\n$1,870.00\nP A Y M E N T D E T A I L S\nReference NS-1042 with your payment.\nPayment instructions are supplied separately.\nA N O T E F R O M T H E S T U D I O\nQuestions about a line item?\nWrite to hello@example.invalid.\nNORTHSTAR STUDIO / INVOICE NS-1042 FICTIONAL SAMPLE \u00b7 01 / 01", + "pdfSha256": "3078d155f30536f5ad721f7be3c241cd78661ae41249131fc0fd65f37f23e408", + "previewsSha256": [ + "72420749ccc3deaa8025daf7baffcdf79be716b6e8e93ed605effebed01e86c7" + ], + "pdfiumPixelSha256": [ + "d71293741974bef9abffbdf5d88b0827b48fe6523f8d9baf46f46fe1000895a5" + ] + }, + "report": { + "htmlSha256": "46b0e975d43914c8b4492218feae09ea0ad684091a9f9ee3b18f66a87202e521", + "cssSha256": "519591ae75c239ec602324f008dd99108ebeae0b9306df7215fa5f0442905473", + "pages": 3, + "text": "Common Ground\nC O M M U N I T Y T R U S T\nP E O P L E\nP L A C E S\nP O S S I B I L I T I E S\nCOMMON\nGROUND\nStronger places.\nMore room\nfor everyone.\n2026\nC O M M U N I T Y R E V I E W\nA Y E A R\nI N C O M M O N\n0 2 / O U R R E A C H\nSmall actions,\nshared outcomes.\n0 3 / O U R R E S O U R C E S\nWhere the\nsupport goes.\nCOMMON GROUND / COMMUNITY REVIEW FICTIONAL DATA \u00b7 01 / 03Common Ground\n0 2 / O U R R E A C H\nA P L A C E T O B E G I N\nSmall actions.\nShared outcomes.\nAn open door, a working kitchen, a garden plot. This year, our fictional neighborhood\nprograms connected more people with practical spaces to learn, make, and belong.\n1,240\nhouseholds took part\nacross four neighborhoods\n4,860\nvolunteer hours\nshared across our programs\n12\ncommunity spaces\nkept open and active\nMore neighbors, each quarter.\nP A R T I C I P A T I N G H O U S E H O L D S\n420\n560\n790\n980\nQ1 Q2 Q3 Q4\nQuarterly participation counts; a household can participate in more than one quarter.\n\u201cBelonging starts\nwith somewhere\nto show up.\u201d\nO U R P R O G R A M P R I N C I P L E\nBuilt around daily life.\nEvening workshops, shared meals, and weekend garden\nsessions made participation easier for people with different\nschedules. The next step is a longer opening window at\neach neighborhood space.\nILLUSTRATIVE ANNUAL REVIEW / NOT AN ACTUAL ORGANIZATION 02 / 03Common Ground\n0 3 / O U R R E S O U R C E S\nF O L L O W T H E S U P P O R T\nGood intentions.\nClear allocations.\nA practical view of this fictional operating budget. Every category supports the same\naim: useful places, open to more people.\nPROGRAM AREA ALLOCATION SHARE\nNeighborhood spaces $168,000.00 40%\nLearning & workshops $126,000.00 30%\nShared meals & gardens $84,000.00 20%\nAccess & transport $42,000.00 10%\nT O T A L O P E R A T I N G A L L O C A T I O N \u00b7 U S D $420,000.00\nWhat we count.\nHouseholds are deduplicated within the annual program\nregister. Volunteer hours include recorded event and\nmaintenance time. Space counts refer to year-round\nlocations, not individual events.\nQuarterly counts show participation within each period and\nmust not be added to estimate unique annual reach.\nWhat comes next.\nExtend evening access. Improve step-free entrances.\nPublish a simple monthly view of program activity and\nspending.\nA shared tomorrow\nis built in the everyday.\nCOMMON GROUND / METHODS & ALLOCATIONS FICTIONAL DATA \u00b7 03 / 03", + "pdfSha256": "80fc4306db1898688d846cfea4fb1b4ef5bf07713fe9301662143619441205b5", + "previewsSha256": [ + "33ee3398d59f6836368cdab0f3c725c3cf12cbf2f9f3a3ac6a6b168f6c1886f5", + "9e883a04ab32392aa87ef5931761285b8dc15f8fd642b4f9bbea582c044bcdbe", + "8c8bfdc01ef7a3c376fbe61a0736dbc5b65280b0781f0040c550e097e71a5dcd" + ], + "pdfiumPixelSha256": [ + "c7dc8db8fc08a78f74c4477629e0f68f3b34aa37b9b9eba46a977805933d3f03", + "50298b3a05370f4dcefedf47b121c1da74e48307e85fac695dfbc5c1207b100e", + "55c5468322b64ae2583439553a13057218c418d38c4fcbeb0e492ec98160961c" + ] + } + }, + "baselineSource": "https://crates.io/crates/fullbleed/2.5.24", + "previousReference": "inline-layout-2.5.41.json", + "previousReferenceSha256": "e6c796356e3b1360885ad3ea9c1ae27adda484f76cc6fee9c1f31fb7c9eae828", + "previousReview": { + "unchangedFixtures": [ + "invoice", + "inter", + "dm-serif", + "dm-serif-italic", + "bebas-neue", + "math" + ], + "reportPages": 3, + "changedGlyphsPerPage": [ + 0, + 12, + 12 + ], + "change": "Common Ground heading baseline: 0.75pt down on pages 2 and 3.", + "allContentPreserved": true, + "allGlyphsWithinPage": true, + "publicPythonCore": "2.5.34", + "publicPythonPdfSha256": "80fc4306db1898688d846cfea4fb1b4ef5bf07713fe9301662143619441205b5" + } +} diff --git a/test/fixtures/page-margin-native-2.5.51.json b/test/fixtures/page-margin-native-2.5.51.json new file mode 100644 index 0000000..8e84500 --- /dev/null +++ b/test/fixtures/page-margin-native-2.5.51.json @@ -0,0 +1,431 @@ +{ + "schema": "fullbleed.page_margin_native_reference.v1", + "sourceHead": "2c292b6dcb56245848f537b5c64e3294895b945e", + "engineVersion": "2.5.51", + "sourceRun": "https://github.com/fullbleed-engine/fullbleed-official/actions/runs/41323250059", + "artifactId": 13090366466, + "reportSha256": "1f9c9348a21730fd4e8fd02f4d44a628e0ac0225617c0a24122424b51b459dd7", + "fixtureSha256": "d74cbcc6e0ae61efb746af59747323bb61a1c6e8f2e5fd72a71219c78c3eb273", + "cases": [ + { + "name": "local-alias", + "control": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + }, + "alias": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + } + }, + { + "name": "url-alias", + "control": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + }, + "alias": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + } + }, + { + "name": "inherited-weight", + "control": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + }, + "alias": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + } + }, + { + "name": "fallback-alias", + "control": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + }, + "alias": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + } + }, + { + "name": "page-inherit", + "control": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + }, + "alias": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + } + }, + { + "name": "quoted-generic-alias", + "control": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + }, + "alias": { + "pdfSha256": "89f2421db55c9c68fbb476743ba147803a2240ff9ee2b2eeeeb851ebb75f9c28", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "12fab057a3d6fce496fed9de11510eb8fddac2a133d2e5eb278a33fda9d66550" + ], + "pdfiumPixelsSha256": [ + "672d2a6757eb3791e92dfa7ff284eb7933dfd85dd4a258a2bc4262d37ffef274" + ] + } + }, + { + "name": "size-adjust", + "control": { + "pdfSha256": "95a4ce20c19888e270cd8733c9a3334112cda65ecad538376ccd17c002e549c6", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 15.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "d9b53bd4b43a76f132a9aa55c708da337347c44e41bdb456c14ba9b898c0e810" + ], + "pdfiumPixelsSha256": [ + "2b1848e1771111fae4039628b1fad1795b23214b08970162a9fc3bf224660de2" + ] + }, + "alias": { + "pdfSha256": "95a4ce20c19888e270cd8733c9a3334112cda65ecad538376ccd17c002e549c6", + "pages": [ + { + "text": "Record Alpha \u2014 body text. FOOTER 1 of 1", + "footer": { + "text": "FOOTER 1 of 1", + "font": "DMSerifDisplay-Regular", + "size": 15.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "d9b53bd4b43a76f132a9aa55c708da337347c44e41bdb456c14ba9b898c0e810" + ], + "pdfiumPixelsSha256": [ + "2b1848e1771111fae4039628b1fad1795b23214b08970162a9fc3bf224660de2" + ] + } + }, + { + "name": "named-pages", + "control": { + "pdfSha256": "06e929f29d6e5d98b9e55df44af824eb9cd94d269c395adcf66115d4a34c23b1", + "pages": [ + { + "text": "Record Alpha \u2014 first body. FOOTER 1 of 2", + "footer": { + "text": "FOOTER 1 of 2", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + }, + { + "text": "Record Alpha \u2014 second body. FOOTER 2 of 2", + "footer": { + "text": "FOOTER 2 of 2", + "font": "NotoSans-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "b911ece97b670d8ee29605cb8a1adb0df744407ed5bce5130d0bcb0fcc177f0b", + "d0d12bc6fabc3c36db2a6607fa0da0fefdd903139ed058f106850dd2fe05ec88" + ], + "pdfiumPixelsSha256": [ + "b8dd4174a0fcf6c5cf44dd53499a5ad258263840312f647c2eb0e9430284b0fc", + "aa07e09729f9ee547b5aab1fcfcd63d23e49dd5c7b268697f7c142f80984dc90" + ] + }, + "alias": { + "pdfSha256": "06e929f29d6e5d98b9e55df44af824eb9cd94d269c395adcf66115d4a34c23b1", + "pages": [ + { + "text": "Record Alpha \u2014 first body. FOOTER 1 of 2", + "footer": { + "text": "FOOTER 1 of 2", + "font": "DMSerifDisplay-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + }, + { + "text": "Record Alpha \u2014 second body. FOOTER 2 of 2", + "footer": { + "text": "FOOTER 2 of 2", + "font": "NotoSans-Regular", + "size": 12.0 + }, + "fonts": [ + "DMSerifDisplay-Regular", + "NotoSans-Regular" + ] + } + ], + "nativePreviewSha256": [ + "b911ece97b670d8ee29605cb8a1adb0df744407ed5bce5130d0bcb0fcc177f0b", + "d0d12bc6fabc3c36db2a6607fa0da0fefdd903139ed058f106850dd2fe05ec88" + ], + "pdfiumPixelsSha256": [ + "b8dd4174a0fcf6c5cf44dd53499a5ad258263840312f647c2eb0e9430284b0fc", + "aa07e09729f9ee547b5aab1fcfcd63d23e49dd5c7b268697f7c142f80984dc90" + ] + } + } + ] +} diff --git a/test/test_font_cascade_release.py b/test/test_font_cascade_release.py new file mode 100644 index 0000000..ab70a70 --- /dev/null +++ b/test/test_font_cascade_release.py @@ -0,0 +1,71 @@ +# SPDX-License-Identifier: MIT +"""Release gates reject missing outputs, incorrect font selections and wrong packages.""" +import copy +from hashlib import sha256 +import importlib.util +import json +from pathlib import Path +import unittest + +ROOT = Path(__file__).resolve().parents[1] +spec = importlib.util.spec_from_file_location('release_check', ROOT / 'tools/verify-release.py') +release = importlib.util.module_from_spec(spec) +spec.loader.exec_module(release) + +class FontCascadeReleaseTests(unittest.TestCase): + def setUp(self): + data = release.FONT_CASCADE_SOURCE.read_bytes() + source = json.loads(data) + def evidence(platform, negative=False): + cases = [] + for case in source['cases']: + actual = source['negativeControl']['actualBaseFonts'][case['name']] if negative else case['expectedBaseFonts'] + cases.append({'name': case['name'], 'pages': 1, 'missingGlyphs': 0, 'pdfSha256': '1' * 64, + 'expectedBaseFonts': case['expectedBaseFonts'], 'actualBaseFonts': actual, + 'matchesExpected': actual == case['expectedBaseFonts'], + 'previews': [{'filename': case['name'] + '-1.png', 'sha256': '2' * 64}]}) + return {'ok': True, 'negativeControl': negative, 'platform': platform, + 'isolation': 'process', 'defaultStyles': False, 'fixtureSha256': sha256(data).hexdigest(), + 'packageVersion': '0.9.3' if negative else '0.9.4', 'engineVersion': '2.5.50' if negative else '2.5.51', + 'tarballSha256': '3' * 64, 'wasmSha256': '4' * 64, 'documents': 13, 'cases': cases, + 'failures': sorted(c['name'] for c in cases if not c['matchesExpected'])} + self.report = {'package_version': '0.9.4', 'engine_version': '2.5.51', 'package_sha256': '3' * 64, + 'wasm_sha256': '4' * 64, 'font_cascade': [evidence('linux'), evidence('win32')], + 'font_cascade_negative_control': evidence('linux', True)} + + def test_complete_corrected_and_public_control_evidence(self): + release.verify_font_cascade_evidence(self.report) + + def test_wrong_font_cannot_be_hidden_by_success_flag(self): + self.report['font_cascade'][0]['cases'][0]['actualBaseFonts'] = ['Wrong'] + with self.assertRaises(ValueError): + release.verify_font_cascade_evidence(self.report) + + def test_missing_case_platform_or_preview_is_rejected(self): + for kind in ['case', 'platform', 'preview']: + report = copy.deepcopy(self.report) + if kind == 'case': report['font_cascade'][0]['cases'].pop() + elif kind == 'platform': report['font_cascade'].pop() + else: report['font_cascade'][0]['cases'][0]['previews'] = [] + with self.subTest(kind=kind), self.assertRaises(ValueError): + release.verify_font_cascade_evidence(report) + + def test_stale_source_package_or_engine_is_rejected(self): + for key in ['fixtureSha256', 'tarballSha256', 'wasmSha256', 'packageVersion', 'engineVersion']: + report = copy.deepcopy(self.report) + report['font_cascade'][0][key] = 'wrong' + with self.subTest(key=key), self.assertRaises(ValueError): + release.verify_font_cascade_evidence(report) + + def test_uncalibrated_negative_control_is_rejected(self): + self.report['font_cascade_negative_control']['cases'][0]['actualBaseFonts'] = ['Wrong'] + with self.assertRaises(ValueError): + release.verify_font_cascade_evidence(self.report) + + def test_cross_platform_output_difference_is_rejected(self): + self.report['font_cascade'][1]['cases'][0]['pdfSha256'] = '5' * 64 + with self.assertRaises(ValueError): + release.verify_font_cascade_evidence(self.report) + +if __name__ == '__main__': + unittest.main() diff --git a/tools/render-font-cascade.mjs b/tools/render-font-cascade.mjs new file mode 100644 index 0000000..a31c457 --- /dev/null +++ b/tools/render-font-cascade.mjs @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: MIT +// Render explicit Base-14 witnesses through the installed npm tarball. +import assert from 'node:assert/strict'; +import { createHash } from 'node:crypto'; +import { mkdir, readFile, writeFile } from 'node:fs/promises'; +import { join, resolve } from 'node:path'; +import { fileURLToPath, pathToFileURL } from 'node:url'; +import { parseArgs } from 'node:util'; + +const root = fileURLToPath(new URL('../', import.meta.url)); +const { values } = parseArgs({ options: { + 'package-root': { type: 'string' }, out: { type: 'string' }, +} }); +let packageRoot = values['package-root']; +if (!packageRoot) { + const packed = JSON.parse(await readFile(join(root, 'output/pack-verification/verification.json'), 'utf8')); + assert(packed.ok); + packageRoot = join(root, 'output/pack-verification', packed.installDirectory, 'node_modules/fullbleed'); +} +packageRoot = resolve(packageRoot); +const { renderPdf, version, engineVersion } = await import(pathToFileURL(join(packageRoot, 'src/index.js')).href); +const hash = bytes => createHash('sha256').update(bytes).digest('hex'); +const build = JSON.parse(await readFile(join(packageRoot, 'dist/build.json'), 'utf8')); +assert.equal(build.packageVersion, version); +assert.equal(build.engineVersion, engineVersion); +assert.equal(hash(await readFile(join(packageRoot, 'dist/engine.wasm'))), build.files['dist/engine.wasm'].sha256); +const bytes = await readFile(join(root, 'test/fixtures/font-cascade-2.5.51.json')); +const fixture = JSON.parse(bytes); +assert.equal(fixture.cases.length, 13); +const output = resolve(values.out ?? join(root, 'output/font-cascade')); +await mkdir(join(output, '..'), { recursive: true }); +await mkdir(output); +await writeFile(join(output, 'inputs.json'), bytes); +const report = { status: 'rendering', packageVersion: version, engineVersion, node: process.version, + platform: process.platform, wasmSha256: build.files['dist/engine.wasm'].sha256, + fixtureSha256: hash(bytes), isolation: 'process', defaultStyles: false, cases: [] }; +try { + for (const specimen of fixture.cases) { + const result = await renderPdf({ html: specimen.html, css: specimen.css, + defaultStyles: false, isolation: 'process', previewDpi: 96 }); + assert.equal(result.engineVersion, engineVersion); + assert.equal(result.pages, specimen.pages); + assert.equal(result.missingGlyphs, 0); + const filename = specimen.name + '.pdf'; + await writeFile(join(output, filename), result.pdf); + const previews = []; + for (const [index, preview] of result.previews.entries()) { + const name = specimen.name + '-' + (index + 1) + '.png'; + await writeFile(join(output, name), preview); + previews.push({ filename: name, sha256: hash(preview) }); + } + report.cases.push({ name: specimen.name, filename, pdfSha256: hash(result.pdf), + pages: result.pages, missingGlyphs: result.missingGlyphs, previews }); + } + report.status = 'rendered-awaiting-independent-readback'; +} finally { + await writeFile(join(output, 'renders.json'), JSON.stringify(report, null, 2) + '\n'); +} +console.log(JSON.stringify({ status: report.status, version, engineVersion, cases: report.cases.length })); diff --git a/tools/render-generated-counters.mjs b/tools/render-generated-counters.mjs index 49a67bf..4b26979 100644 --- a/tools/render-generated-counters.mjs +++ b/tools/render-generated-counters.mjs @@ -25,7 +25,7 @@ const build = JSON.parse(await readFile(join(packageRoot, 'dist/build.json'), 'u assert.equal(build.packageVersion, version); assert.equal(build.engineVersion, engineVersion); assert.equal(hash(await readFile(join(packageRoot, 'dist/engine.wasm'))), build.files['dist/engine.wasm'].sha256); -const fixtureBytes = await readFile(join(root, 'test/fixtures/generated-counters-2.5.50.json')); +const fixtureBytes = await readFile(join(root, 'test/fixtures/generated-counters-2.5.51.json')); const fixture = JSON.parse(fixtureBytes); assert.equal(fixture.cases.length, 70); assert.equal(fixture.newCases.length, 11); diff --git a/tools/verify-font-cascade.py b/tools/verify-font-cascade.py new file mode 100644 index 0000000..171e33d --- /dev/null +++ b/tools/verify-font-cascade.py @@ -0,0 +1,75 @@ +# SPDX-License-Identifier: MIT +"""Check the text operators' actual fonts rather than unused PDF resources.""" +import argparse +from hashlib import sha256 +from importlib.metadata import version +import json +from pathlib import Path +from PIL import Image +from pypdf import PdfReader +from pypdf.generic import ContentStream + +ROOT = Path(__file__).resolve().parents[1] +SOURCE = ROOT / 'test/fixtures/font-cascade-2.5.51.json' + +def verify(directory, negative_control=False): + directory = Path(directory) + source_bytes = SOURCE.read_bytes() + source = json.loads(source_bytes) + report = json.loads((directory / 'renders.json').read_bytes()) + assert report['status'] == 'rendered-awaiting-independent-readback' + assert report['fixtureSha256'] == sha256(source_bytes).hexdigest() + assert (directory / 'inputs.json').read_bytes() == source_bytes + assert report['isolation'] == 'process' and report['defaultStyles'] is False + if negative_control: + assert report['packageVersion'] == source['negativeControl']['packageVersion'] == '0.9.3' + assert report['engineVersion'] == source['negativeControl']['engineVersion'] == '2.5.50' + else: + assert report['engineVersion'] == source['engineVersion'] == '2.5.51' + expected = {case['name']: case for case in source['cases']} + assert len(expected) == len(report['cases']) == 13 + assert {case['name'] for case in report['cases']} == expected.keys() + cases = [] + for row in report['cases']: + name = row['name'] + assert row['filename'] == name + '.pdf' and row['missingGlyphs'] == 0 + path = directory / row['filename'] + assert sha256(path.read_bytes()).hexdigest() == row['pdfSha256'] + reader = PdfReader(path, strict=True) + assert len(reader.pages) == row['pages'] == expected[name]['pages'] == 1 + page = reader.pages[0] + assert ' '.join(page.extract_text().split()) == 'Font witness' + stream = ContentStream(page.get_contents(), reader) + used = {str(args[0]) for args, operator in stream.operations if operator == b'Tf'} + mapping = page['/Resources']['/Font'] + actual = sorted({str(mapping[key].get_object()['/BaseFont']).removeprefix('/') for key in used}) + assert actual + assert len(row['previews']) == 1 + preview = row['previews'][0] + assert preview['filename'] == name + '-1.png' + image_path = directory / preview['filename'] + assert sha256(image_path.read_bytes()).hexdigest() == preview['sha256'] + with Image.open(image_path) as image: + assert min(image.convert('L').getextrema()) < 200 + cases.append({**row, 'actualBaseFonts': actual, 'expectedBaseFonts': expected[name]['expectedBaseFonts'], + 'matchesExpected': actual == expected[name]['expectedBaseFonts']}) + failed = sorted(case['name'] for case in cases if not case['matchesExpected']) + if negative_control: + assert {case['name']: case['actualBaseFonts'] for case in cases} == source['negativeControl']['actualBaseFonts'] + assert len(failed) == 11 + else: + assert not failed, failed + result = {**{key: value for key, value in report.items() if key not in ['status', 'cases']}, + 'ok': True, 'negativeControl': negative_control, 'reader': 'pypdf ' + version('pypdf'), + 'documents': len(cases), 'failures': failed, 'cases': cases, + 'scope': source['scope']} + (directory / 'verification.json').write_text(json.dumps(result, indent=2) + '\n', encoding='utf-8') + return result + +if __name__ == '__main__': + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('directory', nargs='?', type=Path, default=ROOT / 'output/font-cascade') + parser.add_argument('--negative-control', action='store_true') + args = parser.parse_args() + result = verify(args.directory, args.negative_control) + print(json.dumps({key: result[key] for key in ['ok', 'negativeControl', 'packageVersion', 'engineVersion', 'documents', 'failures']})) diff --git a/tools/verify-generated-counters.py b/tools/verify-generated-counters.py index 15bee01..681a1dd 100644 --- a/tools/verify-generated-counters.py +++ b/tools/verify-generated-counters.py @@ -11,7 +11,7 @@ import pypdfium2 as pdfium ROOT = Path(__file__).resolve().parents[1] -SOURCE = ROOT / 'test/fixtures/generated-counters-2.5.50.json' +SOURCE = ROOT / 'test/fixtures/generated-counters-2.5.51.json' MODES = ('direct', 'fixed', 'reflow') @@ -31,7 +31,7 @@ def verify(directory, *, negative_control=False, baseline=None): if negative_control: assert report['packageVersion'] == '0.9.2' and report['engineVersion'] == '2.5.49' else: - assert report['engineVersion'] == source['engineVersion'] == '2.5.50' + assert report['engineVersion'] == source['engineVersion'] == '2.5.51' modes = ('direct',) if negative_control else MODES assert tuple(report['modes']) == modes assert len(source['cases']) == 70 and len(source['newCases']) == 11 diff --git a/tools/verify-page-margin-fonts.py b/tools/verify-page-margin-fonts.py index 4b0ffb6..7cff811 100644 --- a/tools/verify-page-margin-fonts.py +++ b/tools/verify-page-margin-fonts.py @@ -86,7 +86,7 @@ def verify(root, negative_control=False): assert {case['name'] for case in source['cases']} == expected.keys() if negative_control: assert source['packageVersion'] == '0.9.0' and source['engineVersion'] == '2.5.46' - native_path = Path(__file__).resolve().parents[1] / 'test/fixtures/page-margin-native-2.5.50.json' + native_path = Path(__file__).resolve().parents[1] / 'test/fixtures/page-margin-native-2.5.51.json' native_bytes = native_path.read_bytes() native = json.loads(native_bytes) assert native['fixtureSha256'] == source['fixtureSha256'] diff --git a/tools/verify-release.py b/tools/verify-release.py index e0173b9..9970eea 100644 --- a/tools/verify-release.py +++ b/tools/verify-release.py @@ -33,8 +33,9 @@ NAMED_FONT_FILE = ENGINE_REGRESSION_SOURCE.parents[1] / 'fonts/family/LibreCaslonText[wght].ttf' BATCH_SOURCE = ENGINE_REGRESSION_SOURCE.parents[1] / 'batch-fixtures.mjs' PAGE_MARGIN_SOURCE = ENGINE_REGRESSION_SOURCE.with_name('page-margin-fonts-2.5.48.json') -PAGE_MARGIN_NATIVE = ENGINE_REGRESSION_SOURCE.with_name('page-margin-native-2.5.50.json') -GENERATED_COUNTER_SOURCE = ENGINE_REGRESSION_SOURCE.with_name('generated-counters-2.5.50.json') +PAGE_MARGIN_NATIVE = ENGINE_REGRESSION_SOURCE.with_name('page-margin-native-2.5.51.json') +GENERATED_COUNTER_SOURCE = ENGINE_REGRESSION_SOURCE.with_name('generated-counters-2.5.51.json') +FONT_CASCADE_SOURCE = ENGINE_REGRESSION_SOURCE.with_name('font-cascade-2.5.51.json') def require(condition, message): @@ -81,7 +82,7 @@ def verify_engine_paint_evidence(report): source_sha = hashlib.sha256(source).hexdigest() names = {case['name'] for case in fixture['cases']} families = {case['family'] for case in fixture['cases']} - require(report.get('engine_version') in {fixture['engineVersion'], '2.5.46', '2.5.48', '2.5.49', '2.5.50'}, 'Paint fixtures target another engine') + require(report.get('engine_version') in {fixture['engineVersion'], '2.5.46', '2.5.48', '2.5.49', '2.5.50', '2.5.51'}, 'Paint fixtures target another engine') evidence = report.get('engine_paint', []) require(len(evidence) == 2 and {item.get('platform') for item in evidence} == {'win32', 'linux'}, 'Paint inspection requires Windows and Linux evidence') @@ -262,7 +263,7 @@ def verify_text_decorations_evidence(report): expectations_sha = hashlib.sha256(TEXT_DECORATIONS_EXPECTATIONS.read_bytes()).hexdigest() oracle = json.loads(TEXT_DECORATIONS_EXPECTATIONS.read_bytes()) require(oracle['inputSha256'] == source_sha and oracle['engineVersion'] == '2.5.40' - and report.get('engine_version') in {'2.5.40', '2.5.41', '2.5.43', '2.5.46', '2.5.48', '2.5.49', '2.5.50'}, + and report.get('engine_version') in {'2.5.40', '2.5.41', '2.5.43', '2.5.46', '2.5.48', '2.5.49', '2.5.50', '2.5.51'}, 'Text decorations target another core or fixture') names = sorted(row['name'] for row in oracle['cases']) failing_names = sorted(row['name'] for row in oracle['cases'] if row['previousEngineFails']) @@ -350,7 +351,7 @@ def verify_radial_gradient_evidence(report): evidence = report.get('radial_gradients', []) require(len(evidence) == 2 and {row.get('platform') for row in evidence} == {'linux', 'win32'}, 'Radial gradients require separate Linux and Windows installed-package evidence') - require(report.get('engine_version') in {'2.5.43', '2.5.46', '2.5.48', '2.5.49', '2.5.50'}, 'Radial evidence targets another engine') + require(report.get('engine_version') in {'2.5.43', '2.5.46', '2.5.48', '2.5.49', '2.5.50', '2.5.51'}, 'Radial evidence targets another engine') for row in evidence: require(row.get('ok') is True and row.get('negative_control') is False and row.get('package_version') == report.get('package_version') @@ -529,6 +530,60 @@ def verify_generated_counter_evidence(report): 'The public generated-counter failure count changed') +def verify_font_cascade_evidence(report): + source_bytes = FONT_CASCADE_SOURCE.read_bytes() + source = json.loads(source_bytes) + source_sha = hashlib.sha256(source_bytes).hexdigest() + expected = {case['name']: case for case in source['cases']} + require(len(expected) == 13 and report['engine_version'] == source['engineVersion'], + 'Font-cascade fixtures target another engine') + evidence = report.get('font_cascade', []) + require(len(evidence) == 2 and {row.get('platform') for row in evidence} == {'linux', 'win32'}, + 'Font-cascade PDFs require Windows and Linux evidence') + + def check_cases(row, negative): + cases = row.get('cases', []) + require(row.get('documents') == len(cases) == 13 and {case.get('name') for case in cases} == set(expected), + 'Font-cascade cases are missing or duplicated') + failures = [] + for case in cases: + name = case['name'] + fonts = expected[name]['expectedBaseFonts'] + actual = source['negativeControl']['actualBaseFonts'][name] if negative else fonts + require(case.get('actualBaseFonts') == actual and case.get('expectedBaseFonts') == fonts + and case.get('matchesExpected') is (actual == fonts) and case.get('pages') == 1 + and case.get('missingGlyphs') == 0 and re.fullmatch(r'[0-9a-f]{64}', case.get('pdfSha256', '')), + 'Actual PDF font selections are wrong or uncalibrated') + previews = case.get('previews', []) + require(len(previews) == 1 and previews[0].get('filename') == name + '-1.png' + and re.fullmatch(r'[0-9a-f]{64}', previews[0].get('sha256', '')), + 'Font-cascade preview evidence is incomplete') + if actual != fonts: + failures.append(name) + require(row.get('failures') == sorted(failures), 'Font-cascade failure summary differs from actual cases') + return {case['name']: (case['pdfSha256'], case['previews'][0]['sha256']) for case in cases} + + reference = None + for row in evidence: + require(row.get('ok') is True and row.get('negativeControl') is False and row.get('isolation') == 'process' + and row.get('defaultStyles') is False and row.get('fixtureSha256') == source_sha + and row.get('packageVersion') == report['package_version'] and row.get('engineVersion') == report['engine_version'] + and row.get('tarballSha256') == report['package_sha256'] and row.get('wasmSha256') == report['wasm_sha256'], + 'Font-cascade evidence targets another package or source') + outputs = check_cases(row, False) + if reference is None: + reference = outputs + require(outputs == reference, 'Font-cascade outputs differ between Windows and Linux') + negative = report.get('font_cascade_negative_control', {}) + require(negative.get('ok') is True and negative.get('negativeControl') is True + and negative.get('isolation') == 'process' and negative.get('defaultStyles') is False + and negative.get('packageVersion') == '0.9.3' and negative.get('engineVersion') == '2.5.50' + and negative.get('fixtureSha256') == source_sha, + 'The actual public font-cascade failure control is missing') + check_cases(negative, True) + + + def verify_binding(version, run_id, run, release, tag_commit, report): require(re.fullmatch(r'[0-9]+\.[0-9]+\.[0-9]+', version), 'Use a stable numeric version') require(re.fullmatch(r'[0-9]+', run_id), 'Use a numeric CI run ID') @@ -599,7 +654,7 @@ def verify_binding(version, run_id, run, release, tag_commit, report): hidden_sha = hashlib.sha256(hidden_source).hexdigest() hidden_fixture = json.loads(hidden_source) hidden_cases = hidden_fixture['cases'] - require(report.get('engine_version') in {hidden_fixture['engineVersion'], '2.5.46', '2.5.48', '2.5.49', '2.5.50'}, + require(report.get('engine_version') in {hidden_fixture['engineVersion'], '2.5.46', '2.5.48', '2.5.49', '2.5.50', '2.5.51'}, 'Hidden-text fixtures target another engine') hidden = report.get('hidden_text', []) require(len(hidden) == 2 and {item.get('platform') for item in hidden} == {'win32', 'linux'}, @@ -650,6 +705,8 @@ def verify_binding(version, run_id, run, release, tag_commit, report): verify_page_margin_evidence(report) if release_version >= (0, 9, 2): verify_generated_counter_evidence(report) + if release_version >= (0, 9, 4): + verify_font_cascade_evidence(report) def verify_tarball(data, info, report):