sw/qa/extras/ooxmlexport/data/tdf32363.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 37 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+)
New commits: commit cd9da3e6d7b0537625eedd0aa740b4e66dd3551e Author: László Németh <[email protected]> AuthorDate: Thu Feb 19 00:54:39 2026 +0100 Commit: László Németh <[email protected]> CommitDate: Thu Feb 19 10:34:57 2026 +0100 tdf#32363 sw DOCX: add unit test/documentation for shortening headings Using Styles fields with custom character styles allows shortening the numbered headings in the header/footer, both in ODT and DOCX documents. See test document sw/qa/extras/ooxmlexport/data/tdf32363.docx for more information. Follow-up to commit da88bd54eba4bb3c5a588c211d0233a8eef77ffb "tdf#163894 sw DOCX: (p)refer char style-ref on the actual page", commit fce6492756e4657008ed1ce734a08929aa19c264 "tdf#163894 sw DOCX: add character styles to style-ref window", commit 955f0f9b5e7f1d4ba42eb314478cc6924b4b63a7 "tdf#163894 sw DOCX: fix style-ref with character style", commit d4fdafa103bfea94a279d7069ddc50ba92f67d01 "tdf#160402 writerfilter,sw: STYLEREF field can refer to character style" and commit 32c588dd1164aa2fc4c8120ddb74bd510cc082f9 "tdf#86790: Add support for a word-style styleref". Change-Id: Ib1908fa392ff838f60c0a2330e2443b558bf48fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199672 Reviewed-by: László Németh <[email protected]> Tested-by: Jenkins diff --git a/sw/qa/extras/ooxmlexport/data/tdf32363.docx b/sw/qa/extras/ooxmlexport/data/tdf32363.docx new file mode 100644 index 000000000000..a97e04f454d8 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf32363.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 12a3930ef9c2..36d7d3a1209f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -852,6 +852,43 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf163894_hidden) "expand", u"modicum"); } +CPPUNIT_TEST_FIXTURE(Test, testTdf32363) +{ + createSwDoc("tdf32363.docx"); + save(TestFilter::DOCX); + + xmlDocUniquePtr pLayout = parseLayoutDump(); + assertXPath(pLayout, "/root/page[3]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", + "expand", u"1 "); + assertXPath(pLayout, "/root/page[3]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]", + "expand", u"Do not shorten this short heading"); + + assertXPath(pLayout, "/root/page[4]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", + "expand", u"2 "); + assertXPath(pLayout, "/root/page[4]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]", + "expand", u"Beginning of the paragraph"); + + assertXPath(pLayout, "/root/page[5]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", + "expand", u"3 "); + assertXPath(pLayout, "/root/page[5]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]", + "expand", u"Beginning of the paragraph + ellipsis…"); + + assertXPath(pLayout, "/root/page[6]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", + "expand", u"3 "); + assertXPath(pLayout, "/root/page[6]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]", + "expand", u"Beginning of the paragraph + ellipsis…"); + + assertXPath(pLayout, "/root/page[7]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", + "expand", u"4 "); + assertXPath(pLayout, "/root/page[7]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]", + "expand", u"Hidden text with the referred character style"); + + assertXPath(pLayout, "/root/page[8]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[1]", + "expand", u"4 "); + assertXPath(pLayout, "/root/page[8]/header/txt[1]/SwParaPortion/SwLineLayout/SwFieldPortion[2]", + "expand", u"Hidden text with the referred character style"); +} + CPPUNIT_TEST_FIXTURE(Test, testTdf161643) { createSwDoc("fdo76163.docx");
