svgio/qa/cppunit/SvgImportTest.cxx       |   19 +++++++++++++++++++
 svgio/qa/cppunit/data/symbol.svg         |   11 +++++++++++
 svgio/source/svgreader/svgsymbolnode.cxx |    2 +-
 3 files changed, 31 insertions(+), 1 deletion(-)

New commits:
commit 0c904da364e033d2c228ce835a72a943fa15d72f
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Mon Jul 18 16:50:36 2022 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Tue Jul 19 11:42:44 2022 +0200

    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 <xiscofa...@libreoffice.org>
    (cherry picked from commit 67c422585db43e30f0c9e4c9753fcd14f87a277f)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137179
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>
    Signed-off-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137180
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

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)
         {
         }

Reply via email to