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

New commits:
commit f359a10b2eff013cc0c7dc25e9ce12b94bd6be43
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Jun 30 11:42:08 2020 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Tue Oct 27 09:52:45 2020 +0100

    tdf#134021: sw: Add unittest
    
    Change-Id: I789adaf699a857e28416132d253c04128def5984
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97481
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>
    (cherry picked from commit 189086209113a20a36ad43d19e53af6678ff772c)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104822
    Tested-by: Michael Stahl <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/sw/qa/extras/uiwriter/data/tdf134021.docx 
b/sw/qa/extras/uiwriter/data/tdf134021.docx
new file mode 100644
index 000000000000..cda11fbdf3ef
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf134021.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 6bdd32559330..623f7bec96eb 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -7428,6 +7428,34 @@ void SwUiWriterTest::testTdf38394()
     CPPUNIT_ASSERT_EQUAL(sReplaced, 
static_cast<SwTextNode*>(pDoc->GetNodes()[nIndex])->GetText());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, 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());
+
+    lcl_dispatchCommand(mxComponent, ".uno:JumpToNextTable", {});
+
+    lcl_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
+    lcl_dispatchCommand(mxComponent, ".uno:Undo", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(12, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf133982)
 {
     load(DATA_DIRECTORY, "tdf133982.docx");
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to