summaryrefslogtreecommitdiff
path: root/sw/qa/extras
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-12-15 10:03:27 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-12-15 12:27:38 +0100
commit41f7b1b12dfdfce508f04878409854fb9da38874 (patch)
tree338077e7b79596a2c9a11fd679f85dde4f220ef5 /sw/qa/extras
parent76f29376183be48c076ada06159581ea981de3d1 (diff)
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 <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras')
-rw-r--r--sw/qa/extras/uiwriter/data/tdf141175.odtbin0 -> 9574 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter3.cxx30
2 files changed, 30 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf141175.odt
Binary files 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");