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

New commits:
commit e995fc61cef8fad6076212a0d7e8e357e5db1793
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed Jun 7 13:30:16 2023 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Jun 7 22:42:06 2023 +0200

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

diff --git a/sw/qa/extras/uiwriter/data/tdf155685.docx 
b/sw/qa/extras/uiwriter/data/tdf155685.docx
new file mode 100644
index 000000000000..ed45d7adc6cc
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf155685.docx differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index ef6de9c8e660..2d202567896d 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -84,6 +84,27 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf151974)
     }
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf155685)
+{
+    createSwDoc("tdf155685.docx");
+
+    CPPUNIT_ASSERT_EQUAL(8, getShapes());
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+    dispatchCommand(mxComponent, ".uno:Cut", {});
+
+    CPPUNIT_ASSERT_EQUAL(0, getShapes());
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    // Without the fix in place, this test would have crashed here
+    dispatchCommand(mxComponent, ".uno:Undo", {});
+
+    CPPUNIT_ASSERT_EQUAL(8, getShapes());
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf145731)
 {
     createSwDoc("tdf145731.odt");

Reply via email to