tdf#99822 sw floattable: testcase for objects from different cells

Fails with commit 435f1aadf7dd8087a8997924bedfccff0f496ba2 (tdf#99822 sw
floattable: allow nomimal overlap of objects from different cells,
2023-10-27) reverted.

Change-Id: Ic90a2aa254a47804dc50eba8fc1daf0131e65a26
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159007
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
diff --git a/sw/qa/core/objectpositioning/data/floattable-overlap-cell.docx b/sw/qa/core/objectpositioning/data/floattable-overlap-cell.docx
new file mode 100644
index 0000000..50ec605
--- /dev/null
+++ b/sw/qa/core/objectpositioning/data/floattable-overlap-cell.docx
Binary files differ
diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx b/sw/qa/core/objectpositioning/objectpositioning.cxx
index 4e0db43..9fea642 100644
--- a/sw/qa/core/objectpositioning/objectpositioning.cxx
+++ b/sw/qa/core/objectpositioning/objectpositioning.cxx
@@ -371,6 +371,23 @@ CPPUNIT_TEST_FIXTURE(Test, testFloatingTableFollowWrongPage)
    const SwSortedObjs& rPage2Objs = *pPage2->GetSortedObjs();
    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage2Objs.size());
}

CPPUNIT_TEST_FIXTURE(Test, testFloatingTableOverlapCell)
{
    // Given a document with floating tables, overlapping, but anchored to different table cells:
    createSwDoc("floattable-overlap-cell.docx");

    // When laying out the document:
    // Without the accompanying fix in place, this resulted in a layout loop.
    calcLayout();

    // Then make sure the layout doesn't loop and results in a single page:
    SwDoc* pDoc = getSwDoc();
    SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
    auto pPage1 = pLayout->Lower()->DynCastPageFrame();
    CPPUNIT_ASSERT(pPage1);
    CPPUNIT_ASSERT(!pPage1->GetNext());
}
}

CPPUNIT_PLUGIN_IMPLEMENT();