summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <g.araminowicz@gmail.com>2017-07-27 17:58:31 +0200
committerJan Holesovsky <kendy@collabora.com>2017-07-28 14:37:38 +0200
commitc15c93467b62618bc7a977d137d25a491a26158b (patch)
treeded94c45d9de249be61fd49f3d4cb17958b4be3e /sd
parent73400f7a87205c052002d365245c35d3d0c996f5 (diff)
SmartArt: first unit test
Change-Id: I273847d01a457bf79a9b9182b370ffb58284c952 Reviewed-on: https://gerrit.libreoffice.org/40498 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sd')
-rwxr-xr-xsd/qa/unit/data/pptx/smartart1.pptxbin0 -> 43385 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx34
2 files changed, 34 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/smartart1.pptx b/sd/qa/unit/data/pptx/smartart1.pptx
new file mode 100755
index 000000000000..2a8817f158e2
--- /dev/null
+++ b/sd/qa/unit/data/pptx/smartart1.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 9dcf6c206655..58681c8e4224 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -162,6 +162,7 @@ public:
void testTdf89064();
void testTdf108925();
void testTdf109067();
+ void testSmartArt1();
bool checkPattern(sd::DrawDocShellRef& rDocRef, int nShapeNumber, std::vector<sal_uInt8>& rExpected);
void testPatternImport();
@@ -232,6 +233,7 @@ public:
CPPUNIT_TEST(testTdf89064);
CPPUNIT_TEST(testTdf108925);
CPPUNIT_TEST(testTdf109067);
+ CPPUNIT_TEST(testSmartArt1);
CPPUNIT_TEST_SUITE_END();
};
@@ -2220,6 +2222,38 @@ void SdImportTest::testTdf109067()
xDocShRef->DoClose();
}
+void SdImportTest::testSmartArt1()
+{
+ sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart1.pptx"), PPTX);
+ uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(5), xShapeGroup->getCount());
+
+ uno::Reference<text::XText> xText0(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(OUString("a"), xText0->getString());
+ uno::Reference<text::XText> xText1(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(OUString("b"), xText1->getString());
+ uno::Reference<text::XText> xText2(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(OUString("c"), xText2->getString());
+ uno::Reference<text::XText> xText3(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(OUString("d"), xText3->getString());
+ uno::Reference<text::XText> xText4(xShapeGroup->getByIndex(4), uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(OUString("e"), xText4->getString());
+
+ uno::Reference<beans::XPropertySet> xShape(xShapeGroup->getByIndex(0), uno::UNO_QUERY_THROW);
+
+ sal_Int32 nFillColor = 0;
+ xShape->getPropertyValue("FillColor") >>= nFillColor;
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(0x4F81BD), nFillColor);
+
+ sal_Int16 nParaAdjust = 0;
+ uno::Reference<text::XTextRange> xParagraph(getParagraphFromShape(0, xShape));
+ uno::Reference<beans::XPropertySet> xPropSet(xParagraph, uno::UNO_QUERY_THROW);
+ xPropSet->getPropertyValue("ParaAdjust") >>= nParaAdjust;
+ CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(nParaAdjust));
+
+ xDocShRef->DoClose();
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest);
CPPUNIT_PLUGIN_IMPLEMENT();