sw/qa/extras/ww8export/ww8export4.cxx | 19 ------------------- sw/qa/extras/ww8import/ww8import.cxx | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 19 deletions(-)
New commits: commit b20e7aaac5b35972e0b7c40a34841417e5514824 Author: Adam Seskunas <adamsesku...@gmail.com> AuthorDate: Tue Aug 20 13:40:59 2024 -0700 Commit: Hossein <hoss...@libreoffice.org> CommitDate: Wed Aug 21 10:00:08 2024 +0200 Move testTdf160301 from ww8export to ww8import testTdf160301 only tests importing of .doc, so move to ww8import Change-Id: Ic97d758dcff5e6c6e184f994ce02031f6f700521 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172160 Tested-by: Jenkins Reviewed-by: Hossein <hoss...@libreoffice.org> diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index 065aa0d5e0c3..2eb0584c1be6 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -507,25 +507,6 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf135710) CPPUNIT_ASSERT_DOUBLES_EQUAL(static_cast<double>(nFlyLeft), static_cast<double>(nFlyLeftAfter), 2.0); } -CPPUNIT_TEST_FIXTURE(Test, testTdf160301) -{ - // Without the fix in place, fields in the test doc are imported as DocInformation - // with the content set to the variable name - createSwDoc("tdf160301.doc"); - uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); - uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); - uno::Reference<text::XTextField> xField(xFields->nextElement(), uno::UNO_QUERY); - // Without the fix in place this fails with - // Expected: Jeff Smith - // Actual: FullName - CPPUNIT_ASSERT_EQUAL(u"Jeff Smith"_ustr, xField->getPresentation(false)); - // Without the fix in place this fails with - // Expected: User Field FullName = Jeff Smith - // Actual: DocInformation:FullName - CPPUNIT_ASSERT_EQUAL(u"User Field FullName = Jeff Smith"_ustr, xField->getPresentation(true)); -} - } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/ww8export/data/tdf160301.doc b/sw/qa/extras/ww8import/data/tdf160301.doc similarity index 100% rename from sw/qa/extras/ww8export/data/tdf160301.doc rename to sw/qa/extras/ww8import/data/tdf160301.doc diff --git a/sw/qa/extras/ww8import/ww8import.cxx b/sw/qa/extras/ww8import/ww8import.cxx index c34237c6711b..ef0491586c2b 100644 --- a/sw/qa/extras/ww8import/ww8import.cxx +++ b/sw/qa/extras/ww8import/ww8import.cxx @@ -12,6 +12,7 @@ #include <com/sun/star/text/XTextColumns.hpp> #include <com/sun/star/text/XTextTablesSupplier.hpp> #include <com/sun/star/text/XTextSectionsSupplier.hpp> +#include <com/sun/star/text/XTextField.hpp> #include <com/sun/star/graphic/XGraphic.hpp> #include <editeng/boxitem.hxx> @@ -280,6 +281,25 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf142003) CPPUNIT_ASSERT(xParagraph->getString().startsWith("Lorem ipsum , consectetur adipiscing elit.")); } +CPPUNIT_TEST_FIXTURE(Test, testTdf160301) +{ + // Without the fix in place, fields in the test doc are imported as DocInformation + // with the content set to the variable name + createSwDoc("tdf160301.doc"); + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + uno::Reference<text::XTextField> xField(xFields->nextElement(), uno::UNO_QUERY); + // Without the fix in place this fails with + // Expected: Jeff Smith + // Actual: FullName + CPPUNIT_ASSERT_EQUAL(u"Jeff Smith"_ustr, xField->getPresentation(false)); + // Without the fix in place this fails with + // Expected: User Field FullName = Jeff Smith + // Actual: DocInformation:FullName + CPPUNIT_ASSERT_EQUAL(u"User Field FullName = Jeff Smith"_ustr, xField->getPresentation(true)); +} + // tests should only be added to ww8IMPORT *if* they fail round-tripping in ww8EXPORT } // end of anonymous namespace