Skip to content

test(qa): hold three body shape containers in the DOCX fidelity corpus - #970

Merged
DemchaAV merged 3 commits into
2.5-devfrom
test/docx-shape-container-fidelity
Oct 26, 2026
Merged

DemchaAV merged 3 commits into
2.5-devfrom
test/docx-shape-container-fidelity

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Why

In the body, the DOCX export draws a shape container's outline as a shape of its size, where the page draws it, and writes its layers in the flow (each such container carries the report note "its layers are written inline"). The layers are held in by as far as their box stands in from the container's own edges, but from the edges of the block the container stands in, so in a container narrower than that block the right edge of their room runs that much further right, past the outline: text that wraps runs past it, and centred or right-aligned text stands right of where the page sets it. Measured in Word 16 and LibreOffice 24.2, that puts text past the outline and the block under the container over it.

The changes that write a container's text inside its outline need documents built to show it, held by the fidelity gate in both editors: each such change then moves them nearer the page, and no change can move them further unnoticed. No document of the corpus was built for it.

What changed

  • SyntheticDocxCorpus takes three documents, each a rounded shape container holding text in the body, with a paragraph above and under it; text in Lato, which the export embeds:
    • narrow_container: a note set left in a block centred in a box 220pt wide, not clipped, which the page wraps over three lines inside it;
    • clipped_container: a box 200 × 60pt clipped to its outline, holding 84pt of text, which the page sets from the box's top and cuts at its foot;
    • rounded_card: a card 328 × 80pt, as wide as the page between its margins, its heading and three lines of text filling it, under the container's default clip. The export sets it where the page does today, so it holds a change that writes containers another way to keep it there; it is also the card whose growth an edit needs.
  • Baselines. word-windows and libreoffice-windows take the three documents' rows alone, from the runs below; the other rows stay as recorded. libreoffice-linux takes them from this PR's first CI run (artifact docx-fidelity-40373769086), where the DOCX Fidelity job failed on these three alone, each not yet in the baseline. A comment under each file's header says where the rows were measured.
    • The rows record the export as it stands. Of the narrow box and the clipped box, the gate holds the lines the editors set at the page's words — the paragraph above the box, at the page, and the paragraph under it, 12 and 20pt high — and none of the text inside the box, which both editors set at other words. A change that writes the text inside the outline finds those lines, moves the paragraph under each box nearer the page, and rewrites the rows with -Dgraphcompose.docxFidelity.update=true.
  • Docs:
    • the DOCX recipe: "Each layer, here and in a shape container, is held in across to its box in the stack" did not hold for a shape container narrower than the block it stands in; it now says how its layers are held in, the passage on a paragraph's sides under a layer names the exception, and the shape-container entry gives the measurements below;
    • CONTRIBUTING.md: a shape container holding text joins the examples of a shape SyntheticDocxCorpus holds, and a synthetic document's baseline holds it as the editors set it, a defect of the export included;
    • the CHANGELOG's Tests entry.

Measured

Lines found of the page's, then the drift of the found lines (pt; negative is high):

Document Word 16 (16.0.20527) LibreOffice 24.2 (Linux, CI) LibreOffice 26.8 (Windows)
synthetic-narrow_container 3/6; −12.02 3/6; −12.02 3/6; −12.02
synthetic-clipped_container 3/10; −19.97 3/10; −20.02 3/10; −20.02
synthetic-rounded_card 7/7; within 0.1 7/7; within 0.1 7/7; within 0.1

Against the outline, read off the editors' PDFs (the box filled with the surface colour, and each line's extent), Word and LibreOffice 24.2 alike:

  • Narrow box. The note runs over two lines instead of three, at the page's width: its first line ends 95pt past the box's right edge. The paragraph under the box stands 12pt high, its first line reaching 4pt into the box. The note is written with a left indent of 3.7pt and none on the right: the export holds a layer in by its box's distance from the container's own edges, and adds it to the block's edges, which for a container 108pt narrower than its block leaves the right side at the block's.
  • Clipped box. The clip is not written (the report names it): the text is written whole, at the page's width, up to 124pt past the box, and all of it shows, where the page shows five of its seven lines and cuts the rest at the outline. The paragraph under the box stands 20pt high, inside the box.
  • Card. It stands where the page sets it. With the editing protocol's sentence added to the card's text in Word, the outline keeps its 80pt, the text runs over seven lines to 22pt below the card's foot, and the paragraph under the card moves down 36pt.
  • Word's editing protocol (edit-protocol-corpus.ps1, lengthen-a-paragraph and drawings-follow-text) passes all three: the paragraph it lengthens grows and still ends above the paragraph under it, though past the outline: neither scenario reads the outline's extent against the text.

