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 <xiscofauli@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 0000000..6d2d9f9
--- /dev/null
+++ b/sw/qa/extras/uiwriter/data/tdf151605.odt
Binary files differ
diff --git a/sw/qa/extras/uiwriter/uiwriter7.cxx b/sw/qa/extras/uiwriter/uiwriter7.cxx
index 6684940..cd6f9f2 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");