sw/qa/extras/uiwriter/data/tdf147723.docx |binary
 sw/qa/extras/uiwriter/uiwriter5.cxx       |   21 +++++++++++++++++++++
 2 files changed, 21 insertions(+)

New commits:
commit e31cf19e5f5bcdc9e96d1ecd896a611ea035a934
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Apr 21 14:12:48 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Apr 21 17:03:09 2022 +0200

    tdf#147723: sw_uiwriter5: Add unittest
    
    Change-Id: Ief6afaee548e58a31580b66d55b9b193ba23d153
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133259
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data/tdf147723.docx 
b/sw/qa/extras/uiwriter/data/tdf147723.docx
new file mode 100644
index 000000000000..4cdfb264bd4d
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf147723.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter5.cxx 
b/sw/qa/extras/uiwriter/uiwriter5.cxx
index 1ba4f86cc8b9..dbd804164671 100644
--- a/sw/qa/extras/uiwriter/uiwriter5.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter5.cxx
@@ -887,6 +887,27 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, 
testMixedFormFieldInsertion)
     CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pMarkAccess->getAllMarksCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf147723)
+{
+    SwDoc* const pDoc = createSwDoc(DATA_DIRECTORY, "tdf147723.docx");
+
+    IDocumentMarkAccess& rIDMA(*pDoc->getIDocumentMarkAccess());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rIDMA.getAllMarksCount());
+
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    dispatchCommand(mxComponent, ".uno:Copy", {});
+
+    // Without the fix in place, this test would have crashed here
+    dispatchCommand(mxComponent, ".uno:Paste", {});
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rIDMA.getAllMarksCount());
+    dispatchCommand(mxComponent, ".uno:Paste", {});
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(6), rIDMA.getAllMarksCount());
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rIDMA.getAllMarksCount());
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(3), rIDMA.getAllMarksCount());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest5, testTdf147006)
 {
     SwDoc* const pDoc = createSwDoc(DATA_DIRECTORY, "tdf147006.rtf");

Reply via email to