summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorbrinzing <oliver.brinzing@gmx.de>2019-11-01 16:36:31 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-11-11 09:54:50 +0100
commitfea5c10e222b10d83e0081dc1d1b2e678689d250 (patch)
tree257d63df6dc508092353728c80652a4d4eef0902 /sw/qa
parente4bf92ae344e0db16177de7fc9eed432339d8705 (diff)
tdf#124986: docx: remove trailing quotation marks and spaces from set fields
Change-Id: I6390344b72b0148cff8e0ed5150d7abfc9490a2a Reviewed-on: https://gerrit.libreoffice.org/81892 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/qa')
-rwxr-xr-xsw/qa/extras/ooxmlexport/data/tdf124986.docxbin0 -> 12108 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx21
2 files changed, 21 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf124986.docx b/sw/qa/extras/ooxmlexport/data/tdf124986.docx
new file mode 100755
index 000000000000..e5bb8f4966b8
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf124986.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 12950c8451a7..98ee2ab45c48 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -67,6 +67,27 @@ DECLARE_OOXMLIMPORT_TEST(testTdf125038, "tdf125038.docx")
CPPUNIT_ASSERT_EQUAL(OUString("phone: \t1234567890"), aActual);
}
+DECLARE_OOXMLIMPORT_TEST(testTdf124986, "tdf124986.docx")
+{
+ // Load a document with SET fields, where the SET fields contain leading/trailing quotation marks and spaces.
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+ uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+
+ while (xFields->hasMoreElements())
+ {
+ uno::Reference<lang::XServiceInfo> xServiceInfo(xFields->nextElement(), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xPropertySet(xServiceInfo, uno::UNO_QUERY);
+ OUString aValue;
+ if (xServiceInfo->supportsService("com.sun.star.text.TextField.SetExpression"))
+ {
+ xPropertySet->getPropertyValue("Content") >>= aValue;
+ CPPUNIT_ASSERT_EQUAL(OUString("demo"), aValue);
+ }
+ }
+}
+
DECLARE_OOXMLIMPORT_TEST(testTdf125038b, "tdf125038b.docx")
{
// Load a document with an IF field, where the IF field command contains a paragraph break.