diff options
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/inc/svgnode.hxx | 2 | ||||
-rw-r--r-- | svgio/inc/svgtextnode.hxx | 2 | ||||
-rw-r--r-- | svgio/inc/svgtspannode.hxx | 2 | ||||
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 20 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/em_units.svg | 14 | ||||
-rw-r--r-- | svgio/source/svgreader/svgtextnode.cxx | 4 |
6 files changed, 36 insertions, 8 deletions
diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx index 63c6b2318406..58b1682506f2 100644 --- a/svgio/inc/svgnode.hxx +++ b/svgio/inc/svgnode.hxx @@ -159,7 +159,7 @@ namespace svgio::svgreader virtual double getCurrentFontSizeInherited() const override; virtual double getCurrentXHeightInherited() const override; - virtual double getCurrentFontSize() const; + double getCurrentFontSize() const; double getCurrentXHeight() const; /// Id access diff --git a/svgio/inc/svgtextnode.hxx b/svgio/inc/svgtextnode.hxx index b72d1043b8c0..37983ad31531 100644 --- a/svgio/inc/svgtextnode.hxx +++ b/svgio/inc/svgtextnode.hxx @@ -58,8 +58,6 @@ namespace svgio::svgreader virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; virtual void decomposeSvgNode(drawinglayer::primitive2d::Primitive2DContainer& rTarget, bool bReferenced) const override; - virtual double getCurrentFontSize() const override; - /// transform content, set if found in current context const std::optional<basegfx::B2DHomMatrix>& getTransform() const { return mpaTransform; } void setTransform(const std::optional<basegfx::B2DHomMatrix>& pMatrix) { mpaTransform = pMatrix; } diff --git a/svgio/inc/svgtspannode.hxx b/svgio/inc/svgtspannode.hxx index af4ae8268b5c..10a7b7ee16a9 100644 --- a/svgio/inc/svgtspannode.hxx +++ b/svgio/inc/svgtspannode.hxx @@ -42,7 +42,7 @@ namespace svgio::svgreader virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; - virtual double getCurrentFontSize() const override; + double getCurrentFontSize() const; /// access to SvgTextPositions const SvgTextPositions& getSvgTextPositions() const { return maSvgTextPositions; } diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index a46285ee7f64..cba534bfc5a5 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -70,6 +70,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void testTdf101237(); void testTdf94765(); void testBehaviourWhenWidthAndHeightIsOrIsNotSet(); + void testTdf97663(); Primitive2DSequence parseSvg(std::u16string_view aSource); @@ -105,6 +106,7 @@ public: CPPUNIT_TEST(testTdf101237); CPPUNIT_TEST(testTdf94765); CPPUNIT_TEST(testBehaviourWhenWidthAndHeightIsOrIsNotSet); + CPPUNIT_TEST(testTdf97663); CPPUNIT_TEST_SUITE_END(); }; @@ -808,6 +810,24 @@ void Test::testBehaviourWhenWidthAndHeightIsOrIsNotSet() } } +void Test::testTdf97663() +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/em_units.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + // This can be dumped to a file using dumper.dump(container, file_url) + Primitive2DContainer container = comphelper::sequenceToContainer<Primitive2DContainer>(aSequence); + xmlDocUniquePtr pDocument = dumper.dumpAndParse(container); + + CPPUNIT_ASSERT (pDocument); + + // tdf#97663: Without the fix in place, this test would have failed with + // - Expected: 236 + // - Actual : 204 + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", "236"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } diff --git a/svgio/qa/cppunit/data/em_units.svg b/svgio/qa/cppunit/data/em_units.svg new file mode 100644 index 000000000000..1ad4d3e3a769 --- /dev/null +++ b/svgio/qa/cppunit/data/em_units.svg @@ -0,0 +1,14 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="10cm" height="10cm"> + + <style> + text {font-family: sans-serif; font-size: 36pt;} + new {font-family: sans-serif; font-size: 1em;} + </style> + + <line x1="5cm" y1="5cm" x2="8cm" y2="5cm" stroke="black" /> + <!-- 0.5in = 1.27cm = 36pt !--> + <line x1="5cm" y1="6.27cm" x2="8cm" y2="6.27cm" stroke="black" /> + <text x="5cm" y="5cm" class="new">AWlll<tspan x="5cm" dy="1em">AWlll</tspan> + </text> +</svg> + diff --git a/svgio/source/svgreader/svgtextnode.cxx b/svgio/source/svgreader/svgtextnode.cxx index 25ad066e9bbc..a7c8cae8b8ce 100644 --- a/svgio/source/svgreader/svgtextnode.cxx +++ b/svgio/source/svgreader/svgtextnode.cxx @@ -255,10 +255,6 @@ namespace svgio::svgreader } } - double SvgTextNode::getCurrentFontSize() const - { - return getCurrentFontSizeInherited(); - } } // end of namespace svgio::svgreader /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |