oox/qa/unit/data/tdf163803_image_with_fill.pptx |binary
 oox/qa/unit/export.cxx                          |   16 ++++++++++++++++
 oox/source/export/shapes.cxx                    |    1 +
 3 files changed, 17 insertions(+)

New commits:
commit a1941942267a8c2b5c14f926831aaa8072cf8fcb
Author:     Jaume Pujantell <jaume.pujant...@collabora.com>
AuthorDate: Thu Nov 7 12:52:31 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Nov 11 09:19:10 2024 +0100

    tdf#163803 oox: export fill on graphic object
    
    The fill contents of a graphic object are lost when saving a pptx.
    
    Change-Id: I055d778d4a92de18dfec59bd27c63a20c08b99f3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176208
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    (cherry picked from commit dfd8caa6c49bd33f549a37d6c0244e4cce8f16d8)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176224
    Reviewed-by: Jaume Pujantell <jaume.pujant...@collabora.com>
    Tested-by: Jenkins
    (cherry picked from commit 5ff283e3b841230a45715e48a251c3c4216d1cec)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176233

diff --git a/oox/qa/unit/data/tdf163803_image_with_fill.pptx 
b/oox/qa/unit/data/tdf163803_image_with_fill.pptx
new file mode 100644
index 000000000000..db45264fb304
Binary files /dev/null and b/oox/qa/unit/data/tdf163803_image_with_fill.pptx 
differ
diff --git a/oox/qa/unit/export.cxx b/oox/qa/unit/export.cxx
index 36ab2a4acfa5..26a7a88499c6 100644
--- a/oox/qa/unit/export.cxx
+++ b/oox/qa/unit/export.cxx
@@ -1443,6 +1443,22 @@ CPPUNIT_TEST_FIXTURE(Test, 
testTdf134401_ExportAutoGrowToTextWordWrap)
     assertXPathNoAttribute(pXmlDoc, "//p:sp[1]/p:txBody/a:bodyPr"_ostr, 
"wrap"_ostr);
     assertXPath(pXmlDoc, "//p:sp[2]/p:txBody/a:bodyPr"_ostr, "wrap"_ostr, 
u"none"_ustr);
 }
+
+CPPUNIT_TEST_FIXTURE(Test, testTdf163803_ImageFill)
+{
+    loadFromFile(u"tdf163803_image_with_fill.pptx");
+    save(u"Impress Office Open XML"_ustr);
+
+    xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr);
+    // Check that the fill color is saved:
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 1
+    // - Actual  : 0
+    // - In <>, XPath '//p:pic/p:spPr/a:solidFill' number of nodes is incorrect
+    // i.e. the <a:solidFill> element was not written.
+    assertXPath(pXmlDoc, "//p:pic/p:spPr/a:solidFill"_ostr);
+    assertXPath(pXmlDoc, "//p:pic/p:spPr/a:solidFill/a:srgbClr"_ostr, 
"val"_ostr, u"000000"_ustr);
+}
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 82a060143950..35541bb3c721 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1469,6 +1469,7 @@ void ShapeExport::WriteGraphicObjectShapePart( const 
Reference< XShape >& xShape
     }
     WriteShapeTransformation( xShape, XML_a, bFlipH, false, false, false, true 
);
     WritePresetShape( "rect"_ostr );
+    WriteFill(xShapeProps);
     // graphic object can come with the frame (bnc#654525)
     WriteOutline( xShapeProps );
 

Reply via email to