sw/qa/extras/uiwriter/data/tdf134965.odt |binary
 sw/qa/extras/uiwriter/uiwriter3.cxx      |   27 +++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

New commits:
commit d5f015185240a7bddfed7ddf10d6b5426e35fb72
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Feb 3 11:58:44 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Feb 3 18:43:21 2022 +0100

    tdf#134965: sw_uiwriter3: Add unittest
    
    Change-Id: I985b26f4340f17b060c6ef18dfa70c327585e4f6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129409
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data/tdf134965.odt 
b/sw/qa/extras/uiwriter/data/tdf134965.odt
new file mode 100644
index 000000000000..a51898df9bf5
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf134965.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 18abb76f1e43..068233091566 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -267,6 +267,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf138482)
     CPPUNIT_ASSERT_EQUAL(2, getShapes());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf134965)
+{
+    createSwDoc(DATA_DIRECTORY, "tdf134965.odt");
+
+    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> 
xIndexAccess(xTextTablesSupplier->getTextTables(),
+                                                         uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+
+    for (sal_Int32 i = 0; i < 10; ++i)
+    {
+        dispatchCommand(mxComponent, ".uno:SelectAll", {});
+        Scheduler::ProcessEventsToIdle();
+
+        dispatchCommand(mxComponent, ".uno:Cut", {});
+        Scheduler::ProcessEventsToIdle();
+
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(0), xIndexAccess->getCount());
+
+        // Without the fix in place, this test would have crashed here
+        dispatchCommand(mxComponent, ".uno:Paste", {});
+        Scheduler::ProcessEventsToIdle();
+
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+    }
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf128375)
 {
     for (sal_Int32 i = 0; i < 2; ++i)

Reply via email to