summaryrefslogtreecommitdiff
path: root/svgio/qa
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-02-18 01:27:17 +0100
committerNoel Grandin <noelgrandin@gmail.com>2016-02-19 06:28:11 +0000
commit324014c997ab90f5777f772a46e6faf887a00832 (patch)
tree07f8b8ffbbdfeaad39b2466547b68659c422adce /svgio/qa
parent1b374b2a3080a7191c282f891a562962c872893b (diff)
SVGIO: Fix problem when relative font-size depends on its...
... parent's font-size Change-Id: I13943923c401a5a06b3aa51181fd75292534e888 Reviewed-on: https://gerrit.libreoffice.org/22452 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svgio/qa')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx17
-rw-r--r--svgio/qa/cppunit/data/FontsizeRelative.svg5
2 files changed, 22 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 78701880f3eb..e5d2b03414d0 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -42,6 +42,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
void testTdf87309();
void testFontsizeKeywords();
void testFontsizePercentage();
+ void testFontsizeRelative();
void testTdf45771();
void testTdf97941();
void testTdf85770();
@@ -63,6 +64,7 @@ public:
CPPUNIT_TEST(testTdf87309);
CPPUNIT_TEST(testFontsizeKeywords);
CPPUNIT_TEST(testFontsizePercentage);
+ CPPUNIT_TEST(testFontsizeRelative);
CPPUNIT_TEST(testTdf45771);
CPPUNIT_TEST(testTdf97941);
CPPUNIT_TEST(testTdf85770);
@@ -197,6 +199,7 @@ void Test::testFontsizeKeywords()
void Test::testFontsizePercentage()
{
+ //Check when font-size uses percentage and defined globally
Primitive2DSequence aSequenceFontsizePercentage = parseSvg("/svgio/qa/cppunit/data/FontsizePercentage.svg");
CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceFontsizePercentage.getLength());
@@ -208,6 +211,20 @@ void Test::testFontsizePercentage()
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", "16");
}
+void Test::testFontsizeRelative()
+{
+ //Check when font-size uses relative units (em,ex) and it's based on its parent's font-size
+ Primitive2DSequence aSequenceFontsizeRelative = parseSvg("/svgio/qa/cppunit/data/FontsizeRelative.svg");
+ CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceFontsizeRelative.getLength());
+
+ Primitive2dXmlDump dumper;
+ xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizeRelative));
+
+ CPPUNIT_ASSERT (pDocument);
+
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", "50");
+}
+
void Test::testTdf45771()
{
//Check text fontsize when using relative units
diff --git a/svgio/qa/cppunit/data/FontsizeRelative.svg b/svgio/qa/cppunit/data/FontsizeRelative.svg
new file mode 100644
index 000000000000..339e663a5fd1
--- /dev/null
+++ b/svgio/qa/cppunit/data/FontsizeRelative.svg
@@ -0,0 +1,5 @@
+<?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">
+<g font-size="5px">
+ <text x="150" y="150" font-size="10em">Sample</text>
+</g>
+</svg>