sw/qa/extras/layout/data/tox-update-wrong-pages.odt |binary sw/qa/extras/layout/layout.cxx | 22 ++++++++++++++++++++ 2 files changed, 22 insertions(+)
New commits: commit f4f57a2a8d17a588c1dd2443703845109fe1b879 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed May 17 12:52:14 2023 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed May 17 17:06:37 2023 +0200 tdf#155324 sw: add unit test Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151876 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 247738a9afeeb2f0644fa0307b7023fe115fae83) Change-Id: I0df173be99b8b9fa3920431a8386e14fd1d2260e diff --git a/sw/qa/extras/layout/data/tox-update-wrong-pages.odt b/sw/qa/extras/layout/data/tox-update-wrong-pages.odt new file mode 100644 index 000000000000..40ceb7ac4bd2 Binary files /dev/null and b/sw/qa/extras/layout/data/tox-update-wrong-pages.odt differ diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 9747090b6581..bf1675830d19 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -3617,6 +3617,28 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testBIRT) load(DATA_DIRECTORY, "birt_min.odt"); } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf155324) +{ + createDoc("tox-update-wrong-pages.odt"); + + lcl_dispatchCommand(mxComponent, ".uno:UpdateAllIndexes", {}); + + xmlDocPtr pXmlDoc = parseLayoutDump(); + + // the problem was that the first entry was on page 7, 2nd on page 9 etc. + assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt[1]/Text[1]", "Portion", "Foo"); + assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt[1]/Text[3]", "Portion", "5"); + assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt[2]/Text[1]", "Portion", "bar"); + assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt[2]/Text[3]", "Portion", "7"); + assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt[3]/Text[1]", "Portion", "Three"); + assertXPath(pXmlDoc, "/root/page[1]/body/section[2]/txt[3]/Text[3]", "Portion", "7"); + + // check first content page has the footnotes + assertXPath(pXmlDoc, "/root/page[5]/body/txt[1]/Text", "Portion", "Foo"); + assertXPath(pXmlDoc, "/root/page[4]/ftncont", 0); + assertXPath(pXmlDoc, "/root/page[5]/ftncont/ftn", 5); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */