svgio/qa/cppunit/SvgImportTest.cxx |   18 ++++++++++++++++++
 svgio/qa/cppunit/data/FillRule.svg |    6 ++++++
 2 files changed, 24 insertions(+)

New commits:
commit 9507e96153cea750c6582f05a98af174270bdf33
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Jul 28 17:27:41 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Jul 29 02:32:03 2022 +0200

    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 <xiscofa...@libreoffice.org>

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>
+

Reply via email to