chart2/qa/extras/chart2export3.cxx | 8 ++++++-- oox/source/drawingml/fillproperties.cxx | 4 ++-- sd/qa/unit/data/pptx/tdf154858.pptx |binary sd/qa/unit/import-tests.cxx | 10 ++++++++++ 4 files changed, 18 insertions(+), 4 deletions(-)
New commits: commit 65439ab2c4fc87e7cc115710a605e9f35dfb39d8 Author: Balazs Varga <balazs.varga.ext...@allotropia.de> AuthorDate: Tue Apr 8 10:58:34 2025 +0200 Commit: Balazs Varga <balazs.varga.ext...@allotropia.de> CommitDate: Thu Apr 10 12:43:35 2025 +0200 tdf#154858 - FILEOPEN PPTX: fix Radial gradient in shape imported as a Linear gradient XML_circle gradients should be always imported as GradientStyle_RADIAL. Regression from: 898e4ae1364e76af8be22183ac64d73b6a6d8d90 Change-Id: I8166a2afd3dadce61c742eeb0a55a0c8a8b9ada6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183836 Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de> Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de> diff --git a/chart2/qa/extras/chart2export3.cxx b/chart2/qa/extras/chart2export3.cxx index f3cf492c85a5..c77cd3923ac2 100644 --- a/chart2/qa/extras/chart2export3.cxx +++ b/chart2/qa/extras/chart2export3.cxx @@ -141,9 +141,13 @@ CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testRadialColorGradientDOCX) xmlDocUniquePtr pXmlDoc = parseExport(u"word/charts/chart1.xml"_ustr); CPPUNIT_ASSERT(pXmlDoc); // Test the gradient style (if there is no 'a:path' attribute, it is a linear gradient) - assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path", 0); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:path", "path", u"circle"); // Test the linear gradient angle - assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:lin", "ang", u"13500000"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:gsLst/a:gs[1]", "pos", u"0"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:gsLst/a:gs[1]/a:srgbClr", "val", u"ffffff"); + + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:gsLst/a:gs[2]", "pos", u"100000"); + assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:spPr/a:gradFill/a:gsLst/a:gs[2]/a:srgbClr", "val", u"5b9bd5"); } CPPUNIT_TEST_FIXTURE(Chart2ExportTest3, testBarChartDataPointPropDOCX) diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index b75dfed5aac8..a3a1957ca187 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -525,8 +525,8 @@ void FillProperties::pushToPropMap(ShapePropertyMap& rPropMap, const GraphicHelp aGradient.SetAngle( Degree10(1350) ); else if( 0 == aGradient.GetXOffset() && 0 == aGradient.GetYOffset() ) aGradient.SetAngle( Degree10(2250) ); - else - aGradient.SetGradientStyle(awt::GradientStyle_RADIAL); + + aGradient.SetGradientStyle(awt::GradientStyle_RADIAL); } else { diff --git a/sd/qa/unit/data/pptx/tdf154858.pptx b/sd/qa/unit/data/pptx/tdf154858.pptx new file mode 100644 index 000000000000..e4508d9785de Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf154858.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 41beb185e0c6..c5d5117f5bab 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -35,6 +35,7 @@ #include <sax/tools/converter.hxx> #include <com/sun/star/awt/Gradient.hpp> +#include <com/sun/star/awt/Gradient2.hpp> #include <com/sun/star/awt/FontWeight.hpp> #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/document/XEventsSupplier.hpp> @@ -357,6 +358,15 @@ CPPUNIT_TEST_FIXTURE(SdImportTest, testTdf154363) } } +CPPUNIT_TEST_FIXTURE(SdImportTest, testTdf154858) +{ + createSdImpressDoc("pptx/tdf154858.pptx"); + uno::Reference<beans::XPropertySet> xShapeProp(getShapeFromPage(0, 0), uno::UNO_SET_THROW); + awt::Gradient2 aGradient; + CPPUNIT_ASSERT(xShapeProp->getPropertyValue(u"FillGradient"_ustr) >>= aGradient); + CPPUNIT_ASSERT_EQUAL(awt::GradientStyle_RADIAL, aGradient.Style); +} + CPPUNIT_TEST_FIXTURE(SdImportTest, testTdf153466) { createSdImpressDoc("pptx/tdf153466.pptx");