summaryrefslogtreecommitdiffstats
path: root/emfio
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2022-06-12 21:51:52 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2022-06-14 10:30:32 +0200
commit7b12c659842eb53b96dd98ecea65c6071506dfbb (patch)
tree02d96f0f5f2e059fd771351a85ea68819c40f55e /emfio
parentFix leak with stock widgets in a dialog from an extension (diff)
downloadcore-7b12c659842eb53b96dd98ecea65c6071506dfbb.tar.gz
core-7b12c659842eb53b96dd98ecea65c6071506dfbb.zip
tdf#131506 tdf#143031 EMF+ Fix displaying PathGradient fill
With previous implementation, the EMF+ import is calculating gradient positions wrongly. It is causing warning: SvgGradientHelper got invalid SvgGradientEntries outside [0.0 .. 1.0] and the gradient was not displayed at all. This patch fixes that and gradient is displayed correctly Change-Id: I6229c516165436d0c7ae187d9eb69b5494da396f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135607 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/qa/cppunit/emf/EmfImportTest.cxx23
-rw-r--r--emfio/qa/cppunit/emf/data/TestEmfPlusBrushPathGradientWithBlendColors.emfbin0 -> 2404 bytes
2 files changed, 23 insertions, 0 deletions
diff --git a/emfio/qa/cppunit/emf/EmfImportTest.cxx b/emfio/qa/cppunit/emf/EmfImportTest.cxx
index cf999c2dff6e..40db85d69d2e 100644
--- a/emfio/qa/cppunit/emf/EmfImportTest.cxx
+++ b/emfio/qa/cppunit/emf/EmfImportTest.cxx
@@ -65,6 +65,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools, public unotest:
void TestSetArcDirection();
void TestDrawPolyLine16WithClip();
void TestFillRegion();
+ void TestEmfPlusBrushPathGradientWithBlendColors();
void TestEmfPlusGetDC();
void TestEmfPlusSave();
void TestEmfPlusDrawPathWithMiterLimit();
@@ -115,6 +116,7 @@ public:
CPPUNIT_TEST(TestSetArcDirection);
CPPUNIT_TEST(TestDrawPolyLine16WithClip);
CPPUNIT_TEST(TestFillRegion);
+ CPPUNIT_TEST(TestEmfPlusBrushPathGradientWithBlendColors);
CPPUNIT_TEST(TestEmfPlusGetDC);
CPPUNIT_TEST(TestEmfPlusSave);
CPPUNIT_TEST(TestEmfPlusDrawPathWithMiterLimit);
@@ -532,6 +534,7 @@ void Test::TestLinearGradient()
assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "width", "15232");
assertXPath(pDocument, aXPathPrefix + "mask/polypolygon", "path", "m0 0h15232v7610h-15232z");
+ assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "spreadmethod", "repeat");
assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "startx", "0");
assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "starty", "-1");
assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]", "endx", "0");
@@ -540,6 +543,8 @@ void Test::TestLinearGradient()
"0.392156862745098");
assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[1]/polypolygon", "path",
"m0 0.216110019646294h7615.75822989746v7610.21611001965h-7615.75822989746z");
+
+ assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "spreadmethod", "repeat");
assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "startx", "-1");
assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "starty", "-1");
assertXPath(pDocument, aXPathPrefix + "mask/svglineargradient[2]", "endx", "0");
@@ -959,6 +964,24 @@ void Test::TestPolylinetoCloseStroke()
assertXPath(pDocument, aXPathPrefix + "polygonhairline[2]", "color", "#000000");
}
+void Test::TestEmfPlusBrushPathGradientWithBlendColors()
+{
+ // tdf#131506 EMF+ records: FillRects, Brush with PathGradient and BlendColor, FillRects
+ Primitive2DSequence aSequence
+ = parseEmf(u"emfio/qa/cppunit/emf/data/TestEmfPlusBrushPathGradientWithBlendColors.emf");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
+ CPPUNIT_ASSERT(pDocument);
+
+ assertXPath(pDocument, aXPathPrefix + "svgradialgradient", "radius", "0.7");
+ assertXPath(pDocument, aXPathPrefix + "svgradialgradient/focalx", 0);
+ assertXPath(pDocument, aXPathPrefix + "svgradialgradient/focaly", 0);
+ assertXPath(pDocument, aXPathPrefix + "svgradialgradient", "startx", "0");
+ assertXPath(pDocument, aXPathPrefix + "svgradialgradient", "starty", "0");
+ assertXPath(pDocument, aXPathPrefix + "svgradialgradient", "spreadmethod", "pad");
+}
+
void Test::TestEmfPlusGetDC()
{
// tdf#147818 EMF+ records: GetDC, DrawPath, FillRects
diff --git a/emfio/qa/cppunit/emf/data/TestEmfPlusBrushPathGradientWithBlendColors.emf b/emfio/qa/cppunit/emf/data/TestEmfPlusBrushPathGradientWithBlendColors.emf
new file mode 100644
index 000000000000..caa9876bd449
--- /dev/null
+++ b/emfio/qa/cppunit/emf/data/TestEmfPlusBrushPathGradientWithBlendColors.emf
Binary files differ