summaryrefslogtreecommitdiff
path: root/svgio/qa
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-08-10 14:58:28 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-08-11 13:03:06 +0200
commitcad5220c707ab7483e9146182e3353146ae24d41 (patch)
tree96453f19ca43532af43598fc490a3e59a7eb7e57 /svgio/qa
parent600780e9904958bf91585d5e232e0cfa0c95827a (diff)
tdf#150323: also add markers if there is a css style parent
Change-Id: Ia900726ee31b7b19e98122d40b33581c9a60dcc7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138090 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx24
-rw-r--r--svgio/qa/cppunit/data/markerInCssStyle.svg14
2 files changed, 38 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 8037f850768a..7db9c8335b1f 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -47,6 +47,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
void testFontsizeRelative();
void testMarkerOrient();
void testMarkerInPresentation();
+ void testMarkerInCssStyle();
void testTdf45771();
void testTdf97941();
void testTdf104339();
@@ -94,6 +95,7 @@ public:
CPPUNIT_TEST(testFontsizeRelative);
CPPUNIT_TEST(testMarkerOrient);
CPPUNIT_TEST(testMarkerInPresentation);
+ CPPUNIT_TEST(testMarkerInCssStyle);
CPPUNIT_TEST(testTdf45771);
CPPUNIT_TEST(testTdf97941);
CPPUNIT_TEST(testTdf104339);
@@ -394,6 +396,28 @@ void Test::testMarkerInPresentation()
assertXPath(pDocument, "/primitive2D/transform/transform/transform", 0);
}
+void Test::testMarkerInCssStyle()
+{
+ Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/markerInCssStyle.svg");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
+
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
+
+ CPPUNIT_ASSERT (pDocument);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 20
+ // - Actual : 0
+ assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", 20);
+
+ assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "color", "#008000");
+ assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "width", "1");
+ assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "linejoin", "Miter");
+ assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "miterangle", "28");
+ assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "linecap", "BUTT");
+}
+
void Test::testTdf45771()
{
//Check text fontsize when using relative units
diff --git a/svgio/qa/cppunit/data/markerInCssStyle.svg b/svgio/qa/cppunit/data/markerInCssStyle.svg
new file mode 100644
index 000000000000..a7a8374f6ee3
--- /dev/null
+++ b/svgio/qa/cppunit/data/markerInCssStyle.svg
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<defs>
+<marker style="overflow:visible;" id="bip" refX="0" refY="0" orient="auto">
+ <path style="stroke: green" d="M 0,-3 v 6" />
+</marker>
+</defs>
+
+<style>
+path.boundary {stroke: red; fill: #ccc; stroke-width: 3; marker-mid: url(#bip); marker-end: url(#bip)}
+</style>
+
+<path class="boundary" d="m 20,20 v 90 90 90 90 90 h 90 90 90 90 90 v -90 -90 -90 -90 -90 h -90 -90 -90 -90 z" />
+</svg>