diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-18 16:50:36 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-07-26 07:53:46 +0200 |
commit | fcb8ce2ffab3ee36558f05cfee39cc0acfa5be11 (patch) | |
tree | 78d1a0f831f9892cd1805ee01a0471067328e3ac /svgio | |
parent | d018d6bb5b87224353b2056536abb84ad08ba028 (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>
(cherry picked from commit 67c422585db43e30f0c9e4c9753fcd14f87a277f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137179
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137180
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'svgio')
-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 7fe6bad3b6bd..8dc8a3989a08 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(); @@ -78,6 +79,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); @@ -185,6 +187,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(comphelper::sequenceToContainer<Primitive2DContainer>(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 b505a7500dc0..2d19c6a84547 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) { } |