[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sw/qa

Jan Holesovsky kendy at collabora.com
Fri Apr 21 11:04:03 UTC 2017


 sw/qa/extras/uiwriter/uiwriter.cxx |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

New commits:
commit c60811c3ca14c78e3cfd115d33acb19a5f59eeea
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Apr 21 12:12:37 2017 +0200

    related tdf#68604: Unit test for writing the plaintext annotations in DOCX.
    
    Change-Id: I8c747e72ca96ffd097c92326210c39740102ec79
    Reviewed-on: https://gerrit.libreoffice.org/36786
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index b60fe47ee9ee..40d5c55c55de 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -222,6 +222,7 @@ public:
     void testTdf104814();
     void testTdf105417();
     void testTdf105625();
+    void testCreateDocxAnnotation();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -338,6 +339,7 @@ public:
     CPPUNIT_TEST(testTdf104814);
     CPPUNIT_TEST(testTdf105417);
     CPPUNIT_TEST(testTdf105625);
+    CPPUNIT_TEST(testCreateDocxAnnotation);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -4185,6 +4187,32 @@ void SwUiWriterTest::testTdf105625()
     CPPUNIT_ASSERT_EQUAL(nMarksBefore, nMarksAfter + 1);
 }
 
+void SwUiWriterTest::testCreateDocxAnnotation()
+{
+    createDoc();
+
+    // insert an annotation with a text
+    const OUString aSomeText("some text");
+    uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence(
+    {
+        {"Text", uno::makeAny(aSomeText)},
+        {"Author", uno::makeAny(OUString("me"))},
+    });
+    lcl_dispatchCommand(mxComponent, ".uno:InsertAnnotation", aPropertyValues);
+
+    // Save it as DOCX & load it again
+    reload("Office Open XML Text", "create-docx-annotation.docx");
+
+    // get the annotation
+    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<beans::XPropertySet> xField(xFields->nextElement(), uno::UNO_QUERY);
+
+    // this was empty insetad of "some text"
+    CPPUNIT_ASSERT_EQUAL(aSomeText, xField->getPropertyValue("Content").get<OUString>());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 


More information about the Libreoffice-commits mailing list