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

New commits:
commit 41f7b1b12dfdfce508f04878409854fb9da38874
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Dec 15 10:03:27 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Dec 15 12:27:38 2021 +0100

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

diff --git a/sw/qa/extras/uiwriter/data/tdf141175.odt 
b/sw/qa/extras/uiwriter/data/tdf141175.odt
new file mode 100644
index 000000000000..3ccfa6b1a326
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf141175.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 22a4f329296b..ca37d6ffa53e 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -904,6 +904,36 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf125261)
                          getProperty<OUString>(getRun(getParagraph(1), 1), 
"HyperLinkURL"));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf141175)
+{
+    createSwDoc(DATA_DIRECTORY, "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
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    Scheduler::ProcessEventsToIdle();
+
+    //Without the fix in place, this test would have crashed here
+    dispatchCommand(mxComponent, ".uno:Cut", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    dispatchCommand(mxComponent, ".uno:Paste", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf133990)
 {
     createSwDoc(DATA_DIRECTORY, "tdf133990.odt");

Reply via email to