summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2017-04-21 12:12:37 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-04-21 13:03:39 +0200
commitc60811c3ca14c78e3cfd115d33acb19a5f59eeea (patch)
tree91c7b8f6dd247df42d186872d3632099f3795317
parent551b163d8f235c8667df3aaf9dffb45d6c47b498 (diff)
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@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx28
1 files changed, 28 insertions, 0 deletions
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();