[Libreoffice-commits] core.git: sw/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 31 21:09:38 UTC 2020


 sw/qa/extras/uiwriter/data3/tdf134931.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx       |   35 ++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

New commits:
commit 99284a22f3cda8518cd2207128928c2e455c89ee
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Jul 31 16:47:56 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Jul 31 23:08:54 2020 +0200

    tdf#134931: sw_uiwriter: Add unittest
    
    Change-Id: I737296f1a0646065288be2cb0be3ef7f939fb536
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99878
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data3/tdf134931.odt b/sw/qa/extras/uiwriter/data3/tdf134931.odt
new file mode 100644
index 000000000000..bfd1ccf2e561
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf134931.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index df2567abe7dd..8336544274b4 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -802,6 +802,41 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf132944)
     CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134931)
+{
+    load(DATA_DIRECTORY, "tdf134931.odt");
+
+    SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get());
+    CPPUNIT_ASSERT(pTextDoc);
+
+    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(),
+                                                         uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    dispatchCommand(mxComponent, ".uno:Copy", {});
+    Scheduler::ProcessEventsToIdle();
+
+    dispatchCommand(mxComponent, ".uno:GoDown", {});
+
+    for (sal_Int32 i = 0; i < 10; ++i)
+    {
+        dispatchCommand(mxComponent, ".uno:Paste", {});
+        Scheduler::ProcessEventsToIdle();
+    }
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(11), xIndexAccess->getCount());
+
+    // Without the fix in place, this test would have failed with:
+    // - Expected: 4
+    // - Actual  : 1
+    // Because the tables are pasted but not displayed
+
+    CPPUNIT_ASSERT_EQUAL(4, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130680)
 {
     load(DATA_DIRECTORY, "tdf130680.odt");


More information about the Libreoffice-commits mailing list