From 5e427dc812bbd27ef8fa16a7dbed8cec9acb7520 Mon Sep 17 00:00:00 2001 From: Sam Tygier Date: Thu, 2 Jun 2016 23:04:45 +0100 Subject: [PATCH] tdf#100198 unit test Test that svg styles are resolved correctly when a CSS * selector rule is present in an svg file. Change-Id: Iccd09edc2b4b6b666c1d4a65d81aaaed1847be9e --- svgio/qa/cppunit/SvgImportTest.cxx | 51 ++++++++++++++++++++++++++++++++++++ svgio/qa/cppunit/data/tdf100198.svg | Bin 0 -> 1117 bytes 2 files changed, 51 insertions(+) create mode 100644 svgio/qa/cppunit/data/tdf100198.svg diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx index 50bd744..6014c54 100644 --- a/svgio/qa/cppunit/SvgImportTest.cxx +++ b/svgio/qa/cppunit/SvgImportTest.cxx @@ -61,6 +61,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools void test47446b(); void testMaskText(); void testTdf99994(); + void testTdf100198(); Primitive2DSequence parseSvg(const char* aSource); @@ -92,6 +93,7 @@ public: CPPUNIT_TEST(test47446b); CPPUNIT_TEST(testMaskText); CPPUNIT_TEST(testTdf99994); + CPPUNIT_TEST(testTdf100198); CPPUNIT_TEST_SUITE_END(); }; @@ -626,6 +628,55 @@ void Test::testTdf99994() assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Sans"); } +void Test::testTdf100198() +{ + //Check that styles are resolved correctly where there is a * css selector + Primitive2DSequence aSequenceTdf100198 = parseSvg("/svgio/qa/cppunit/data/tdf100198.svg"); + CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceTdf100198.getLength()); + + Primitive2dXmlDump dumper; + xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer(aSequenceTdf100198)); + + CPPUNIT_ASSERT (pDocument); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", "red 1"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", "red 2"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", "red 3"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "fontcolor", "#ff0000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", "blue 4"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "fontcolor", "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "text", "blue 5"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "fontcolor", "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "text", "blue 6"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "fontcolor", "#0000ff"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "text", "green 7"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "fontcolor", "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "text", "green 8"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "fontcolor", "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "height", "18"); + + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "text", "green 9"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "fontcolor", "#008000"); + assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "height", "18"); + +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } diff --git a/svgio/qa/cppunit/data/tdf100198.svg b/svgio/qa/cppunit/data/tdf100198.svg new file mode 100644 index 0000000000000000000000000000000000000000..6d4b5e9c1b9766a769811227004edcb3fec8719b GIT binary patch literal 1117 zcmai!(Q<+?5JjKMS7g?=&eRAff+hJEizzTekuhn(cKr8l5=0}SFAQup_w3$HNaasX zy05C13<{;14W(_{&f9RlKjbu6EEW_qfVAaK6$~&ynhr=I%DhkveEZG4RH|boh&ncc zffAjfnUp}v9RsuC1NUCZ-{-zoZ?gOq8$WKk_mekMvf0)Vu9Q`^`KZ3d$(v_>|D7L% zsC6Ld0|&7??}^=u?>ZT>V??PGLrvz3ycp@DR(pQqveaTDiP=+Z#95HU(Sq_k4 zqpn|LrftGa)+Rkc;QC3HBa%CYm1&~aoiGM-`cau;jQaIJ3~2QP6uBbjiS*