diff options
author | Sarper Akdemir <sarper.akdemir@collabora.com> | 2022-09-16 03:46:45 +0300 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-09-27 17:17:35 +0200 |
commit | 2f0fefd0c19234814b69e73306d5e2ac46b7311a (patch) | |
tree | fb374c2f6136b95f5a72523eb8075c26d31b87a6 /sd | |
parent | fb3597932ad9322feb58115528ca1dae070edfa5 (diff) |
tdf#94122 pptx export: fix automatic text color export
MS Powerpoint doesn't have automatic colors unlike Word or Excel.
Therefore on export the automatic text color should be first resolved
and then exported.
Change-Id: Ied2c3a4235da403350d8518a3414ff6a372b57a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140059
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140216
(cherry picked from commit c544caf08b8809272aaced1186997292b74da575)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140603
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/odp/tdf94122_autocolor.odp | bin | 0 -> 13942 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml3.cxx | 42 |
2 files changed, 42 insertions, 0 deletions
diff --git a/sd/qa/unit/data/odp/tdf94122_autocolor.odp b/sd/qa/unit/data/odp/tdf94122_autocolor.odp Binary files differnew file mode 100644 index 000000000000..921533cbead6 --- /dev/null +++ b/sd/qa/unit/data/odp/tdf94122_autocolor.odp diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index f0fb87479ea9..8655866b9e7b 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -133,6 +133,7 @@ public: void testTdf109169_OctagonBevel(); void testTdf109169_DiamondBevel(); void testTdf144092_emptyShapeTextProps(); + void testTdf94122_autoColor(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest3); @@ -213,6 +214,7 @@ public: CPPUNIT_TEST(testTdf109169_OctagonBevel); CPPUNIT_TEST(testTdf109169_DiamondBevel); CPPUNIT_TEST(testTdf144092_emptyShapeTextProps); + CPPUNIT_TEST(testTdf94122_autoColor); CPPUNIT_TEST_SUITE_END(); virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override @@ -2020,6 +2022,46 @@ void SdOOXMLExportTest3::testTdf144092_emptyShapeTextProps() xDocShRef->DoClose(); } +void SdOOXMLExportTest3::testTdf94122_autoColor() +{ + // Document contains three pages, with different scenarios for automatic + // color export to pptx. + // - First page: Page background light, automatic colored text on a FillType_NONE shape + // - Second page: Page background dark, automatic colored text on a FillType_NONE shape + // - Third page: Page background light, automatic colored text on a dark colored fill + // and another automatic colored text on a light colored fill + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/odp/tdf94122_autocolor.odp"), ODP); + + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + xDocShRef->DoClose(); + + // Without the accompanying fix in place, these tests would have failed with: + // - Expected: 1 + // - Actual : 0 + // - In ..., XPath '/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr' number of nodes is incorrect + // i.e. automatic color wasn't resolved & exported + + xmlDocUniquePtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml"); + assertXPath(pXmlDocContent1, + "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr", "val", + "000000"); + + xmlDocUniquePtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml"); + assertXPath(pXmlDocContent2, + "/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr", "val", + "ffffff"); + + xmlDocUniquePtr pXmlDocContent3 = parseExport(tempFile, "ppt/slides/slide3.xml"); + assertXPath(pXmlDocContent3, + "/p:sld/p:cSld/p:spTree/p:sp[1]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr", + "val", "ffffff"); + assertXPath(pXmlDocContent3, + "/p:sld/p:cSld/p:spTree/p:sp[2]/p:txBody/a:p/a:r/a:rPr/a:solidFill/a:srgbClr", + "val", "000000"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest3); CPPUNIT_PLUGIN_IMPLEMENT(); |