sw/qa/extras/uiwriter/data2/tdf141175.odt |binary
 sw/qa/extras/uiwriter/uiwriter2.cxx       |   30 ++++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

New commits:
commit d58b95472f6ac7791b9f50e9ced5acbdf4c942d3
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Dec 15 10:03:27 2021 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Dec 17 11:25:19 2021 +0100

    tdf#141175: sw_uiwriter3: Add unittest
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126851
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 41f7b1b12dfdfce508f04878409854fb9da38874)
    
    Change-Id: Iba615528f8515fe60dc71bc61c0d815c0e1962e2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126955
    Tested-by: Michael Stahl <michael.st...@allotropia.de>
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/qa/extras/uiwriter/data2/tdf141175.odt 
b/sw/qa/extras/uiwriter/data2/tdf141175.odt
new file mode 100644
index 000000000000..3ccfa6b1a326
Binary files /dev/null and b/sw/qa/extras/uiwriter/data2/tdf141175.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx 
b/sw/qa/extras/uiwriter/uiwriter2.cxx
index c6da2d1878b0..1aa1bbdf1ddf 100644
--- a/sw/qa/extras/uiwriter/uiwriter2.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter2.cxx
@@ -763,6 +763,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, 
testTdf54819_keep_numbering_with_Undo)
     CPPUNIT_ASSERT_MESSAGE("Not a bulleted list item", sNumName != "Outline");
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf141175)
+{
+    createDoc("tdf141175.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(1), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    //Use selectAll 3 times in a row
+    lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    Scheduler::ProcessEventsToIdle();
+
+    //Without the fix in place, this test would have crashed here
+    lcl_dispatchCommand(mxComponent, ".uno:Cut", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    lcl_dispatchCommand(mxComponent, ".uno:Paste", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testTdf119571_keep_numbering_with_Undo)
 {
     // as the previous test, but with partial paragraph deletion:

Reply via email to