SVGIO: tdf#97941: Don't double tspan fontsize

Same as in 701324a1e1

Change-Id: I531bef4821008ef71951506c133f999b9ab4f4ff
Reviewed-on: https://gerrit.libreoffice.org/22450
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Xisco Faulí <anistenis@gmail.com>
This commit is contained in:
Xisco Fauli 2016-02-18 00:08:13 +01:00 committed by Xisco Faulí
parent 9ecd31fd3f
commit 85c789be1f
4 changed files with 30 additions and 0 deletions

View file

@ -46,6 +46,8 @@ namespace svgio
virtual const SvgStyleAttributes* getSvgStyleAttributes() const override;
virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override;
virtual double getCurrentFontSize() const override;
/// access to SvgTextPositions
const SvgTextPositions& getSvgTextPositions() const { return maSvgTextPositions; }
};

View file

@ -43,6 +43,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
void testFontsizeKeywords();
void testFontsizePercentage();
void testTdf45771();
void testTdf97941();
void testTdf85770();
void testTdf79163();
void testTdf97542_1();
@ -63,6 +64,7 @@ public:
CPPUNIT_TEST(testFontsizeKeywords);
CPPUNIT_TEST(testFontsizePercentage);
CPPUNIT_TEST(testTdf45771);
CPPUNIT_TEST(testTdf97941);
CPPUNIT_TEST(testTdf85770);
CPPUNIT_TEST(testTdf79163);
CPPUNIT_TEST(testTdf97542_1);
@ -208,6 +210,7 @@ void Test::testFontsizePercentage()
void Test::testTdf45771()
{
//Check text fontsize when using relative units
Primitive2DSequence aSequenceTdf45771 = parseSvg("/svgio/qa/cppunit/data/tdf45771.svg");
CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceTdf45771.getLength());
@ -219,6 +222,20 @@ void Test::testTdf45771()
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", "32");
}
void Test::testTdf97941()
{
//Check tspan fontsize when using relative units
Primitive2DSequence aSequenceTdf97941 = parseSvg("/svgio/qa/cppunit/data/tdf97941.svg");
CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceTdf97941.getLength());
Primitive2dXmlDump dumper;
xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf97941));
CPPUNIT_ASSERT (pDocument);
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", "48");
}
void Test::testTdf85770()
{
Primitive2DSequence aSequenceTdf85770 = parseSvg("/svgio/qa/cppunit/data/tdf85770.svg");

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="600" width="400" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<text x="5" y="100">
<tspan font-size="3em">Sample</tspan></text>
</svg>

After

Width:  |  Height:  |  Size: 223 B

View file

@ -68,6 +68,11 @@ namespace svgio
}
}
double SvgTspanNode::getCurrentFontSize() const
{
return getCurrentFontSizeInherited();
}
} // end of namespace svgreader
} // end of namespace svgio