[Libreoffice-commits] core.git: sw/qa

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 12 04:14:35 UTC 2019


 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 695da4b0e6c7bf1c9f99f2886b2c261ff9b557f0
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Wed Jul 3 19:46:48 2019 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Jul 12 06:13:20 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.
    
    Change-Id: I5dc2abc33f307d934771e4f6608d1c3a9ed71b0b
    Reviewed-on: https://gerrit.libreoffice.org/75456
    Tested-by: Jenkins
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

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 0ab2ee04f42c..1032d3abf09e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx
@@ -44,6 +44,9 @@
 #include <unotools/fltrcfg.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 #include <oox/drawingml/drawingmltypes.hxx>
+#include <xmloff/odffields.hxx>
+#include <IDocumentMarkAccess.hxx>
+#include <IMark.hxx>
 
 #include <bordertest.hxx>
 
@@ -958,19 +961,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());
+
+    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")
 {


More information about the Libreoffice-commits mailing list