summaryrefslogtreecommitdiff
path: root/sd/qa/unit
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir@collabora.com>2022-09-16 03:46:45 +0300
committerMiklos Vajna <vmiklos@collabora.com>2022-09-20 08:23:01 +0200
commit79ea27ec4418b82af5ba2187ae59cd9c0874060b (patch)
tree0caf110afeaf4663b41018e6bd33581e05ab3c70 /sd/qa/unit
parent5a6914af4678a24c794055ba23dd9cf0857f0254 (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>
Diffstat (limited to 'sd/qa/unit')
-rw-r--r--sd/qa/unit/data/odp/tdf94122_autocolor.odpbin0 -> 13942 bytes
-rw-r--r--sd/qa/unit/export-tests-ooxml3.cxx42
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
new file mode 100644
index 000000000000..921533cbead6
--- /dev/null
+++ b/sd/qa/unit/data/odp/tdf94122_autocolor.odp
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx
index dd79bb47f6a7..c12a1f0ec4bd 100644
--- a/sd/qa/unit/export-tests-ooxml3.cxx
+++ b/sd/qa/unit/export-tests-ooxml3.cxx
@@ -121,6 +121,7 @@ public:
void testTdf144092_emptyShapeTextProps();
void testTdf149551_tbrl90();
void testTdf149551_btlr();
+ void testTdf94122_autoColor();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest3);
@@ -207,6 +208,7 @@ public:
CPPUNIT_TEST(testTdf144092_emptyShapeTextProps);
CPPUNIT_TEST(testTdf149551_tbrl90);
CPPUNIT_TEST(testTdf149551_btlr);
+ CPPUNIT_TEST(testTdf94122_autoColor);
CPPUNIT_TEST_SUITE_END();
virtual void registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) override
@@ -2218,6 +2220,46 @@ void SdOOXMLExportTest3::testTdf149551_btlr()
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();