Skip to content

test(qa): measure a DOCX fidelity line from its first letter, not from a space before it - #815

Merged
DemchaAV merged 1 commit into
2.5-devfrom
test/docx-fidelity-first-letter
Oct 2, 2026
Merged

DemchaAV merged 1 commit into
2.5-devfrom
test/docx-fidelity-first-letter

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Why

The DOCX fidelity gate reads each editor's PDF with PdfLines. A line takes the baseline of the glyph that opens it, and a space opened one.

Word writes a space for an empty paragraph. When one is drawn just before a line of text beside it, on a baseline a few points off, it opens that line and gives it the space's baseline. The text has not moved, but the gate measures it as moved. In SlateOrange the job titles measured −3.5pt that way, though Word sets them where the page does. An empty table cell beside a label made the same label measure 3.5pt high in SubscriptionInvoice once the cell's paragraph was a hairline. PdfLines and its Line say a line stands where its first letter does; the code did not.

What changed

  • PdfLines: a space opens no line. A blank glyph on another line ends the line before it and starts nothing. Within a line it is read as before, its letters out of the key.

  • Baselines. word-windows and word-windows-lines are re-measured with it:

    Document Past 2pt p90
    SlateOrange 9 → 0 3.46 → 1.18pt
    VioletGrid 14 → 2 2.34 → 0.81pt
    OrangeOps 2 → 0 0.71 → 0.71pt

    SerifHeadline and SubscriptionInvoice move by hundredths. No other row changes. LibreOffice re-measures byte for byte: it writes no space for an empty paragraph.

  • CHANGELOG.md. A Tests entry.

Verification

  • New test, DocxFidelityGateTest.aLineStandsWhereItsFirstLetterDoesNotWhereASpaceBeforeItDoes. A PDFBox page draws a space, then "Label" 4pt lower beside it. The line keys "label", at the label's baseline and left edge. With the rule taken out, the test fails: the line takes the space's baseline.
  • No render code changes. The DOCX files and the editors' PDFs are the ones 2.5-dev makes; only the reading of them moved.
  • Full reactor gate: ./mvnw -B -ntp clean verify -pl :graph-compose-core,:graph-compose-render-pdf,:graph-compose-render-docx,:graph-compose-render-pptx,:graph-compose-templates,:graph-compose-testing,:graph-compose-qa,:graph-compose-coverage -am gives BUILD SUCCESS. qa runs 1814 tests.

Known limits

  • The Linux LibreOffice baseline is checked by this PR's CI run. It should re-measure unchanged, as Windows did.

Lane: test (qa fidelity gate).

@DemchaAV
DemchaAV merged commit 9d96c5c into 2.5-dev Oct 2, 2026
11 checks passed
@DemchaAV
DemchaAV deleted the test/docx-fidelity-first-letter branch October 2, 2026 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant