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

New commits:
commit 1103240cb3e884ea6024a690eeed743934662a12
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Jan 18 11:18:00 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jan 18 13:47:33 2022 +0100

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

diff --git a/sw/qa/extras/uiwriter/data/tdf145321.odt 
b/sw/qa/extras/uiwriter/data/tdf145321.odt
new file mode 100644
index 000000000000..0a460c7e6f17
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf145321.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 80413dcea65f..0de2971c5813 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -82,6 +82,30 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf145731)
     CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf145321)
+{
+    createSwDoc(DATA_DIRECTORY, "tdf145321.odt");
+
+    CPPUNIT_ASSERT_EQUAL(3, getShapes());
+    CPPUNIT_ASSERT_EQUAL(3, getPages());
+
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    Scheduler::ProcessEventsToIdle();
+
+    dispatchCommand(mxComponent, ".uno:Cut", {});
+    Scheduler::ProcessEventsToIdle();
+
+    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", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(3, getShapes());
+    CPPUNIT_ASSERT_EQUAL(3, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf129382)
 {
     SwDoc* pDoc = createSwDoc(DATA_DIRECTORY, "tdf129382.docx");

Reply via email to