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 <vmiklos@collabora.com>
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 0000000..aa55a0c
--- /dev/null
+++ b/sw/qa/core/text/data/floattable-anchor-left-margin.docx
Binary files differ
diff --git a/sw/qa/core/text/itrform2.cxx b/sw/qa/core/text/itrform2.cxx
index 0705069..02cd813 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
{
@@ -143,6 +144,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: */