summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-03-06 14:41:15 +0100
committerXisco FaulĂ­ <anistenis@gmail.com>2016-03-07 08:47:40 +0000
commit3c465c259c617e30b01c5ea25b5203a605cd4269 (patch)
tree31a96d5a2b2601ad6433aca1f03dc1756abf2af7
parent19f2b99b90f522a4a0cecdd06d0e3e6360737b34 (diff)
tdf#97538: SVGIO: Add unittest
Change-Id: I5bf523ac532ad19a005d99e19deb1e0ec9ce96e4 Reviewed-on: https://gerrit.libreoffice.org/22955 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Xisco FaulĂ­ <anistenis@gmail.com>
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx36
-rw-r--r--svgio/qa/cppunit/data/tdf97538.svg10
2 files changed, 46 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 3b0c7729ea38..f560816a1830 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 000000000000..ef2936e5d62b
--- /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>