summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-07-17 13:09:14 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-07-18 11:59:04 +0200
commitb8146f5126e8290b5b287f0a6176ff6619f34f67 (patch)
tree011d959a4b0dc2e65fcc518377fe63d8579f7c0e /sw/qa/extras/ooxmlexport/ooxmlexport.cxx
parent0977c5121e63522137a7b00c41d07112c192ef9e (diff)
fdo#38244 testcase
Change-Id: I6df325a20994f789e4c6acdf5a2912a57a034276
Diffstat (limited to 'sw/qa/extras/ooxmlexport/ooxmlexport.cxx')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx68
1 files changed, 68 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 859cc89615ad..c426c372c9ec 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -40,11 +40,13 @@ class Test : public SwModelTestBase
public:
void testZoom();
void defaultTabStopNotInStyles();
+ void testFdo38244();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(testZoom);
CPPUNIT_TEST(defaultTabStopNotInStyles);
+ CPPUNIT_TEST(testFdo38244);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -91,6 +93,72 @@ void Test::defaultTabStopNotInStyles()
CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(0), stops.getLength());
}
+void Test::testFdo38244()
+{
+ roundtrip("fdo38244.docx");
+
+ /*
+ * Comments attached to a range was imported without the range, check for the fieldmark start/end positions.
+ *
+ * oParas = ThisComponent.Text.createEnumeration
+ * oPara = oParas.nextElement
+ * oRuns = oPara.createEnumeration
+ * oRun = oRuns.nextElement
+ * oRun = oRuns.nextElement 'TextFieldStart
+ * oRun = oRuns.nextElement
+ * oRun = oRuns.nextElement 'TextFieldEnd
+ * xray oRun.TextPortionType
+ */
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+ uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration();
+ xRunEnum->nextElement();
+ uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("TextFieldStart"), getProperty<OUString>(xPropertySet, "TextPortionType"));
+ xRunEnum->nextElement();
+ xPropertySet.set(xRunEnum->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), getProperty<OUString>(xPropertySet, "TextPortionType"));
+
+ /*
+ * Initials were not imported.
+ *
+ * oFields = ThisComponent.TextFields.createEnumeration
+ * oField = oFields.nextElement
+ * xray oField.Initials
+ */
+ uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
+ uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
+ xPropertySet.set(xFields->nextElement(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("M"), getProperty<OUString>(xPropertySet, "Initials"));
+
+ /*
+ * There was a fake empty paragraph at the end of the comment text.
+ *
+ * oFields = ThisComponent.TextFields.createEnumeration
+ * oField = oFields.nextElement
+ * oParas = oField.TextRange.createEnumeration
+ * oPara = oParas.nextElement
+ * oPara = oParas.nextElement
+ */
+
+ xParaEnumAccess.set(getProperty< uno::Reference<container::XEnumerationAccess> >(xPropertySet, "TextRange"), uno::UNO_QUERY);
+ xParaEnum = xParaEnumAccess->createEnumeration();
+ xParaEnum->nextElement();
+ bool bCaught = false;
+ try
+ {
+ xParaEnum->nextElement();
+ }
+ catch (container::NoSuchElementException&)
+ {
+ bCaught = true;
+ }
+ CPPUNIT_ASSERT_EQUAL(true, bCaught);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();