From fea5c10e222b10d83e0081dc1d1b2e678689d250 Mon Sep 17 00:00:00 2001 From: brinzing Date: Fri, 1 Nov 2019 16:36:31 +0100 Subject: 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 --- sw/qa/extras/ooxmlexport/data/tdf124986.docx | Bin 0 -> 12108 bytes sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 sw/qa/extras/ooxmlexport/data/tdf124986.docx (limited to 'sw/qa') 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 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf124986.docx 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 xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference xFields(xFieldsAccess->createEnumeration()); + + while (xFields->hasMoreElements()) + { + uno::Reference xServiceInfo(xFields->nextElement(), uno::UNO_QUERY); + uno::Reference 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. -- cgit v1.2.3