diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2022-02-25 13:43:56 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-03-09 09:17:15 +0100 |
commit | 26bf453f1c36c84135dff5b2ee5f84cf2764b4f9 (patch) | |
tree | 64a33ba9cd1415c7176c0d4c9a68ed7db9505c6e /sw/qa | |
parent | 893395df34b47a3061017d78c7f36272d3fed716 (diff) |
tdf#143239 sw: layout: invalidate fly position when moving off page
It's possible that flags on the fly are all valid when it is moved off page
when SwLayAction::FormatContent() returns and then it may not be positioned
again, keeping its (wrong) position on the old page and will appear to be
invisible unless you click on it.
(regression from commits c799de145f7e289f31e3669646e5bd12814e6c5e
and eb85de8e6b61fb3fcb6c03ae0145f7fe5478bccf)
Change-Id: If07d5af7b47eb288bef71d1b9e3459197b50fdc9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130535
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit b14bb255199e7d6db6ec9155b5d9237cb35fdba7)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130548
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/extras/layout/data/tdf143239-1-min.odt | bin | 0 -> 20308 bytes | |||
-rw-r--r-- | sw/qa/extras/layout/layout.cxx | 66 |
2 files changed, 66 insertions, 0 deletions
diff --git a/sw/qa/extras/layout/data/tdf143239-1-min.odt b/sw/qa/extras/layout/data/tdf143239-1-min.odt Binary files differnew file mode 100644 index 000000000000..4271bfba775b --- /dev/null +++ b/sw/qa/extras/layout/data/tdf143239-1-min.odt diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index 74b0d1e1aad3..79e06e3e3c17 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -1273,6 +1273,72 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInFootnote) } } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf143239) +{ + SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf143239-1-min.odt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "top", + "18540"); +#ifndef MACOSX + assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "left", + "3559"); +#endif + assertXPath(pXmlDoc, "/root/page[2]/body/txt[2]/anchored/fly", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "top", + "23894"); +#ifndef MACOSX + assertXPath(pXmlDoc, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "left", + "1964"); +#endif + assertXPath(pXmlDoc, "/root/page[3]/body/txt[1]/anchored/fly", 1); + assertXPath(pXmlDoc, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "top", + "35662"); +#ifndef MACOSX + assertXPath(pXmlDoc, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "left", + "3129"); +#endif + assertXPath(pXmlDoc, "/root/page", 3); + discardDumpedLayout(); + } + + pWrtShell->SelAll(); + pWrtShell->Delete(); + pWrtShell->Undo(); + Scheduler::ProcessEventsToIdle(); + + { + xmlDocUniquePtr pXmlDoc = parseLayoutDump(); + // now the 1st fly was on page 1, and the fly on page 2 was the 2nd one + assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "top", + "18540"); +#ifndef MACOSX + assertXPath(pXmlDoc, "/root/page[2]/body/txt[1]/anchored/fly[1]/infos/bounds", "left", + "3559"); +#endif + assertXPath(pXmlDoc, "/root/page[2]/body/txt[2]/anchored/fly", 1); + assertXPath(pXmlDoc, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "top", + "23894"); +#ifndef MACOSX + assertXPath(pXmlDoc, "/root/page[2]/body/txt[2]/anchored/fly[1]/infos/bounds", "left", + "1964"); +#endif + assertXPath(pXmlDoc, "/root/page[3]/body/txt[1]/anchored/fly", 1); + assertXPath(pXmlDoc, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "top", + "35662"); +#ifndef MACOSX + assertXPath(pXmlDoc, "/root/page[3]/body/txt[1]/anchored/fly[1]/infos/bounds", "left", + "3129"); +#endif + assertXPath(pXmlDoc, "/root/page", 3); + discardDumpedLayout(); + } +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableOverlapFooterFly) { // Load a document that has a fly anchored in the footer. |