summaryrefslogtreecommitdiff
path: root/svgio/qa
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-07-18 16:50:36 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-07-18 21:59:29 +0200
commit67c422585db43e30f0c9e4c9753fcd14f87a277f (patch)
treebe58ee4a31b8dabe4591a5a7d35e657e3b8b384a /svgio/qa
parent5eb4c5e93b0f0a3fd9cded5e086086d07cb7c92d (diff)
tdf#126330: use correct type for symbol node
Change-Id: Ibd4b7e021dac28469cb3ea2d30e79de8f24c88be Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137201 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx19
-rw-r--r--svgio/qa/cppunit/data/symbol.svg11
2 files changed, 30 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 4724b3a6c8eb..97ee9aa35351 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -40,6 +40,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
void checkRectPrimitive(Primitive2DSequence const & rPrimitive);
void testStyles();
+ void testSymbol();
void testTdf87309();
void testFontsizeKeywords();
void testFontsizePercentage();
@@ -83,6 +84,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
public:
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testStyles);
+ CPPUNIT_TEST(testSymbol);
CPPUNIT_TEST(testTdf87309);
CPPUNIT_TEST(testFontsizeKeywords);
CPPUNIT_TEST(testFontsizePercentage);
@@ -198,6 +200,23 @@ void Test::testStyles()
CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect, aSequenceRectWithStylesByGroup));
}
+void Test::testSymbol()
+{
+ Primitive2DSequence aSequenceTdf87309 = parseSvg(u"/svgio/qa/cppunit/data/symbol.svg");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf87309.getLength()));
+
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequenceTdf87309);
+
+ CPPUNIT_ASSERT (pDocument);
+
+ // tdf#126330: Without the fix in place, this test would have failed with
+ // - Expected: 1
+ // - Actual : 2
+ // number of nodes is incorrect
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#00d000");
+}
+
void Test::testTdf87309()
{
Primitive2DSequence aSequenceTdf87309 = parseSvg(u"/svgio/qa/cppunit/data/tdf87309.svg");
diff --git a/svgio/qa/cppunit/data/symbol.svg b/svgio/qa/cppunit/data/symbol.svg
new file mode 100644
index 000000000000..55110f3740b0
--- /dev/null
+++ b/svgio/qa/cppunit/data/symbol.svg
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<svg width="120" height="120"
+ viewPort="0 0 120 120" version="1.1"
+ xmlns="http://www.w3.org/2000/svg">
+
+ <symbol>
+ <rect x="10" y="10" width="100" height="100" fill="red"/>
+ </symbol>
+
+ <rect x="10" y="10" width="10" height="10" fill="#00D000"/>
+</svg>