summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-12-15 10:03:27 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-12-17 11:25:19 +0100
commitd58b95472f6ac7791b9f50e9ced5acbdf4c942d3 (patch)
tree9edebda1acbf385fa3730cfe189ab814d4e2511a
parenttdf#141175 sw_redlinehide: fix crash in lcl_DeleteRedlines() (diff)
downloadcore-d58b95472f6ac7791b9f50e9ced5acbdf4c942d3.tar.gz
core-d58b95472f6ac7791b9f50e9ced5acbdf4c942d3.zip
tdf#141175: sw_uiwriter3: Add unittest
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126851 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> (cherry picked from commit 41f7b1b12dfdfce508f04878409854fb9da38874) Change-Id: Iba615528f8515fe60dc71bc61c0d815c0e1962e2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126955 Tested-by: Michael Stahl <michael.stahl@allotropia.de> Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r--sw/qa/extras/uiwriter/data2/tdf141175.odtbin0 -> 9574 bytes
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx30
2 files changed, 30 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data2/tdf141175.odt
Binary files 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: