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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 30 15:10:26 UTC 2020


 sw/qa/extras/uiwriter/data3/tdf134021.docx |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx        |   28 ++++++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

New commits:
commit 189086209113a20a36ad43d19e53af6678ff772c
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Jun 30 11:42:08 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jun 30 17:09:44 2020 +0200

    tdf#134021: sw: Add unittest
    
    Change-Id: I789adaf699a857e28416132d253c04128def5984
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97481
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data3/tdf134021.docx b/sw/qa/extras/uiwriter/data3/tdf134021.docx
new file mode 100644
index 000000000000..cda11fbdf3ef
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf134021.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 0f9f3255f990..43f181678833 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -462,6 +462,34 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf107975)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134021)
+{
+    load(DATA_DIRECTORY, "tdf134021.docx");
+
+    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(12, getPages());
+
+    dispatchCommand(mxComponent, ".uno:JumpToNextTable", {});
+
+    dispatchCommand(mxComponent, ".uno:DeleteTable", {});
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    // Without the fix in place, it would have crashed here
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(12, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf130746)
 {
     load(DATA_DIRECTORY, "tdf130746.odt");


More information about the Libreoffice-commits mailing list