[Libreoffice-commits] core.git: svgio/qa

Xisco Fauli anistenis at gmail.com
Mon Mar 7 08:48:01 UTC 2016


 svgio/qa/cppunit/SvgImportTest.cxx |   36 ++++++++++++++++++++++++++++++++++++
 svgio/qa/cppunit/data/tdf97538.svg |   10 ++++++++++
 2 files changed, 46 insertions(+)

New commits:
commit 3c465c259c617e30b01c5ea25b5203a605cd4269
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Sun Mar 6 14:41:15 2016 +0100

    tdf#97538: SVGIO: Add unittest
    
    Change-Id: I5bf523ac532ad19a005d99e19deb1e0ec9ce96e4
    Reviewed-on: https://gerrit.libreoffice.org/22955
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Xisco FaulĂ­ <anistenis at gmail.com>

diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 3b0c772..f560816 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -53,6 +53,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
     void testRGBColor();
     void testRGBAColor();
     void testTdf97936();
+    void testTdf97538();
 
     Primitive2DSequence parseSvg(const char* aSource);
 
@@ -76,6 +77,7 @@ public:
     CPPUNIT_TEST(testRGBColor);
     CPPUNIT_TEST(testRGBAColor);
     CPPUNIT_TEST(testTdf97936);
+    CPPUNIT_TEST(testTdf97538);
     CPPUNIT_TEST_SUITE_END();
 };
 
@@ -403,6 +405,40 @@ void Test::testTdf97936()
     assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "maxx", "60");
     assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "maxy", "100");
 }
+
+void Test::testTdf97538()
+{
+    // check that both rectangles are rendered in the viewBox
+    Primitive2DSequence aSequenceTdf97538 = parseSvg("/svgio/qa/cppunit/data/tdf97538.svg");
+    CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceTdf97538.getLength());
+
+    Primitive2dXmlDump dumper;
+    xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97538));
+
+    CPPUNIT_ASSERT (pDocument);
+
+    assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygoncolor", "color", "#ff0000");
+    assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygoncolor", "height", "200");
+    assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygoncolor", "width", "199");
+    assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygoncolor", "minx", "145");
+    assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygoncolor", "miny", "-24");
+    assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygoncolor", "maxx", "345");
+    assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygoncolor", "maxy", "175");
+    assertXPath(pDocument, "/primitive2D/transform/transform[2]/polypolygoncolor", "color", "#0000ff");
+    assertXPath(pDocument, "/primitive2D/transform/transform[2]/polypolygoncolor", "height", "200");
+    assertXPath(pDocument, "/primitive2D/transform/transform[2]/polypolygoncolor", "width", "199");
+    assertXPath(pDocument, "/primitive2D/transform/transform[2]/polypolygoncolor", "minx", "145");
+    assertXPath(pDocument, "/primitive2D/transform/transform[2]/polypolygoncolor", "miny", "-24");
+    assertXPath(pDocument, "/primitive2D/transform/transform[2]/polypolygoncolor", "maxx", "345");
+    assertXPath(pDocument, "/primitive2D/transform/transform[2]/polypolygoncolor", "maxy", "175");
+    assertXPath(pDocument, "/primitive2D/transform/transform[3]/polypolygoncolor", "color", "#008000");
+    assertXPath(pDocument, "/primitive2D/transform/transform[3]/polypolygoncolor", "height", "200");
+    assertXPath(pDocument, "/primitive2D/transform/transform[3]/polypolygoncolor", "width", "199");
+    assertXPath(pDocument, "/primitive2D/transform/transform[3]/polypolygoncolor", "minx", "145");
+    assertXPath(pDocument, "/primitive2D/transform/transform[3]/polypolygoncolor", "miny", "-24");
+    assertXPath(pDocument, "/primitive2D/transform/transform[3]/polypolygoncolor", "maxx", "345");
+    assertXPath(pDocument, "/primitive2D/transform/transform[3]/polypolygoncolor", "maxy", "175");
+}
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 }
diff --git a/svgio/qa/cppunit/data/tdf97538.svg b/svgio/qa/cppunit/data/tdf97538.svg
new file mode 100644
index 0000000..ef2936e
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf97538.svg
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" 
+              "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg xmlns="http://www.w3.org/2000/svg">
+  <g>
+    <circle cx="6.5cm" cy="2cm" r="100" style="fill:red; stroke:black; stroke-width:0.1cm" transform="translate(0,50)" />
+    <circle cx="6.5cm" cy="2cm" r="100" style="fill:blue; stroke:black; stroke-width:0.1cm" transform="translate(70,150)" />
+    <circle cx="6.5cm" cy="2cm" r="100" style="fill:green; stroke:black; stroke-width:0.1cm" transform="translate(-70,150)"/>
+  </g>
+</svg>


More information about the Libreoffice-commits mailing list