[Libreoffice-commits] .: sw/qa
Miklos Vajna
vmiklos at kemper.freedesktop.org
Tue Jun 5 08:22:50 PDT 2012
sw/qa/extras/ooxmltok/data/smartart.docx |binary
sw/qa/extras/ooxmltok/ooxmltok.cxx | 29 +++++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
New commits:
commit 67a041cf75c2d21de2ab59ef2ea0e0c612943ebd
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Jun 5 17:21:54 2012 +0200
sw: add smartart import testcase
Change-Id: I6a120fc69036fef8f21a2f80a2f424f36f876d23
diff --git a/sw/qa/extras/ooxmltok/data/smartart.docx b/sw/qa/extras/ooxmltok/data/smartart.docx
new file mode 100644
index 0000000..7a553f4
Binary files /dev/null and b/sw/qa/extras/ooxmltok/data/smartart.docx differ
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 6dd7927..2b050eb 100644
--- a/sw/qa/extras/ooxmltok/ooxmltok.cxx
+++ b/sw/qa/extras/ooxmltok/ooxmltok.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <com/sun/star/text/XTextViewCursorSupplier.hpp>
+#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <vcl/svapp.hxx>
@@ -63,6 +64,7 @@ public:
void testN652364();
void testN760764();
void testN764005();
+ void testSmartart();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -80,6 +82,7 @@ public:
CPPUNIT_TEST(testN652364);
CPPUNIT_TEST(testN760764);
CPPUNIT_TEST(testN764005);
+ CPPUNIT_TEST(testSmartart);
#endif
CPPUNIT_TEST_SUITE_END();
@@ -443,6 +446,32 @@ void Test::testN764005()
CPPUNIT_ASSERT_EQUAL(sal_False, bValue);
}
+void Test::testSmartart()
+{
+ load("smartart.docx");
+
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount()); // One groupshape in the doc
+
+ uno::Reference<container::XIndexAccess> xGroup(xDraws->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xGroup->getCount()); // 3 rectangles and an arrow in the group
+
+ uno::Reference<beans::XPropertySet> xPropertySet(xGroup->getByIndex(1), uno::UNO_QUERY);
+ sal_Int32 nValue(0);
+ xPropertySet->getPropertyValue("FillColor") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4f81bd), nValue); // If fill color is right, theme import is OK
+
+ uno::Reference<text::XTextRange> xTextRange(xGroup->getByIndex(1), uno::UNO_QUERY);
+ CPPUNIT_ASSERT_EQUAL(OUString("Sample"), xTextRange->getString()); // Shape has text
+
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextRange->getText(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+ xPropertySet.set(xParaEnum->nextElement(), uno::UNO_QUERY);
+ xPropertySet->getPropertyValue("ParaAdjust") >>= nValue;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(style::ParagraphAdjust_CENTER), nValue); // Paragraph properties are imported
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list