From 259d01a34d27df2fbfd11c3bf6fe9dc508ff6ac2 Mon Sep 17 00:00:00 2001 From: Tamás Zolnai Date: Sat, 18 May 2019 17:42:25 +0200 Subject: tdf#125360: PPTX: Shape fill transparency is not exported MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit .. if the original shape fill is defined with a theme Override the alpha value with the current value get from FillTransparence API attirbute even if the color is defined with a style or a color scheme. Change-Id: I09d26238a9c2b501279e6749687dc535e614bbd6 Reviewed-on: https://gerrit.libreoffice.org/72596 Tested-by: Jenkins Reviewed-by: Tamás Zolnai --- sd/qa/unit/data/pptx/tdf125360.pptx | Bin 0 -> 15379 bytes sd/qa/unit/data/pptx/tdf125360_1.pptx | Bin 0 -> 15480 bytes sd/qa/unit/data/pptx/tdf125360_2.pptx | Bin 0 -> 15213 bytes sd/qa/unit/export-tests-ooxml2.cxx | 76 ++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) create mode 100644 sd/qa/unit/data/pptx/tdf125360.pptx create mode 100644 sd/qa/unit/data/pptx/tdf125360_1.pptx create mode 100644 sd/qa/unit/data/pptx/tdf125360_2.pptx (limited to 'sd') diff --git a/sd/qa/unit/data/pptx/tdf125360.pptx b/sd/qa/unit/data/pptx/tdf125360.pptx new file mode 100644 index 000000000000..c1a3045bc17b Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf125360.pptx differ diff --git a/sd/qa/unit/data/pptx/tdf125360_1.pptx b/sd/qa/unit/data/pptx/tdf125360_1.pptx new file mode 100644 index 000000000000..cfc5798369db Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf125360_1.pptx differ diff --git a/sd/qa/unit/data/pptx/tdf125360_2.pptx b/sd/qa/unit/data/pptx/tdf125360_2.pptx new file mode 100644 index 000000000000..4f6b16455f71 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf125360_2.pptx differ diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 3fd98f4b99bb..bc987a018af2 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -202,6 +202,9 @@ public: void testSmartArtPreserve(); void testTdf125346(); void testTdf125346_2(); + void testTdf125360(); + void testTdf125360_1(); + void testTdf125360_2(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -286,6 +289,9 @@ public: CPPUNIT_TEST(testSmartArtPreserve); CPPUNIT_TEST(testTdf125346); CPPUNIT_TEST(testTdf125346_2); + CPPUNIT_TEST(testTdf125360); + CPPUNIT_TEST(testTdf125360_1); + CPPUNIT_TEST(testTdf125360_2); CPPUNIT_TEST_SUITE_END(); @@ -2242,6 +2248,76 @@ void SdOOXMLExportTest2::testTdf125346_2() xDocShRef->DoClose(); } +void SdOOXMLExportTest2::testTdf125360() +{ + // Check whether the changed fill transparency is exported correctly. + // Color is defined by shape style + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360.pptx"), PPTX); + + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); + + xShape->setPropertyValue("FillTransparence", uno::makeAny(static_cast(23))); + + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + xShape.set( getShapeFromPage( 0, 0, xDocShRef ) ); + + sal_Int32 nTransparence = 0; + xShape->getPropertyValue("FillTransparence") >>= nTransparence; + CPPUNIT_ASSERT_EQUAL(static_cast(23), nTransparence); + + xDocShRef->DoClose(); +} + +void SdOOXMLExportTest2::testTdf125360_1() +{ + // Check whether the changed fill transparency is exported correctly. + // Color is defined by color scheme + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360_1.pptx"), PPTX); + + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); + + xShape->setPropertyValue("FillTransparence", uno::makeAny(static_cast(23))); + + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + xShape.set( getShapeFromPage( 0, 0, xDocShRef ) ); + + sal_Int32 nTransparence = 0; + xShape->getPropertyValue("FillTransparence") >>= nTransparence; + CPPUNIT_ASSERT_EQUAL(static_cast(23), nTransparence); + + xDocShRef->DoClose(); +} + +void SdOOXMLExportTest2::testTdf125360_2() +{ + // Check whether the changed fill transparency is exported correctly. + // Color is defined by color scheme with a transparency + ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125360_2.pptx"), PPTX); + + uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) ); + + sal_Int32 nTransparence = 0; + xShape->getPropertyValue("FillTransparence") >>= nTransparence; + CPPUNIT_ASSERT_EQUAL(static_cast(82), nTransparence); + + xShape->setPropertyValue("FillTransparence", uno::makeAny(static_cast(23))); + + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + + xShape.set( getShapeFromPage( 0, 0, xDocShRef ) ); + + nTransparence = 0; + xShape->getPropertyValue("FillTransparence") >>= nTransparence; + CPPUNIT_ASSERT_EQUAL(static_cast(23), nTransparence); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); -- cgit v1.2.3