Skip to content

test(diff): compare a Word-authored clause control edited in place (#1143) - #1159

Merged
JSv4 merged 1 commit into
mainfrom
test/1143-real-clause-control
Oct 16, 2026
Merged

JSv4 merged 1 commit into
mainfrom
test/1143-real-clause-control

Conversation

@JSv4

@JSv4 JSv4 commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Follow-up to #1148 for #1143.

Why

#1148 made a comparison diff the blocks inside an unchanged content control instead of replacing the whole control. Every test of that behaviour used hand-built XML. The one real Word document in the test file (HC022-Table-Of-Contents.docx) exercises the opposite rule, the whole replacement a table of contents still gets, and none of the 92 pairs in the frozen comparison corpus under TestFiles/WC contains a block content control. So no Word-authored document ever went through the new path in the suite.

What this adds

A comparison pair under TestFiles/Issue1143, with a README describing the derivation:

  • Both files come from TestFiles/DB006-Source1.docx, a Word-authored article already in the repository, by one edit to word/document.xml; the other 16 parts are byte-identical to the source and the entry order is unchanged.
  • The original wraps a heading, a prose paragraph, the seven-row table and a prose paragraph (one that carries a w:proofErr pair and a w:lastRenderedPageBreak) in one rich-text block control.
  • The revised copy changes "There are only three block-level content container elements" to "There are just three" inside the control.

One test in BlockWrapperNestedDiffTests compares the pair through the DocxCompare front door and checks that the control is kept once with no range markers, that the deleted and inserted text are exactly those two words, that GetRevisions reports only them, that accept and reject reproduce the revised and original documents block for block (properties, text and run formatting), and that the redline adds no Office 2019 validation error. The source document and both fixtures validate with zero errors.

Validation

  • With IrSdtBlock.CanDiffInPlace forced to false, the test fails on two copies of the control; with the shipped code it passes.
  • Full .NET suite passes locally, including the corpus-wide IR tests that pick up every .docx under TestFiles.
  • Test-project warning count unchanged at 437.

Adversarial review

One round on the diff. It checked that the fixture is a genuine Word package rather than a rebuilt one (only word/document.xml differs from the source, and the control sits at body level between untouched paragraphs), that the pair is schema-valid before the comparison so the no-new-errors check is not masking anything, and that the test fails without the feature. No findings needed a change.

…1143)

The in-place diff inside an unchanged block content control was covered by
hand-built XML only; the one real fixture in the file (HC022) exercises the
whole-replacement rule for a table of contents, and no pair in the frozen
comparison corpus carries a block control.

Adds TestFiles/Issue1143: a pair derived from the Word-authored
DB006-Source1.docx by wrapping a heading, a prose paragraph, the seven-row
table and a prose paragraph in one rich-text control, with one word changed
inside the control in the revised copy (README has the derivation). The test
goes through the DocxCompare front door and checks that the control is kept
once, that the redline marks exactly that word, that GetRevisions reports
only it, that accept and reject reproduce the inputs block for block, and
that the redline adds no Office 2019 validation error. With CanDiffInPlace
forced to false the test fails on two copies of the control.
@JSv4
JSv4 merged commit 7c46df3 into main Oct 16, 2026
16 checks passed
@JSv4
JSv4 deleted the test/1143-real-clause-control branch October 16, 2026 12:39
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