sw/qa/core/text/data/floattable-anchor-left-margin.docx |binary
 sw/qa/core/text/itrform2.cxx                            |   23 ++++++++++++++++
 2 files changed, 23 insertions(+)

New commits:
commit 9343816d83a6640dc14718e805aa0bd1747e3a92
Author:     Miklos Vajna <[email protected]>
AuthorDate: Thu Oct 19 13:44:24 2023 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri Oct 20 09:44:35 2023 +0200

    tdf#157573 sw floattable: add missing testcase
    
    Fails with commit 626fe9ab5ebebc4ef36e35f4aa597c03a3564d22 (tdf#157573
    sw floattable: fix incorrect lack of left margin after table,
    2023-10-18) reverted.
    
    Change-Id: I6a3bd69dc109e6df195d00c33118218eeaa00ce5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158179
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>
    (cherry picked from commit 65f508b44ecbc20c8bd5172d1656639f686730ff)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158159
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sw/qa/core/text/data/floattable-anchor-left-margin.docx 
b/sw/qa/core/text/data/floattable-anchor-left-margin.docx
new file mode 100644
index 000000000000..aa55a0ce3001
Binary files /dev/null and 
b/sw/qa/core/text/data/floattable-anchor-left-margin.docx differ
diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx
index 187eb9ab678e..2d9166b12390 100644
--- a/sw/qa/core/text/itrform2.cxx
+++ b/sw/qa/core/text/itrform2.cxx
@@ -15,6 +15,7 @@
 #include <rootfrm.hxx>
 #include <sortedobjs.hxx>
 #include <pagefrm.hxx>
+#include <cntfrm.hxx>
 
 namespace
 {
@@ -139,6 +140,28 @@ CPPUNIT_TEST_FIXTURE(Test, 
testContentControlHeaderPDFExport)
     // i.e. not all of header, heading and body text was there on page 2, 
content was lost.
     CPPUNIT_ASSERT_EQUAL(3, nTextCount);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testSplitFlyAnchorLeftMargin)
+{
+    // Given a document with a floating table, anchor para is followed by an 
other para with a left
+    // margin:
+    createSwDoc("floattable-anchor-left-margin.docx");
+
+    // When laying out that document:
+    calcLayout();
+
+    // Then make sure that the left margin of this last paragraph is not lost:
+    SwDoc* pDoc = getSwDoc();
+    SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+    auto pPage = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+    CPPUNIT_ASSERT(pPage);
+    SwContentFrame* pLastPara = pPage->FindLastBodyContent();
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 6480
+    // - Actual  : 0
+    // i.e. the left margin was lost.
+    CPPUNIT_ASSERT_EQUAL(static_cast<SwTwips>(6480), 
pLastPara->getFramePrintArea().Left());
+}
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to