diff options
Diffstat (limited to 'sd/qa/unit/import-tests-smartart.cxx')
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 110b7d2c81ea..0d41e3094052 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -107,6 +107,7 @@ public: void testOrgChart2(); void testFillColorList(); void testLinearRule(); + void testAutofitSync(); CPPUNIT_TEST_SUITE(SdImportTestSmartArt); @@ -153,6 +154,7 @@ public: CPPUNIT_TEST(testOrgChart2); CPPUNIT_TEST(testFillColorList); CPPUNIT_TEST(testLinearRule); + CPPUNIT_TEST(testAutofitSync); CPPUNIT_TEST_SUITE_END(); }; @@ -1530,6 +1532,34 @@ void SdImportTestSmartArt::testLinearRule() xDocShRef->DoClose(); } +void SdImportTestSmartArt::testAutofitSync() +{ + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-autofit-sync.pptx"), PPTX); + + uno::Reference<drawing::XShape> xDiagram(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xMiddle = getChildShape(xDiagram, 2); + uno::Reference<beans::XPropertySet> xFirstInner(getChildShape(getChildShape(xMiddle, 0), 0), + uno::UNO_QUERY); + sal_Int16 nFirstScale = 0; + CPPUNIT_ASSERT(xFirstInner->getPropertyValue("TextFitToSizeScale") >>= nFirstScale); + CPPUNIT_ASSERT_GREATER(static_cast<sal_Int16>(0), nFirstScale); + uno::Reference<beans::XPropertySet> xSecondInner(getChildShape(getChildShape(xMiddle, 2), 0), + uno::UNO_QUERY); + sal_Int16 nSecondScale = 0; + CPPUNIT_ASSERT(xSecondInner->getPropertyValue("TextFitToSizeScale") >>= nSecondScale); + CPPUNIT_ASSERT_GREATER(static_cast<sal_Int16>(0), nSecondScale); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: 56 + // - Actual : 100 + // i.e. the left shape had no scale-down and the right shape was scaled down, even if it was + // requested that their scaling matches. + CPPUNIT_ASSERT_EQUAL(nSecondScale, nFirstScale); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt); CPPUNIT_PLUGIN_IMPLEMENT(); |