summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-09-26 16:51:17 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-09-26 21:53:32 +0200
commitee9b13668cf955d2f3ad927f26bf3e1910779047 (patch)
treeaa1efcf47b93e106ac57bf70bbb15fb75dd335c5 /svgio
parent96aba2de78ffa641f6c0c898b99158715b2f2703 (diff)
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>
Diffstat (limited to 'svgio')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx24
-rw-r--r--svgio/qa/cppunit/data/tdf97710.svg8
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx3
3 files changed, 33 insertions, 2 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index b337418dbdec..fcd76f12bd1f 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -1450,6 +1450,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 000000000000..bbd9a91a9b8e
--- /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 4ed60d297e4f..869b071dade7 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())
{