diff options
author | brinzing <oliver.brinzing@gmx.de> | 2019-11-01 16:36:31 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2019-12-10 00:25:28 +0100 |
commit | 701b5cfe9d908b346e95054b565d05747775ae79 (patch) | |
tree | 65baaf5129a6be0fe397f43e9802da76a05a322b /sw | |
parent | 0ef9a6847aa3c0082ef9d9a5170b76b2b98cc0a7 (diff) |
tdf#124986: docx: remove trailing quotation marks and spaces from set fields
Reviewed-on: https://gerrit.libreoffice.org/81892
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
Change-Id: I6390344b72b0148cff8e0ed5150d7abfc9490a2a
Reviewed-on: https://gerrit.libreoffice.org/84793
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sw')
-rwxr-xr-x | sw/qa/extras/ooxmlexport/data/tdf124986.docx | bin | 0 -> 12108 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport12.cxx | 22 |
2 files changed, 22 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf124986.docx b/sw/qa/extras/ooxmlexport/data/tdf124986.docx Binary files differnew file mode 100755 index 000000000000..e5bb8f4966b8 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf124986.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx index d7d41b1d1e36..fc79b451ce39 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport12.cxx @@ -771,6 +771,28 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105444, "tdf105444.docx") assertXPath(pXmlComm, "/w:comments/w:comment/w:p", 1); } +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); + } + } +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |