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

New commits:
commit 5e581fb759718fb0943249b9c018bfd8aac1427e
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Jan 24 20:49:08 2022 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Wed Feb 16 20:32:21 2022 +0100

    tdf#139843: sw_uiwriter3: Add unittest
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128885
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    (cherry picked from commit 3ed01498d10b0eca08453eb29fcc2c59c33d2467)
    
    Change-Id: I51b1ef4a9a4af07ddcf68e4a6a4e5ea0d039bef7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130034
    Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

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/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index eaa2e40bb636..252e43bb4e24 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -4147,6 +4147,27 @@ static void lcl_dispatchCommand(const 
uno::Reference<lang::XComponent>& xCompone
     xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, 
rPropertyValues);
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf139843)
+{
+    load(DATA_DIRECTORY, "tdf139843.odt");
+
+    CPPUNIT_ASSERT_EQUAL(7, getPages());
+
+    lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    Scheduler::ProcessEventsToIdle();
+
+    lcl_dispatchCommand(mxComponent, ".uno:Cut", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    // Without the fix in place, this test would have crashed here
+    lcl_dispatchCommand(mxComponent, ".uno:Paste", {});
+    Scheduler::ProcessEventsToIdle();
+
+    CPPUNIT_ASSERT_EQUAL(7, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest, testTdf134252)
 {
     load(DATA_DIRECTORY, "tdf134252.fodt");

Reply via email to