diff options
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 19 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/symbol.svg | 11 | ||||
-rw-r--r-- | svgio/source/svgreader/svgsymbolnode.cxx | 2 |
3 files changed, 31 insertions, 1 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> diff --git a/svgio/source/svgreader/svgsymbolnode.cxx b/svgio/source/svgreader/svgsymbolnode.cxx index b92bde34a5fe..196c83a64db4 100644 --- a/svgio/source/svgreader/svgsymbolnode.cxx +++ b/svgio/source/svgreader/svgsymbolnode.cxx @@ -24,7 +24,7 @@ namespace svgio::svgreader SvgSymbolNode::SvgSymbolNode( SvgDocument& rDocument, SvgNode* pParent) - : SvgNode(SVGToken::Svg, rDocument, pParent), + : SvgNode(SVGToken::Symbol, rDocument, pParent), maSvgStyleAttributes(*this) { } |