Tests

  • Word: scripts/docx-visual/word-fidelity.ps1 (Word 16.0.20527) → the corpus test in word mode passes on all 70 documents against the extended word-windows. Before the rows were added, it failed on the three new documents alone, as not in the baseline.
  • LibreOffice, Windows: -Dgraphcompose.docxFidelity=libreoffice → the three new documents pass against the extended libreoffice-windows. invoice-obsidian and proposal-indigo fail as they do on 2.5-dev (named in test(qa): hold the ways a page breaks inside a panel in the DOCX fidelity corpus #965): LibreOffice 26.8 sets each on two pages against the page's one, and this change exports both byte for byte as 2.5-dev does.
  • CI, LibreOffice 24.2 (Linux): the first run failed on the three new documents alone, as not in the baseline, measuring them as LibreOffice 24.2 did locally (docker); the third commit takes those rows.
  • The gate holds the rows (sabotages). Each sabotage alone, then the gate it should fail, every one caught, the files byte-identical afterwards:
    • the Word baseline without narrow_container's rows, or without clipped_container's: the Word gate fails each as not in the baseline;
    • the Word baseline holding the paragraph under the narrow box at −11.00pt: the Word gate fails it, the line 1.02pt further from the page than its row;
    • the Windows LibreOffice baseline without rounded_card's rows: the LibreOffice gate fails it;
    • the export writing a shape container's layers 2pt lower: the Word gate fails rounded_card — the card's four lines and the two of the paragraph under it about 2pt further from the page, with seven presets that hold a shape container's text in the flow (cv-midnight_navy, cv-navy_sidebar, cv-serif_headline, invoice-consulting, invoice-consulting_long, proposal-editorial, proposal-northline); the narrow and the clipped box's paragraphs move nearer the page with it, which the gate lets through, as it should.
  • Corpus: 70 documents exported; the 67 already in the corpus byte-identical to 2.5-dev; the report's notes 1491 → 1499, the eight added all on the three new documents.
  • clean verify of the reactor as CI runs it → BUILD SUCCESS (core 823, render-pdf 339, render-docx 2293, testing 5, render-pptx 142, templates 127, qa 1846); the four knowledge checks and core javadoc (0 warnings) pass; examples 93.

Named, not fixed

  • The gate measures lines of text, not outlines: whether the text stays inside its outline, and whether the card grows when text is added to it, it does not see, and neither does Word's editing protocol. These three documents hold where the lines stand; the outline is measured above by hand.
  • The card uses the container's default clip (CLIP_PATH) with nothing to cut. A clip written as an exact height would hold the clipped box's text inside its outline and keep the card from growing when it is edited: the two need telling apart where the clip is written.
  • None of the three is an ellipse, a polygon or a star with a one-line caption, and none holds centred or right-aligned text in a narrow container.
  • The report says the paragraph under the clipped box "stands 16pt lower than the page sets it", the space above it not holding the line hanging below the box. Word and LibreOffice set it 20pt higher: the note counts the lines as the page sets them, inside the box, and the export writes the text wider than that.

Lane: tests (qa) and documentation. No public API change, and no change to the export.

In the body, the DOCX export draws a shape container's outline as a shape of
its size and writes its layers in the flow, held in from the edges of the
block the container stands in. Three documents built for that join the
synthetic family of the fidelity corpus: a note the page wraps inside a box
220pt wide, a clipped box holding more text than it has room for, and a card
its text fills.

Their baseline rows record the export as Word 16 and LibreOffice set it
today: the note and the clipped text at other words than the page's, past
the outline, and the paragraph under each box 12 and 20pt high; the card in
place. A change that writes the text inside the outline finds it, moves the
paragraph under each box nearer the page and rewrites the rows; the card
holds such a change to keep it where it stands. The gate reads lines of
text, so it does not see whether the text stays inside the outline, or
whether the card grows when text is added to it; the corpus class and the
CHANGELOG say so.
…line

A shape container's layers are held in from the edges of the block it
stands in, so in a container narrower than that block the right edge of
their room runs past the outline: wrapped text runs past it, and centred or
right-aligned text stands right of where the page sets it. The recipe and
the CHANGELOG now say so, the passage on a paragraph's sides under a layer
names the exception, and the fixtures' Javadoc names the paragraph above
each box and the note's alignment as they are.
…from CI

The three documents' rows, as LibreOffice 24.2 on CI's Linux image measured
them in this branch's first run (artifact docx-fidelity-40373769086), where
the DOCX Fidelity job failed on these three alone, each not yet in the
baseline. The other rows stay as recorded.
@DemchaAV
DemchaAV marked this pull request as ready for review October 26, 2026 18:14
@DemchaAV
DemchaAV merged commit e3be529 into 2.5-dev Oct 26, 2026
11 checks passed
@DemchaAV
DemchaAV deleted the test/docx-shape-container-fidelity branch October 26, 2026 18:37
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