[Libreoffice-commits] core.git: sd/qa

Grzegorz Araminowicz g.araminowicz at gmail.com
Fri Jul 28 12:38:25 UTC 2017


 sd/qa/unit/data/pptx/smartart1.pptx |binary
 sd/qa/unit/import-tests.cxx         |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)

New commits:
commit c15c93467b62618bc7a977d137d25a491a26158b
Author: Grzegorz Araminowicz <g.araminowicz at gmail.com>
Date:   Thu Jul 27 17:58:31 2017 +0200

    SmartArt: first unit test
    
    Change-Id: I273847d01a457bf79a9b9182b370ffb58284c952
    Reviewed-on: https://gerrit.libreoffice.org/40498
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

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
Binary files /dev/null and b/sd/qa/unit/data/pptx/smartart1.pptx 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();


More information about the Libreoffice-commits mailing list