diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-08 11:54:40 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-07-08 13:33:45 +0200 |
commit | 6dd0074e5e42467a7f82e363f67ca95d04466fa9 (patch) | |
tree | 1d49fbcd2db125036c6b422ffbad4c6acb5916fe /svgio/qa | |
parent | a4acae686c2c55b18b5c27e832827d3c2d8e0f63 (diff) |
tdf#149913: add support for auto-start-reverse
See https://svgwg.org/svg2-draft/painting.html#OrientAttribute
Change-Id: Iedcca7bc79a54333c0f80927364caec82ce61167
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136894
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa')
-rw-r--r-- | svgio/qa/cppunit/SvgImportTest.cxx | 33 | ||||
-rw-r--r-- | svgio/qa/cppunit/data/MarkerOrient.svg | 22 |
2 files changed, 55 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 060c18478aae..1ce9b2e0fbfe 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -44,6 +44,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void testFontsizeKeywords(); void testFontsizePercentage(); void testFontsizeRelative(); + void testMarkerOrient(); void testTdf45771(); void testTdf97941(); void testTdf104339(); @@ -83,6 +84,7 @@ public: CPPUNIT_TEST(testFontsizeKeywords); CPPUNIT_TEST(testFontsizePercentage); CPPUNIT_TEST(testFontsizeRelative); + CPPUNIT_TEST(testMarkerOrient); CPPUNIT_TEST(testTdf45771); CPPUNIT_TEST(testTdf97941); CPPUNIT_TEST(testTdf104339); @@ -310,6 +312,37 @@ void Test::testFontsizeRelative() assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "familyname", "serif"); } +void Test::testMarkerOrient() +{ + Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/MarkerOrient.svg"); + CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength())); + + drawinglayer::Primitive2dXmlDump dumper; + xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy11", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy12", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy13", "7"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy21", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy22", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy23", "13"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy31", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy32", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy33", "1"); + + assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy11", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy12", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy13", "87"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy21", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy22", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy23", "87"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy31", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy32", "0"); + assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy33", "1"); +} + void Test::testTdf45771() { //Check text fontsize when using relative units diff --git a/svgio/qa/cppunit/data/MarkerOrient.svg b/svgio/qa/cppunit/data/MarkerOrient.svg new file mode 100644 index 000000000000..7997e1cce94f --- /dev/null +++ b/svgio/qa/cppunit/data/MarkerOrient.svg @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> + <defs> + <!-- arrowhead marker definition --> + <marker id="arrow" viewBox="0 0 10 10" refX="5" refY="5" + markerWidth="6" markerHeight="6" + orient="auto-start-reverse"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + + <marker id="arrow2" viewBox="0 0 10 10" refX="5" refY="5" + markerWidth="6" markerHeight="6" + orient="auto-start-reverse"> + <path d="M 0 0 L 10 5 L 0 10 z" /> + </marker> + + </defs> + + <!-- Coordinate axes with a arrowhead in both direction --> + <polyline points="10,10 10,90 90,90" fill="none" stroke="black" + marker-start="url(#arrow)" marker-end="url(#arrow2)" /> +</svg> |