sw/qa/extras/ooxmlexport/ooxmlexport9.cxx |   18 +++++++++++++++---
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx |   19 +++++++++++++++++--
 2 files changed, 32 insertions(+), 5 deletions(-)

New commits:
commit 13957c49b939d29c0005c578e6c5e8dd76bd5722
Author:     Miklos Vajna <[email protected]>
AuthorDate: Tue Mar 21 13:30:49 2023 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Fri Mar 24 07:04:34 2023 +0000

    sw floattable, CppunitTest_sw_ooxmlimport2: assert the layout in 
testTdf114217
    
    The point is that the table is multi-page, which is preserved. The
    detail that it's not in a fly is no longer true.
    
    (cherry picked from commit 28b16870553f436b8dd0f74894896136057402a3)
    
    Change-Id: I8fa61391eb26b434cd7e8b8adb5012c4909e5553
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149287
    Tested-by: Miklos Vajna <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 26ad31df3a78..1dfa519fd5fd 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -37,6 +37,10 @@
 #include <docsh.hxx>
 #include <rootfrm.hxx>
 #include <frame.hxx>
+#include <pagefrm.hxx>
+#include <cntfrm.hxx>
+#include <flyfrms.hxx>
+#include <tabfrm.hxx>
 
 class Test : public SwModelTestBase
 {
@@ -666,9 +670,20 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf121804)
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf114217)
 {
+    SwModelTestBase::FlySplitGuard aGuard;
+    // The floating table was not split between page 1 and page 2.
     createSwDoc("tdf114217.docx");
-    // This was 1, multi-page table was imported as a floating one.
-    CPPUNIT_ASSERT_EQUAL(0, getShapes());
+    SwDoc* pDoc = getSwDoc();
+    SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
+    auto pPage1 = dynamic_cast<SwPageFrame*>(pLayout->Lower());
+    CPPUNIT_ASSERT(pPage1);
+    const SwSortedObjs& rPage1Objs = *pPage1->GetSortedObjs();
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), rPage1Objs.size());
+    auto pPage1Fly = dynamic_cast<SwFlyAtContentFrame*>(rPage1Objs[0]);
+    CPPUNIT_ASSERT(pPage1Fly);
+    auto pTab1 = dynamic_cast<SwTabFrame*>(pPage1Fly->GetLower());
+    CPPUNIT_ASSERT(pTab1);
+    CPPUNIT_ASSERT(pTab1->HasFollow());
 }
 
 CPPUNIT_TEST_FIXTURE(Test, testTdf119200)
commit 692db60d346ea93270a066cba44bb8bb0ac8f7cb
Author:     Miklos Vajna <[email protected]>
AuthorDate: Tue Mar 21 09:20:14 2023 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Fri Mar 24 07:04:20 2023 +0000

    sw floattable, CppunitTest_sw_ooxmlexport9: assert can-split in 
testTdf109063
    
    It should not be a problem if the table is in a frame, what matters is
    that the frame is marked to split.
    
    (cherry picked from commit 3911b23c89da02eca92a0069bf1035155b7fddae)
    
    Change-Id: Ib289691dcdf78de494518a9afeac3ede9045ec1d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149286
    Tested-by: Miklos Vajna <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index f4e7d4581f49..b0b7d81a602a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -123,10 +123,22 @@ DECLARE_SW_ROUNDTRIP_TEST(testBadDocm, "bad.docm", 
nullptr, DocmTest)
     CPPUNIT_ASSERT_EQUAL(OUString("MS Word 2007 XML VBA"), 
pTextDoc->GetDocShell()->GetMedium()->GetFilter()->GetName());
 }
 
-DECLARE_OOXMLEXPORT_TEST(testTdf109063, "tdf109063.docx")
+CPPUNIT_TEST_FIXTURE(Test, testTdf109063)
 {
-    // This was 1, near-page-width table was imported as a TextFrame.
-    CPPUNIT_ASSERT_EQUAL(0, getShapes());
+    SwModelTestBase::FlySplitGuard aGuard;
+    auto verify = [this]() {
+        // A near-page-width table should be allowed to split:
+        uno::Reference<text::XTextFramesSupplier> xDocument(mxComponent, 
uno::UNO_QUERY);
+        uno::Reference<beans::XPropertySet> 
xFrame(xDocument->getTextFrames()->getByName("Frame1"),
+                                                   uno::UNO_QUERY);
+        bool bIsSplitAllowed{};
+        xFrame->getPropertyValue("IsSplitAllowed") >>= bIsSplitAllowed;
+        CPPUNIT_ASSERT(bIsSplitAllowed);
+    };
+    createSwDoc("tdf109063.docx");
+    verify();
+    reload(mpFilter, "tdf109063.docx");
+    verify();
 }
 
 CPPUNIT_TEST_FIXTURE(DocmTest, testTdf108269)

Reply via email to