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

New commits:
commit 3ed01498d10b0eca08453eb29fcc2c59c33d2467
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Jan 24 20:49:08 2022 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Jan 24 23:20:51 2022 +0100

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

diff --git a/sw/qa/extras/uiwriter/data/tdf139843.odt 
b/sw/qa/extras/uiwriter/data/tdf139843.odt
new file mode 100644
index 000000000000..67a555799006
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf139843.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index 8ad4a66cb4e3..642dec7b812a 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -83,6 +83,27 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf145731)
     CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf139843)
+{
+    createSwDoc(DATA_DIRECTORY, "tdf139843.odt");
+
+    CPPUNIT_ASSERT_EQUAL(7, getPages());
+
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    Scheduler::ProcessEventsToIdle();
+
+    dispatchCommand(mxComponent, ".uno:Cut", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    // Without the fix in place, this test would have crashed here
+    dispatchCommand(mxComponent, ".uno:Paste", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(7, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf145321)
 {
     createSwDoc(DATA_DIRECTORY, "tdf145321.odt");

Reply via email to