summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx24
-rw-r--r--svgio/qa/cppunit/data/FontsizeKeywords.svg14
-rw-r--r--test/source/primitive2dxmldump.cxx16
3 files changed, 54 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index d065e0f34f1c..be071dd5e85c 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 testStyles();
void testTdf87309();
+ void testFontsizeKeywords();
Primitive2DSequence parseSvg(const char* aSource);
@@ -50,6 +51,7 @@ public:
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testStyles);
CPPUNIT_TEST(testTdf87309);
+ CPPUNIT_TEST(testFontsizeKeywords);
CPPUNIT_TEST_SUITE_END();
};
@@ -150,6 +152,28 @@ void Test::testTdf87309()
assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#000000");
}
+void Test::testFontsizeKeywords()
+{
+ Primitive2DSequence aSequenceFontsizeKeywords = parseSvg("/svgio/qa/cppunit/data/FontsizeKeywords.svg");
+ CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceFontsizeKeywords.getLength());
+
+ Primitive2dXmlDump dumper;
+ xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceFontsizeKeywords));
+
+ CPPUNIT_ASSERT (pDocument);
+
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", "9");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", "11");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", "13");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "height", "16");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "height", "19");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "height", "23");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "height", "27");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "height", "13");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "height", "19");
+ assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]", "height", "16");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}
diff --git a/svgio/qa/cppunit/data/FontsizeKeywords.svg b/svgio/qa/cppunit/data/FontsizeKeywords.svg
new file mode 100644
index 000000000000..c0a5caebdb80
--- /dev/null
+++ b/svgio/qa/cppunit/data/FontsizeKeywords.svg
@@ -0,0 +1,14 @@
+<?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="15" font-size="xx-small">Sample</text>
+<text x="5" y="50" font-size="x-small">Sample</text>
+<text x="5" y="100" font-size="small">Sample</text>
+<text x="5" y="150" font-size="medium">Sample</text>
+<text x="5" y="200" font-size="large">Sample</text>
+<text x="5" y="250" font-size="x-large">Sample</text>
+<text x="5" y="300" font-size="xx-large">Sample</text>
+<text x="5" y="350" font-size="smaller">Sample</text>
+<text x="5" y="400" font-size="larger">Sample</text>
+<text x="5" y="450" font-size="initial">Sample</text>
+</svg>
diff --git a/test/source/primitive2dxmldump.cxx b/test/source/primitive2dxmldump.cxx
index 4a996777fb80..940dea0fdab4 100644
--- a/test/source/primitive2dxmldump.cxx
+++ b/test/source/primitive2dxmldump.cxx
@@ -21,6 +21,7 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
#include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
+#include <drawinglayer/primitive2d/textprimitive2d.hxx>
#include <drawinglayer/attribute/lineattribute.hxx>
@@ -166,6 +167,21 @@ void Primitive2dXmlDump::decomposeAndWrite(
}
break;
+ case PRIMITIVE2D_ID_TEXTSIMPLEPORTIONPRIMITIVE2D:
+ {
+ const TextSimplePortionPrimitive2D* pTextSimplePortionPrimitive2D = dynamic_cast<const TextSimplePortionPrimitive2D*>(pBasePrimitive);
+ rWriter.startElement("textsimpleportion");
+
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ if(pTextSimplePortionPrimitive2D->getTextTransform().decompose(aScale, aTranslate, fRotate, fShearX))
+ {
+ rWriter.attribute("height", aScale.getY());
+ }
+ rWriter.endElement();
+ }
+ break;
+
default:
{
rWriter.element(OUStringToOString(sCurrentElementTag, RTL_TEXTENCODING_UTF8));