summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-06-05 17:21:54 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-06-05 17:23:52 +0200
commit67a041cf75c2d21de2ab59ef2ea0e0c612943ebd (patch)
treee31d117f02b21391b16d9e2d46326e730d7e2962 /sw
parent05cc8975d17b2f2c00e794252c34dc12394abc62 (diff)
sw: add smartart import testcase
Change-Id: I6a120fc69036fef8f21a2f80a2f424f36f876d23
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmltok/data/smartart.docxbin0 -> 20453 bytes
-rw-r--r--sw/qa/extras/ooxmltok/ooxmltok.cxx29
2 files changed, 29 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmltok/data/smartart.docx b/sw/qa/extras/ooxmltok/data/smartart.docx
new file mode 100644
index 000000000000..7a553f425188
--- /dev/null
+++ b/sw/qa/extras/ooxmltok/data/smartart.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmltok/ooxmltok.cxx b/sw/qa/extras/ooxmltok/ooxmltok.cxx
index 6dd79277b92e..2b050eb0ae55 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();