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

New commits:
commit 8e7e59eddedac07ea32388168bcc71f3e521a526
Author:     Samuel Adesola <adesolasamuel2...@outlook.com>
AuthorDate: Mon Oct 14 17:46:10 2024 +0000
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Oct 17 15:22:33 2024 +0200

    tdf#140061 CPPUNIT Test for fix swlo!sw::WriterMultiListener::StartListening
    
    A CPPUNIT Test for the bug fix on 
swlo!sw::WriterMultiListener::StartListening
    crash.
    The sample file was added to the sw/qa/uiwriter/data.
    Without this fix, writer crashes when the reproducing steps were followed.
    The bug fix was reverted, when the test was ran, the test failed, i.e the
    assert was not reached. The bug fix was reintroduced and the test
    passed showing that the test catch the bug.
    
    Change-Id: I688672d96a36d89c940bf0d401daaaeb732590a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174908
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data/tdf140061.odt 
b/sw/qa/extras/uiwriter/data/tdf140061.odt
new file mode 100644
index 000000000000..6b902022a8f7
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf140061.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter3.cxx 
b/sw/qa/extras/uiwriter/uiwriter3.cxx
index ae196c474439..6a50c1ba1260 100644
--- a/sw/qa/extras/uiwriter/uiwriter3.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter3.cxx
@@ -2547,6 +2547,38 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf150457)
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), xFootnotes->getCount());
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest3, testTdf140061)
+{
+    createSwDoc("tdf140061.odt");
+
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+
+    dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
+
+    dispatchCommand(mxComponent, u".uno:Copy"_ustr, {});
+
+    createSwDoc();
+    dispatchCommand(mxComponent, u".uno:Paste"_ustr, {});
+
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+
+    dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
+
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+
+    // Paste special as RTF
+    uno::Sequence<beans::PropertyValue> aPropertyValues = 
comphelper::InitPropertySequence(
+        { { "SelectedFormat", 
uno::Any(static_cast<sal_uInt32>(SotClipboardFormatId::RTF)) } });
+
+    dispatchCommand(mxComponent, u".uno:ClipboardFormatItems"_ustr, 
aPropertyValues);
+
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+
+    // Without the fix in place, this test would have crashed here
+    dispatchCommand(mxComponent, u".uno:Undo"_ustr, {});
+    CPPUNIT_ASSERT_EQUAL(1, getPages());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to