sw/qa/core/objectpositioning/data/floattable-overlap-cell.docx |binary
 sw/qa/core/objectpositioning/objectpositioning.cxx             |   17 
++++++++++
 2 files changed, 17 insertions(+)

New commits:
commit 25ab552b6daf2f663b20520839bce08deb1b5c9e
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Nov 6 18:38:33 2023 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Tue Nov 7 13:37:46 2023 +0100

    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.
    
    (cherry picked from commit 0bf60e32c0ac2bf79fad6c29c39c6f6a3f9ce8e8)
    
    Change-Id: Ic90a2aa254a47804dc50eba8fc1daf0131e65a26
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159054
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

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 000000000000..50ec605ed7b7
Binary files /dev/null and 
b/sw/qa/core/objectpositioning/data/floattable-overlap-cell.docx differ
diff --git a/sw/qa/core/objectpositioning/objectpositioning.cxx 
b/sw/qa/core/objectpositioning/objectpositioning.cxx
index 4e0db43c475f..9fea64267a15 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();

Reply via email to