summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-02-18 00:08:13 +0100
committerXisco Faulí <anistenis@gmail.com>2016-02-18 08:39:10 +0000
commit85c789be1f94777b582977e69b16665a47dc364f (patch)
treee17778ccd993f73980b06bb24ced3d82cc721a21
parent9ecd31fd3fda782dd16e88fd99dc9c71361482fe (diff)
SVGIO: tdf#97941: Don't double tspan fontsize
Same as in 701324a1e1f7e0c181ff1a50956ced686785ea53 Change-Id: I531bef4821008ef71951506c133f999b9ab4f4ff Reviewed-on: https://gerrit.libreoffice.org/22450 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Xisco Faulí <anistenis@gmail.com>
-rw-r--r--svgio/inc/svgio/svgreader/svgtspannode.hxx2
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx17
-rw-r--r--svgio/qa/cppunit/data/tdf97941.svg6
-rw-r--r--svgio/source/svgreader/svgtspannode.cxx5
4 files changed, 30 insertions, 0 deletions
diff --git a/svgio/inc/svgio/svgreader/svgtspannode.hxx b/svgio/inc/svgio/svgreader/svgtspannode.hxx
index 53532c65663e..fd906e04f8b3 100644
--- a/svgio/inc/svgio/svgreader/svgtspannode.hxx
+++ b/svgio/inc/svgio/svgreader/svgtspannode.hxx
@@ -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; }
};
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 20305988c3ab..78701880f3eb 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -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");
diff --git a/svgio/qa/cppunit/data/tdf97941.svg b/svgio/qa/cppunit/data/tdf97941.svg
new file mode 100644
index 000000000000..cfe1ca8c475b
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf97941.svg
@@ -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>
diff --git a/svgio/source/svgreader/svgtspannode.cxx b/svgio/source/svgreader/svgtspannode.cxx
index e9307954ad90..962f1c8f145d 100644
--- a/svgio/source/svgreader/svgtspannode.cxx
+++ b/svgio/source/svgreader/svgtspannode.cxx
@@ -68,6 +68,11 @@ namespace svgio
}
}
+ double SvgTspanNode::getCurrentFontSize() const
+ {
+ return getCurrentFontSizeInherited();
+ }
+
} // end of namespace svgreader
} // end of namespace svgio