sw/qa/extras/odfimport/data/tdf74524.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+)
New commits: commit 5120b3f30614f6e4988c512577da1d70be8d25b1 Author: Varun <varun.dh...@studentpartner.com> Date: Tue Aug 18 22:58:41 2015 +0530 Added Test for tdf#74524 ODF import of range annotation Change-Id: I9e5d67026df1b3d79dda1158d35357a8dae47517 Reviewed-on: https://gerrit.libreoffice.org/17843 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Michael Stahl <mst...@redhat.com> diff --git a/sw/qa/extras/odfimport/data/tdf74524.odt b/sw/qa/extras/odfimport/data/tdf74524.odt new file mode 100644 index 0000000..df6f2e8 Binary files /dev/null and b/sw/qa/extras/odfimport/data/tdf74524.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 4ed43af..708704d 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); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits