From 61a4b90dcdb953dd21a22a2f291ffd6be399ddd8 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 27 Apr 2022 13:39:01 +0200 Subject: tdf#148665: sd_import_tests-smartart: Add unittest Change-Id: I345f0a55ba5bbe78e4c0bfccd9b21965c05bff33 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133507 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sd/qa/unit/data/pptx/tdf148665.pptx | Bin 0 -> 33343 bytes sd/qa/unit/import-tests-smartart.cxx | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 sd/qa/unit/data/pptx/tdf148665.pptx diff --git a/sd/qa/unit/data/pptx/tdf148665.pptx b/sd/qa/unit/data/pptx/tdf148665.pptx new file mode 100644 index 000000000000..e8613e2969a6 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf148665.pptx differ diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 91773929a05d..9048fe7706ce 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -72,6 +72,7 @@ public: void testText(); void testCnt(); void testDir(); + void testTdf148665(); void testMaxDepth(); void testRotation(); void testTextAutoRotation(); @@ -125,6 +126,7 @@ public: CPPUNIT_TEST(testText); CPPUNIT_TEST(testCnt); CPPUNIT_TEST(testDir); + CPPUNIT_TEST(testTdf148665); CPPUNIT_TEST(testMaxDepth); CPPUNIT_TEST(testRotation); CPPUNIT_TEST(testTextAutoRotation); @@ -334,6 +336,26 @@ void SdImportTestSmartArt::testDir() xDocShRef->DoClose(); } +void SdImportTestSmartArt::testTdf148665() +{ + // Without the fix in place, this test would have crashed at import time + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf148665.pptx"), PPTX); + uno::Reference xShapeGroup(getShapeFromPage(0, 0, xDocShRef), + uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xShapeGroup->getCount()); + + // FIXME: tdf#148818: Text should be 'Fufufu' + uno::Reference xText0(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(OUString(""), xText0->getString()); + uno::Reference xText1(xShapeGroup->getByIndex(2), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(OUString("Susu"), xText1->getString()); + uno::Reference xText2(xShapeGroup->getByIndex(3), uno::UNO_QUERY_THROW); + CPPUNIT_ASSERT_EQUAL(OUString("Sasa Haha"), xText2->getString()); + + xDocShRef->DoClose(); +} + void SdImportTestSmartArt::testMaxDepth() { sd::DrawDocShellRef xDocShRef = loadURL( -- cgit