summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-07-28 17:27:41 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-07-29 02:32:03 +0200
commit9507e96153cea750c6582f05a98af174270bdf33 (patch)
tree1de95c281470e1c61b4c4cfad00b0a1c39c9c600
parentfd428245bf180bb4ecc0486110aeeca091aa8403 (diff)
svgio: qa: add unittest for fill-rule
Change-Id: I76c0594d634c4154bd2b63027e93934b521998d0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137573 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx18
-rw-r--r--svgio/qa/cppunit/data/FillRule.svg6
2 files changed, 24 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index c25ae86cf7f3..f23556ee621c 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -65,6 +65,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
void testClipPathAndStyle();
void testShapeWithClipPath();
void testClipPathUsingClipPath();
+ void testFillRule();
void testi125329();
void testMaskingPath07b();
void test123926();
@@ -110,6 +111,7 @@ public:
CPPUNIT_TEST(testClipPathAndStyle);
CPPUNIT_TEST(testShapeWithClipPath);
CPPUNIT_TEST(testClipPathUsingClipPath);
+ CPPUNIT_TEST(testFillRule);
CPPUNIT_TEST(testi125329);
CPPUNIT_TEST(testMaskingPath07b);
CPPUNIT_TEST(test123926);
@@ -701,6 +703,22 @@ void Test::testClipPathUsingClipPath()
assertXPath(pDocument, "/primitive2D/transform/mask/mask/polypolygon/polygon/point", 13);
}
+void Test::testFillRule()
+{
+ Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/FillRule.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/polypolygoncolor", "color", "#000000");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon/polygon", 2);
+ assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", "#ff0000");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/polypolygon/polygon", 2);
+}
+
void Test::testi125329()
{
//Check style inherit from * css element
diff --git a/svgio/qa/cppunit/data/FillRule.svg b/svgio/qa/cppunit/data/FillRule.svg
new file mode 100644
index 000000000000..c406065fbe09
--- /dev/null
+++ b/svgio/qa/cppunit/data/FillRule.svg
@@ -0,0 +1,6 @@
+<svg viewBox="-10 -10 320 120" xmlns="http://www.w3.org/2000/svg">
+ <path fill-rule="evenodd" stroke="red"
+ d="M110,0 h90 v90 h-90 z
+ M130,20 h50 v50 h-50 z"/>
+</svg>
+