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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 29 16:24:58 UTC 2021


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

New commits:
commit ad146b4e73c0f661ea05d69fcb9a6af1b85a5fda
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Mar 29 15:54:31 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Mon Mar 29 18:24:17 2021 +0200

    tdf#136778: sw_uiwriter3: Add unittest
    
    Change-Id: I94361102f14b8b40c02419776ae480a917c5d013
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113318
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data3/tdf136778.docx b/sw/qa/extras/uiwriter/data3/tdf136778.docx
new file mode 100644
index 000000000000..d1b6c877c4ed
Binary files /dev/null and b/sw/qa/extras/uiwriter/data3/tdf136778.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx b/sw/qa/extras/uiwriter/uiwriter3.cxx
index cf14ac853264..7a62505b61c0 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -1361,6 +1361,34 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134021)
     CPPUNIT_ASSERT_EQUAL(12, getPages());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf136778)
+{
+    load(DATA_DIRECTORY, "tdf136778.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(1, 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(1, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf123285)
 {
     load(DATA_DIRECTORY, "tdf123285.odt");


More information about the Libreoffice-commits mailing list