summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-05-04 17:16:38 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-05-05 10:23:03 +0200
commitb3a4ebd8de244078712d48f21a126f6246b7bc4e (patch)
tree0e1b76fc2c4c362d086cc83098f9eb74a6c90dc7
parent1c0dbc2c5c782c118ce44825d92f697a6265fc75 (diff)
tdf#148921: sd_import_tests-smartart: Add unittest
Change-Id: Ib2016afb06914d453fe398127b2f6f50e48c0e93 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133834 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--sd/qa/unit/data/pptx/tdf148921.pptxbin0 -> 39848 bytes
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx28
2 files changed, 28 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/tdf148921.pptx b/sd/qa/unit/data/pptx/tdf148921.pptx
new file mode 100644
index 000000000000..f4fce9ae4808
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf148921.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 9048fe7706ce..2e246485d36c 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -73,6 +73,7 @@ public:
void testCnt();
void testDir();
void testTdf148665();
+ void testTdf148921();
void testMaxDepth();
void testRotation();
void testTextAutoRotation();
@@ -127,6 +128,7 @@ public:
CPPUNIT_TEST(testCnt);
CPPUNIT_TEST(testDir);
CPPUNIT_TEST(testTdf148665);
+ CPPUNIT_TEST(testTdf148921);
CPPUNIT_TEST(testMaxDepth);
CPPUNIT_TEST(testRotation);
CPPUNIT_TEST(testTextAutoRotation);
@@ -356,6 +358,32 @@ void SdImportTestSmartArt::testTdf148665()
xDocShRef->DoClose();
}
+void SdImportTestSmartArt::testTdf148921()
+{
+ sd::DrawDocShellRef xDocShRef
+ = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf148921.pptx"), PPTX);
+ uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef),
+ uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xShapeGroup->getCount());
+
+ uno::Reference<drawing::XShapes> xShapeGroup2(xShapeGroup->getByIndex(1), uno::UNO_QUERY_THROW);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 2
+ // - Actual : 4
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xShapeGroup2->getCount());
+
+ uno::Reference<drawing::XShape> xShape0(xShapeGroup2->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XShape> xShape1(xShapeGroup2->getByIndex(1), uno::UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT(xShape0->getPosition().X < xShape1->getPosition().X);
+ CPPUNIT_ASSERT(xShape0->getPosition().Y < xShape1->getPosition().Y);
+ CPPUNIT_ASSERT(xShape0->getSize().Height > xShape1->getSize().Height);
+ CPPUNIT_ASSERT(xShape0->getSize().Width > xShape1->getSize().Width);
+
+ xDocShRef->DoClose();
+}
+
void SdImportTestSmartArt::testMaxDepth()
{
sd::DrawDocShellRef xDocShRef = loadURL(