test(odt): stronger validation assertions, coverage for validator/styles/package, LibreOffice-authored fixtures - #230
Merged
Merged
Conversation
…les/package, LibreOffice-authored fixtures Exact error types, counts and messages in OdtValidationTests; ODT/Word validation parity tests; scope tests for loops in tables, lists, sections, text boxes, notes, indexes and headers; OdtTextStyles, OdtPackage and engine branch tests; four LibreOffice-written fixtures (Odt/Fixtures) processed without LibreOffice, plus local LibreOffice round trips (#138).
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Test-quality items from the OpenDocument review (#138). These tests found four library bugs. Each was fixed in its own PR, already merged: #226, #227, #228, #229.
Changes
Stronger validation assertions (
OdtValidationTests)Assert.Single/Assert.Equalon error types, counts, exact messages and locations, and onAllPlaceholders/MissingVariables/ warnings, instead of mostlyContains.{{#elseif}}after{{#else}}, theReservedWordAsVariablewarning (text and location),WarnOnEmptyLoopCollections = false, and single reports for unmatched list-item/row markers.Validator coverage
OdtValidationParityTests: 21 paragraph templates validated as.docxand.odt, without and with data. They must give identical errors (type and message), warnings,AllPlaceholders,MissingVariablesandIsValid. The cases cover placeholders, syntax errors, orphan end markers, invalid and nested invalid iteration variables, reserved words, condition variables, named and implicit nested loops, empty, missing, null and scalar collections, JSON data, POCO items with nulls, conditionals in loops, inline conditionals and unmatched loops with bodies.OdtValidationScopeTests(18 tests) cover the scope walker:IOExceptionwhile reading (InvalidDocument)Styles, package, engine
OdtTextStylesTests: no formatting, part without root, reuse of a LibreOffice-written style, seven styles that must not be reused (parent, extra property, partial bold, extra child, nested child, other family, empty name), names blocked by any style name of the part and by reserved names, combined formatting, per-part cache, and creation ofoffice:automatic-stylesin schema order.OdtPackageBranchTests:.ottwithout a manifest (and with a thumbnail)GetXmlof a non-XML entryOdtEngineBranchTests: index bodies (the source is untouched), shapes with paragraphs in the body, row groups emptied by conditionals, tables whose rows are all in groups, list items emptied by in-item conditionals, leftover markers (compared with the Word output), and lists in annotations inside loops.LibreOffice-authored fixtures (
TriasDev.Templify.Tests/Odt/Fixtures/*.odt, copied to the output)lo-invoice.odt: header and footer (split placeholder in the header with LibreOffice'sMT1style, page-number field), rsid spans (officeooo:rsid),text:sruns, a header-rows table with a named row loop,@number, a covered cell, if/elseif/else, markdown.lo-containers.odt: bullet list-item loop with an inline conditional, numbered list with a list-item conditional, text box (frame) with a loop, footnote, protected section with a conditional.lo-long-document.odt: several pages. LibreOffice wrotetext:soft-page-breakelements inside paragraphs, including one inside the loop body, and there is a long table with a row loop.lo-from-word.odt: a.docxwith rsid-split runs converted by LibreOffice (bold style without complex-script weight).Odt/Fixtures/Sources(.fodtfiles and the.docx). The fixtures were saved by LibreOffice 26.8 with a layout pass, a Basic macro that callsjumpToLastPageand thenstoreToURL. A plain--convert-to odtwrites no soft page breaks.OdtLibreOfficeFixtureTests(12 tests) processes and validates them without LibreOffice, so they run in CI.OdtLibreOfficeRoundTripTests.LibreOfficeFixtures_ProcessedOutput_IsReadBackUnchanged(LibreOffice trait, local) resaves each processed fixture in LibreOffice and compares all paragraph, header and footer texts.OdtDocumentVerifier.ToBytes().Tests
Coverage of
TriasDev.Templify.Testson net10.0 (coverlet, lines of each file):Still uncovered:
Local runs: Release CI build (
-p:ContinuousIntegrationBuild=true, 0 warnings);TriasDev.Templify.Testsnet10/9/8 (2,230 each, LibreOffice round trips included); Tools.Tests 63; Converter.Tests 95;dotnet format --verify-no-changes;dotnet pack.Public API impact
None. Only test code, test helpers and test fixtures change. The csproj copies
Odt/Fixtures/*.odtto the test output.