Skip to content

test(docx): hold a body card whose text fills it to grow with that text - #972

Merged
DemchaAV merged 2 commits into
2.5-devfrom
test/docx-body-panel-grows-with-its-text
Oct 27, 2026
Merged

DemchaAV merged 2 commits into
2.5-devfrom
test/docx-body-panel-grows-with-its-text

Conversation

@DemchaAV

@DemchaAV DemchaAV commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Why

A painted box holding text in the body is written as a panel (#971): a table of one cell whose row is held at least its outline's height, so the box grows when text is added to it in an editor. With the editing protocol's sentence added, the fidelity corpus's rounded_card grows 35.4pt taller in Word 16 and 36.0pt in LibreOffice 24.2, and the paragraph under it moves down as far.

DocxBodyShapePanelTest holds that rule on a card under its default clip only where the card's text leaves room to spare inside it. Nothing holds it for a card whose text and padding fill its outline, as the corpus card's do: its section ends 1.6pt above the outline's foot. A change that writes only such a box's row exact, at the height a clip that cuts is written at, is seen by no test, nor by either fidelity gate measured under it:

  • every other test of render-docx (2310) and of qa (1846) passes;
  • in Word, every line of rounded_card stands where it stood, to 0.00pt;
  • in LibreOffice 24.2, the paragraph under the card moves 0.6pt nearer the page, which a gate holding lines no further from the page than their baseline lets through;
  • with text added, the card keeps its height in Word and hides that text.

The Windows LibreOffice baseline was not measured under it.

That 0.6pt is the one difference #971 left in LibreOffice 24.2, which counts a cell's borders inside a least row height. A change that closed it by writing the card's row exact would land here, and the Linux gate would reward it. Word's editing protocol, run by hand, is the only check that would fail it, on the exact row.

What changed

  • DocxBodyShapePanelTest.aCardItsTextFillsGrowsWithItsTextAsOneWithRoomToSpare (new): a card as wide as the page between its margins, under its default clip, holding a heading and a paragraph in a padded section. The card is a quarter of a point taller than that section as the page lays it out; the height is read from a first layout, so the case does not hang on a face's metrics. The test asserts its premise (the section laid out at its own height, and less than half a point under it), then that the card's row is held at least its outline's height less its two borders, and that the report names neither a clip nor a layer past the outline.
  • CHANGELOG: a Tests entry.

No production code changes.

Tests

  • DocxBodyShapePanelTest: 18 (17 + 1), passing.
  • Sabotages. Each rule is broken alone, then DocxBodyShapePanelTest is run. Every one is caught, and the source is byte-identical afterwards:
    • the body panel's row written exact;
    • a default clip treated as one that cuts;
    • a box holding text in the body no longer written as a panel;
    • a box whose first layer ends less than 2pt above its outline's foot written exact at the clip's height: caught by the new test alone;
    • the same at half a point: caught by the new test alone.
  • The fourth sabotage, across the suites. Installed, it fails the new test and no other of render-docx's 2311, and none of qa's 1846. Exported over the corpus, it changes rounded_card alone, its row exact; the Word and LibreOffice 24.2 measurements above are of that export.
  • clean verify of the reactor as CI runs it → BUILD SUCCESS (core 823, render-pdf 339, render-docx 2311, testing 5, render-pptx 142, templates 127, qa 1846); the four knowledge checks and core javadoc (0 warnings) pass; examples 93.

Lane: tests (render-docx). No public API change.

A painted box holding text in the body is written as a panel whose row
is held at least its outline's height, so it grows when text is added
to it in an editor. DocxBodyShapePanelTest held that rule only on boxes
whose text leaves room to spare. A change writing exact only the row of
a box its text fills, at the height a clip that cuts is written at, was
seen by no test: in Word every line of the corpus card stood where it
stood, in LibreOffice 24.2 the paragraph under it moved nearer the
page, and the card no longer grew.

The new case holds a card a quarter of a point taller than its text, as
the page lays it out, to an at-least row.
The case asserts that the first layout sets the card's text at its own
height, not the taller card's: otherwise the card would be no fuller
than its text leaves it. Its comment and the CHANGELOG entry say the
card's text and padding fill it, and leave out a prediction of what
LibreOffice would do.
@DemchaAV
DemchaAV marked this pull request as ready for review October 27, 2026 00:01
@DemchaAV
DemchaAV merged commit 6ad067d into 2.5-dev Oct 27, 2026
13 checks passed
@DemchaAV
DemchaAV deleted the test/docx-body-panel-grows-with-its-text branch October 27, 2026 07:03
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