diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2017-11-24 00:18:09 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2017-11-24 16:39:04 +0100 |
commit | ca6fec87e0ebc32a748f9f44143e6336b008399e (patch) | |
tree | bae0659ce41ef781249fa933b599d34393f6e6c4 /sw/qa/extras/ww8export | |
parent | 8453f51fc69c72ef439bfa33b5fdd6dae793a47b (diff) |
tdf#67207: export MERGEDIELD to DOCX and DOC
Also removed a hack for i119803, because proper solution is
implemented.
This does not export data source information yet.
Unit tests for DOC and DOCX are included. RTF export is already
covered in testFdo80905.
Change-Id: Id4f6d53344edf474add7e885e8ae6f36618e569f
Reviewed-on: https://gerrit.libreoffice.org/45193
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw/qa/extras/ww8export')
-rw-r--r-- | sw/qa/extras/ww8export/data/mailmerge.doc | bin | 0 -> 23040 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export2.cxx | 27 |
2 files changed, 27 insertions, 0 deletions
diff --git a/sw/qa/extras/ww8export/data/mailmerge.doc b/sw/qa/extras/ww8export/data/mailmerge.doc Binary files differnew file mode 100644 index 000000000000..6ed882769ebb --- /dev/null +++ b/sw/qa/extras/ww8export/data/mailmerge.doc diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index cc064dcde293..9ef0c5ff0c6a 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -14,6 +14,7 @@ #include <com/sun/star/container/XIndexAccess.hpp> #include <com/sun/star/text/HoriOrientation.hpp> #include <com/sun/star/text/WritingMode2.hpp> +#include <com/sun/star/text/XDependentTextField.hpp> #include <com/sun/star/text/XTextFramesSupplier.hpp> #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextTablesSupplier.hpp> @@ -323,6 +324,32 @@ DECLARE_WW8EXPORT_TEST( testActiveXCheckbox, "checkbox_control.odt" ) CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AS_CHARACTER,getProperty<text::TextContentAnchorType>(xPropertySet2,"AnchorType")); } +DECLARE_WW8EXPORT_TEST(testTdf67207_MERGEFIELD, "mailmerge.doc") +{ + uno::Reference<beans::XPropertySet> xTextField = getProperty< uno::Reference<beans::XPropertySet> >(getRun(getParagraph(1), 2), "TextField"); + CPPUNIT_ASSERT(xTextField.is()); + uno::Reference<lang::XServiceInfo> xServiceInfo(xTextField, uno::UNO_QUERY_THROW); + uno::Reference<text::XDependentTextField> xDependent(xTextField, uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT(xServiceInfo->supportsService("com.sun.star.text.TextField.Database")); + OUString sValue; + xTextField->getPropertyValue("Content") >>= sValue; + CPPUNIT_ASSERT_EQUAL(OUString::fromUtf8(u8"«Name»"), sValue); + + uno::Reference<beans::XPropertySet> xFiledMaster = xDependent->getTextFieldMaster(); + uno::Reference<lang::XServiceInfo> xFiledMasterServiceInfo(xFiledMaster, uno::UNO_QUERY_THROW); + + CPPUNIT_ASSERT(xFiledMasterServiceInfo->supportsService("com.sun.star.text.fieldmaster.Database")); + + // Defined properties: DataBaseName, Name, DataTableName, DataColumnName, DependentTextFields, DataCommandType, InstanceName, DataBaseURL + CPPUNIT_ASSERT(xFiledMaster->getPropertyValue("Name") >>= sValue); + CPPUNIT_ASSERT_EQUAL(OUString("Name"), sValue); + CPPUNIT_ASSERT(xFiledMaster->getPropertyValue("DataColumnName") >>= sValue); + CPPUNIT_ASSERT_EQUAL(OUString("Name"), sValue); + CPPUNIT_ASSERT(xFiledMaster->getPropertyValue("InstanceName") >>= sValue); + CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.text.fieldmaster.DataBase.Name"), sValue); +} + DECLARE_OOXMLEXPORT_TEST( testTableCrossReference, "table_cross_reference.odt" ) { // tdf#42346: Cross references to tables were not saved |