diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-02-22 17:12:04 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-02-22 19:30:16 +0100 |
commit | 333e9ea15bb57cf1c87ac2ea150de1e3fd79cfcb (patch) | |
tree | 3b10300cd97c0b0883d68ac1e4a102af2f599b84 /sd/qa | |
parent | 8777fc78ce7913b774d1c6ef660c7668c6c7b526 (diff) |
oox smartart, picture strip: handle bitmap fill of pres nodes
There were two problems here:
1) We did not import bitmap fill from presentation nodes.
2) Presentation nodes contained properties with reference semantics, so
if you set a bitmap fill for a first and a second shape, then at the end
both shapes contained the second bitmap.
With this, both bitmaps are imported exactly once.
Change-Id: I098a006eb3f58a338400663d57888ca671ed9909
Reviewed-on: https://gerrit.libreoffice.org/68218
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sd/qa')
-rw-r--r-- | sd/qa/unit/data/pptx/smartart-picture-strip.pptx | bin | 0 -> 47565 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 38 |
2 files changed, 38 insertions, 0 deletions
diff --git a/sd/qa/unit/data/pptx/smartart-picture-strip.pptx b/sd/qa/unit/data/pptx/smartart-picture-strip.pptx Binary files differnew file mode 100644 index 000000000000..4c379dfd396c --- /dev/null +++ b/sd/qa/unit/data/pptx/smartart-picture-strip.pptx diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 2faf360b5b72..22d781950176 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -67,6 +67,7 @@ public: void testContinuousBlockProcess(); void testOrgChart(); void testCycleMatrix(); + void testPictureStrip(); CPPUNIT_TEST_SUITE(SdImportTestSmartArt); @@ -99,6 +100,7 @@ public: CPPUNIT_TEST(testContinuousBlockProcess); CPPUNIT_TEST(testOrgChart); CPPUNIT_TEST(testCycleMatrix); + CPPUNIT_TEST(testPictureStrip); CPPUNIT_TEST_SUITE_END(); }; @@ -905,6 +907,42 @@ void SdImportTestSmartArt::testCycleMatrix() xDocShRef->DoClose(); } +void SdImportTestSmartArt::testPictureStrip() +{ + sd::DrawDocShellRef xDocShRef = loadURL( + m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/smartart-picture-strip.pptx"), PPTX); + uno::Reference<drawing::XShape> xGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY); + CPPUNIT_ASSERT(xGroup.is()); + + uno::Reference<beans::XPropertySet> xFirstImage(getChildShape(getChildShape(xGroup, 0), 1), + uno::UNO_QUERY); + CPPUNIT_ASSERT(xFirstImage.is()); + drawing::FillStyle eFillStyle = drawing::FillStyle_NONE; + xFirstImage->getPropertyValue("FillStyle") >>= eFillStyle; + // Without the accompanying fix in place, this test would have failed: fill style was solid, not + // bitmap. + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, eFillStyle); + + uno::Reference<graphic::XGraphic> xGraphic; + xFirstImage->getPropertyValue("FillBitmap") >>= xGraphic; + Graphic aFirstGraphic(xGraphic); + + uno::Reference<beans::XPropertySet> xSecondImage(getChildShape(getChildShape(xGroup, 1), 1), + uno::UNO_QUERY); + CPPUNIT_ASSERT(xSecondImage.is()); + eFillStyle = drawing::FillStyle_NONE; + xSecondImage->getPropertyValue("FillStyle") >>= eFillStyle; + CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, eFillStyle); + + xSecondImage->getPropertyValue("FillBitmap") >>= xGraphic; + Graphic aSecondGraphic(xGraphic); + // Without the accompanying fix in place, this test would have failed: both xFirstImage and + // xSecondImage had the bitmap fill from the second shape. + CPPUNIT_ASSERT(aFirstGraphic.GetChecksum() != aSecondGraphic.GetChecksum()); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTestSmartArt); CPPUNIT_PLUGIN_IMPLEMENT(); |