sw/qa/extras/ooxmlexport/data/n820509.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport8.cxx | 35 +++++++++++++++++++---------- 2 files changed, 24 insertions(+), 11 deletions(-)
New commits: commit 1e25fa2aee1ccb1c742b6b3b8ba37c61ba1fa26a Author: Tamás Zolnai <[email protected]> AuthorDate: Wed Jul 3 19:46:48 2019 +0200 Commit: Andras Timar <[email protected]> CommitDate: Sun Jul 14 00:18:34 2019 +0200 MSForms: DOCX filter: update testN820509() test * Now we import date field as date form field and not as date form control. * Design mode has no interaction with this kind of field, so we don't need check the design mode status. Reviewed-on: https://gerrit.libreoffice.org/75456 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <[email protected]> (cherry picked from commit 695da4b0e6c7bf1c9f99f2886b2c261ff9b557f0) Change-Id: I5dc2abc33f307d934771e4f6608d1c3a9ed71b0b Reviewed-on: https://gerrit.libreoffice.org/75549 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Andras Timar <[email protected]> diff --git a/sw/qa/extras/ooxmlexport/data/n820509.docx b/sw/qa/extras/ooxmlexport/data/n820509.docx index a6da1e16842c..bfaea9075652 100644 Binary files a/sw/qa/extras/ooxmlexport/data/n820509.docx and b/sw/qa/extras/ooxmlexport/data/n820509.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index 0adf7606a4aa..7670db91845f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -67,6 +67,9 @@ #include <unotools/streamwrap.hxx> #include <comphelper/propertysequence.hxx> #include <svx/svdpage.hxx> +#include <xmloff/odffields.hxx> +#include <IDocumentMarkAccess.hxx> +#include <IMark.hxx> #include <bordertest.hxx> @@ -956,19 +959,29 @@ DECLARE_OOXMLEXPORT_TEST(testN816593, "n816593.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTables->getCount()); } -/*DECLARE_OOXMLEXPORT_TEST(testN820509, "n820509.docx") +DECLARE_OOXMLEXPORT_TEST(testN820509, "n820509.docx") { - // Design mode was enabled. - uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); - uno::Reference<view::XFormLayerAccess> xFormLayerAccess(xModel->getCurrentController(), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(false, bool(xFormLayerAccess->isFormDesignMode())); - // M.d.yyyy date format was unhandled. - uno::Reference<drawing::XControlShape> xControlShape(getShape(1), uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xPropertySet(xControlShape->getControl(), uno::UNO_QUERY); - uno::Reference<lang::XServiceInfo> xServiceInfo(xPropertySet, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int16(8), getProperty<sal_Int16>(xPropertySet, "DateFormat")); -}*/ + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc(); + IDocumentMarkAccess* pMarkAccess = pDoc->getIDocumentMarkAccess(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pMarkAccess->getAllMarksCount()); + + ::sw::mark::IFieldmark* pFieldmark = dynamic_cast<::sw::mark::IFieldmark*>(pMarkAccess->getAllMarksBegin()->get()); + + CPPUNIT_ASSERT(pFieldmark); + CPPUNIT_ASSERT_EQUAL(OUString(ODF_FORMDATE), pFieldmark->GetFieldname()); + + const sw::mark::IFieldmark::parameter_map_t* const pParameters = pFieldmark->GetParameters(); + OUString sDateFormat; + auto pResult = pParameters->find(ODF_FORMDATE_DATEFORMAT); + if (pResult != pParameters->end()) + { + pResult->second >>= sDateFormat; + } + CPPUNIT_ASSERT_EQUAL(OUString("M.d.yyyy"), sDateFormat); +} DECLARE_OOXMLEXPORT_TEST(testN830205, "n830205.docx") { _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
