sw/qa/extras/uiwriter/data/tdf151605.odt |binary
 sw/qa/extras/uiwriter/uiwriter7.cxx      |   27 +++++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

New commits:
commit 55360ba58f33f3f45c83decce092c43d25c4e48c
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Mar 6 18:03:09 2023 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Mon Mar 6 22:50:25 2023 +0000

    tdf#151605: sw_uiwriter7: Add unittest
    
    Change-Id: I629a531d5ee34a0ab3ef888254bf987df716d4b7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148357
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/sw/qa/extras/uiwriter/data/tdf151605.odt 
b/sw/qa/extras/uiwriter/data/tdf151605.odt
new file mode 100644
index 000000000000..6d2d9f9da060
Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf151605.odt differ
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx 
b/sw/qa/extras/uiwriter/uiwriter7.cxx
index 6684940700ca..cd6f9f240be3 100644
--- a/sw/qa/extras/uiwriter/uiwriter7.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter7.cxx
@@ -1793,6 +1793,33 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf88899)
     CPPUNIT_ASSERT_EQUAL(OUString("11/10/14 03:03 AM"), 
xTextField->getPresentation(false));
 }
 
+CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf151605)
+{
+    createSwDoc("tdf151605.odt");
+
+    // disable IncludeHiddenText
+    std::shared_ptr<comphelper::ConfigurationChanges> batch(
+        comphelper::ConfigurationChanges::create());
+    
officecfg::Office::Writer::FilterFlags::ASCII::IncludeHiddenText::set(false, 
batch);
+    batch->commit();
+
+    dispatchCommand(mxComponent, ".uno:SelectAll", {});
+    dispatchCommand(mxComponent, ".uno:Copy", {});
+
+    uno::Sequence<beans::PropertyValue> aPropertyValues = 
comphelper::InitPropertySequence(
+        { { "SelectedFormat", 
uno::Any(static_cast<sal_uInt32>(SotClipboardFormatId::STRING)) } });
+
+    // Paste as Unformatted text
+    dispatchCommand(mxComponent, ".uno:ClipboardFormatItems", aPropertyValues);
+
+    CPPUNIT_ASSERT_EQUAL(OUString("Before"), getParagraph(1)->getString());
+    CPPUNIT_ASSERT_EQUAL(OUString("After"), getParagraph(2)->getString());
+
+    // re-enable it
+    
officecfg::Office::Writer::FilterFlags::ASCII::IncludeHiddenText::set(true, 
batch);
+    batch->commit();
+}
+
 CPPUNIT_TEST_FIXTURE(SwUiWriterTest7, testTdf90362)
 {
     createSwDoc("tdf90362.fodt");

Reply via email to