summaryrefslogtreecommitdiff
path: root/svgio/qa/cppunit
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-06-26 19:15:03 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-06-26 22:45:12 +0200
commit930eb99a712a3ad9b76e9edb68bbcea68af36656 (patch)
tree66829fb3b3486e044a42ccf1076196bd1f2ba373 /svgio/qa/cppunit
parent897fce4abd0c731bf697ca1e38a8049f66f9ac7c (diff)
tdf#156038, tdf#78232: support css child combinator
Change-Id: I874c368f66db97017357030867f1255551996228 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153626 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa/cppunit')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx24
-rw-r--r--svgio/qa/cppunit/data/tdf156038.svg34
2 files changed, 58 insertions, 0 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index abef91413077..7607a5593256 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -344,6 +344,30 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf156034)
assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]", "color", "#008000");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf156038)
+{
+ Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156038.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/polypolygoncolor[1]", "color", "#0000ff");
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: #008000
+ // - Actual : #0000ff
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", "#008000");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", "#0000ff");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]", "color", "#008000");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]", "color", "#0000ff");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]", "color", "#008000");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]", "color", "#0000ff");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]", "color", "#008000");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf156018)
{
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf156018.svg");
diff --git a/svgio/qa/cppunit/data/tdf156038.svg b/svgio/qa/cppunit/data/tdf156038.svg
new file mode 100644
index 000000000000..9835453e7fdd
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf156038.svg
@@ -0,0 +1,34 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-0 0 800 800">
+
+ <style>
+ .g1 > rect {fill:green;}
+ #g3 > rect {fill:green;}
+ .g4 > #r1 {fill:green;}
+ #g3 > .r5 {fill:green;}
+ </style>
+
+ <g class="g4 g1">
+ <g class="g2">
+ <rect x="0" y="0" height="50" width="50" fill="blue"></rect>
+ </g>
+ <rect x="60" y="0" height="50" width="50" fill="blue"></rect>
+ </g>
+ <g id="g3">
+ <g id="g4">
+ <rect x="120" y="0" height="50" width="50" fill="blue"></rect>
+ </g>
+ <rect x="180" y="0" height="50" width="50" fill="blue"></rect>
+ </g>
+ <g class="g4 g1">
+ <g>
+ <rect id="r1" x="240" y="0" height="50" width="50" fill="blue"></rect>
+ </g>
+ <rect id="r1" x="300" y="0" height="50" width="50" fill="blue"></rect>
+ </g>
+ <g id="g3">
+ <g id="g4">
+ <rect class="r5" x="360" y="0" height="50" width="50" fill="blue"></rect>
+ </g>
+ <rect class="r5" x="420" y="0" height="50" width="50" fill="blue"></rect>
+ </g>
+</svg>