summaryrefslogtreecommitdiff
path: root/svgio/qa/cppunit
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-06-19 16:17:00 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2023-06-19 23:04:46 +0200
commit08a6ca6d426280f9ce225d9f25694c43e7ab810f (patch)
tree8fd41436b5d8a963c64f0b818d59fb17acddf3ea /svgio/qa/cppunit
parent35803990c9b1881074460659acdac6b2799c99ee (diff)
tdf#145896: set style to 'text/css' by default
This is a regression from 4c31a0be1d8048bf3340acbb59248185e4b93041 "Resolves: #i125326# accept CssStyles with missing type attribute" Calling setTextCss(true) when there are no attributes is wrong, since it might have attributes like 'id'. The unittest added also covers i125326 is still fixed Change-Id: Ic5e4899211ae98c866f64f17e69a3a8cd24e4959 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153290 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'svgio/qa/cppunit')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx19
-rw-r--r--svgio/qa/cppunit/data/tdf145896.svg12
2 files changed, 30 insertions, 1 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index c9ec752d882a..43dde4da9997 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -302,9 +302,26 @@ CPPUNIT_TEST_FIXTURE(Test, testFontsizeRelative)
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "familyname", "serif");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf145896)
+{
+ Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf145896.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: #ffff00
+ // - Actual : #000000
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "color", "#ffff00");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", "#008000");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", "#0000ff");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTdf97717)
{
- //Check when font-size uses relative units (em,ex) and it's based on its parent's font-size
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf97717.svg");
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
diff --git a/svgio/qa/cppunit/data/tdf145896.svg b/svgio/qa/cppunit/data/tdf145896.svg
new file mode 100644
index 000000000000..d434a961b9d0
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf145896.svg
@@ -0,0 +1,12 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-0 0 300 300">
+
+ <style id="style2">
+ .st0{fill:yellow;}.st1{fill:green;}
+ </style>
+ <style type="text/some-unknown-styling-language">
+ .st2{fill:red;}
+ </style>
+ <rect x="0" y="0" height="50" width="50" class="st0" fill="blue"></rect>
+ <rect x="60" y="0" height="50" width="50" class="st1" fill="blue"></rect>
+ <rect x="120" y="0" height="50" width="50" class="st2" fill="blue"></rect>
+</svg>