tdf#97710: do not create nonzero conform for polyline
Change-Id: Ib9d4e957b83ad84b79ae4ade5c6be3ab3d9d8028
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157286
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
(cherry picked from commit 661f2425602f39e4b1e426edf3b13fc8c4fe1f75)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157310
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index e59a92c..a3a554cb 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -1446,6 +1446,30 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf101237)
assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", "5");
}
CPPUNIT_TEST_FIXTURE(Test, testTdf97710)
{
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf97710.svg");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
drawinglayer::Primitive2dXmlDump dumper;
xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequence));
CPPUNIT_ASSERT (pDocument);
assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[1]", "color", "#000000");
// Without the fix in place, this test would have failed with
// - Expected: 100
// - Actual : 0
assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon", "width", "100");
assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon", "height", "100");
assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]", "color", "#008000");
assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon", "width", "100");
assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon", "height", "100");
assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line", "color", "#000000");
assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line", "width", "1");
}
CPPUNIT_TEST_FIXTURE(Test, testTdf94765)
{
Primitive2DSequence aSequenceTdf94765 = parseSvg(u"/svgio/qa/cppunit/data/tdf94765.svg");
diff --git a/svgio/qa/cppunit/data/tdf97710.svg b/svgio/qa/cppunit/data/tdf97710.svg
new file mode 100644
index 0000000..bbd9a91a
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf97710.svg
@@ -0,0 +1,8 @@
<svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg">
<!-- Example of a polyline with the default fill -->
<polyline points="0,100 50,25 50,75 100,0" />
<!-- Example of the same polyline shape with stroke and no fill -->
<polyline points="100,100 150,25 150,75 200,0" fill="green" stroke="black" />
</svg>
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 94209c32..2953f42 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -1127,8 +1127,7 @@ namespace svgio::svgreader
// create fill
basegfx::B2DPolyPolygon aPath(rPath);
if(SVGToken::Path == mrOwner.getType() || SVGToken::Polygon == mrOwner.getType()
|| SVGToken::Polyline == mrOwner.getType())
if(SVGToken::Path == mrOwner.getType() || SVGToken::Polygon == mrOwner.getType())
{
if(FillRule::evenodd != getClipRule() && FillRule::evenodd != getFillRule())
{