diff options
author | Varun <varun.dhall@studentpartner.com> | 2015-08-18 22:58:41 +0530 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2015-08-18 20:12:59 +0000 |
commit | 5120b3f30614f6e4988c512577da1d70be8d25b1 (patch) | |
tree | 65f870d27c8490724772d9b12790a849b35fe8b1 | |
parent | 28f3464a571a23a2c16bd0980e9021b95d011511 (diff) |
Added Test for tdf#74524 ODF import of range annotation
Change-Id: I9e5d67026df1b3d79dda1158d35357a8dae47517
Reviewed-on: https://gerrit.libreoffice.org/17843
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r-- | sw/qa/extras/odfimport/data/tdf74524.odt | bin | 0 -> 9015 bytes | |||
-rw-r--r-- | sw/qa/extras/odfimport/odfimport.cxx | 25 |
2 files changed, 25 insertions, 0 deletions
diff --git a/sw/qa/extras/odfimport/data/tdf74524.odt b/sw/qa/extras/odfimport/data/tdf74524.odt Binary files differnew file mode 100644 index 000000000000..df6f2e8fe72a --- /dev/null +++ b/sw/qa/extras/odfimport/data/tdf74524.odt diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 4ed43afa89b4..708704d70f47 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/table/BorderLine.hpp> #include <com/sun/star/text/XTextSection.hpp> #include <com/sun/star/text/XTextTable.hpp> +#include <com/sun/star/text/PageNumberType.hpp> #include <wrtsh.hxx> #include <ndtxt.hxx> @@ -248,6 +249,30 @@ DECLARE_ODFIMPORT_TEST(testPageStyleLayoutDefault, "hello.odt") CPPUNIT_ASSERT_EQUAL(style::PageStyleLayout_ALL, getProperty<style::PageStyleLayout>(xPropertySet, "PageStyleLayout")); } +DECLARE_ODFIMPORT_TEST(testTdf74524, "tdf74524.odt") +{ + uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields()); + uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); + uno::Any aField1 = xFields->nextElement(); + uno::Reference<lang::XServiceInfo> xServiceInfo1(aField1, uno::UNO_QUERY); + CPPUNIT_ASSERT(xServiceInfo1->supportsService(OUString("com.sun.star.text.textfield.PageNumber"))); + uno::Reference<beans::XPropertySet> xPropertySet(aField1, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(uno::makeAny(sal_Int16(style::NumberingType::PAGE_DESCRIPTOR)), xPropertySet->getPropertyValue(OUString("NumberingType"))); + CPPUNIT_ASSERT_EQUAL(uno::makeAny(sal_Int16(0)), xPropertySet->getPropertyValue(OUString("Offset"))); + CPPUNIT_ASSERT_EQUAL(uno::makeAny(text::PageNumberType_CURRENT), xPropertySet->getPropertyValue(OUString("SubType"))); + uno::Reference<text::XTextContent> xField1(aField1, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("1"), xField1->getAnchor()->getString()); + uno::Any aField2 = xFields->nextElement(); + uno::Reference<lang::XServiceInfo> xServiceInfo2(aField2, uno::UNO_QUERY); + CPPUNIT_ASSERT(xServiceInfo2->supportsService(OUString("com.sun.star.text.textfield.Annotation"))); + uno::Reference<beans::XPropertySet> xPropertySet2(aField2, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(uno::makeAny(OUString("Comment 1")), xPropertySet2->getPropertyValue(OUString("Content"))); + uno::Reference<text::XTextContent> xField2(aField2, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Hello 1World"), xField2->getAnchor()->getString()); + CPPUNIT_ASSERT(!xFields->hasMoreElements()); +} + DECLARE_ODFIMPORT_TEST(testPageStyleLayoutRight, "hello.odt") { uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Default Style"), uno::UNO_QUERY); |