cool#10610 Ensure the parent-child relations of comments.
[LibreOffice.git] / svgio / qa / cppunit / SvgImportTest.cxx
blobb0042b487f13d1f5d6a6e432e52a69f040c6ec4e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <sal/config.h>
11 #include <sal/log.hxx>
13 #include <test/bootstrapfixture.hxx>
14 #include <test/xmltesttools.hxx>
16 #include <comphelper/seqstream.hxx>
17 #include <comphelper/string.hxx>
19 #include <com/sun/star/graphic/SvgTools.hpp>
20 #include <com/sun/star/graphic/XPrimitive2D.hpp>
22 #include <drawinglayer/primitive2d/Tools.hxx>
23 #include <drawinglayer/tools/primitive2dxmldump.hxx>
24 #include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
26 #include <memory>
27 #include <string_view>
29 using namespace css;
30 using namespace css::uno;
31 using namespace css::io;
32 using namespace css::graphic;
33 using drawinglayer::primitive2d::Primitive2DSequence;
34 using drawinglayer::primitive2d::Primitive2DContainer;
35 using drawinglayer::primitive2d::Primitive2DReference;
37 class Test : public test::BootstrapFixture, public XmlTestTools
39 protected:
40 void checkRectPrimitive(Primitive2DSequence const & rPrimitive);
42 Primitive2DSequence parseSvg(std::u16string_view aSource);
43 xmlDocUniquePtr dumpAndParseSvg(std::u16string_view aSource);
46 Primitive2DSequence Test::parseSvg(std::u16string_view aSource)
48 const Reference<XSvgParser> xSvgParser = SvgTools::create(m_xContext);
50 OUString aUrl = m_directories.getURLFromSrc(aSource);
51 OUString aPath = m_directories.getPathFromSrc(aSource);
53 SvFileStream aFileStream(aUrl, StreamMode::READ);
54 std::size_t nSize = aFileStream.remainingSize();
55 std::unique_ptr<sal_Int8[]> pBuffer(new sal_Int8[nSize + 1]);
56 aFileStream.ReadBytes(pBuffer.get(), nSize);
57 pBuffer[nSize] = 0;
59 Sequence<sal_Int8> aData(pBuffer.get(), nSize + 1);
60 Reference<XInputStream> aInputStream(new comphelper::SequenceInputStream(aData));
62 return xSvgParser->getDecomposition(aInputStream, aPath);
65 xmlDocUniquePtr Test::dumpAndParseSvg(std::u16string_view aSource)
67 Primitive2DSequence aSequence = parseSvg(aSource);
69 drawinglayer::Primitive2dXmlDump dumper;
70 xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
72 CPPUNIT_ASSERT (pDocument);
73 return pDocument;
76 void Test::checkRectPrimitive(Primitive2DSequence const & rPrimitive)
78 drawinglayer::Primitive2dXmlDump dumper;
79 xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(rPrimitive));
81 CPPUNIT_ASSERT (pDocument);
83 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", u"#00cc00"); // rect background color
84 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", u"100"); // rect background height
85 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", u"100"); // rect background width
86 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", u"10");
87 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", u"10");
88 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", u"110");
89 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", u"110");
90 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", u"#ff0000"); // rect stroke color
91 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", u"3"); // rect stroke width
94 namespace
96 bool arePrimitive2DSequencesEqual(const Primitive2DSequence& rA, const Primitive2DSequence& rB)
98 auto rv = std::mismatch(rA.begin(), rA.end(), rB.begin(), rB.end(),
99 [](const css::uno::Reference<css::graphic::XPrimitive2D>& a,
100 const css::uno::Reference<css::graphic::XPrimitive2D>& b)
102 return drawinglayer::primitive2d::arePrimitive2DReferencesEqual(a, b);
104 if (rv.first == rA.end() && rv.second == rB.end())
105 return true;
106 if (rv.first == rA.end() || rv.second == rB.end())
108 SAL_WARN("svgio",
109 "first seq length == " << rA.size() <<
110 "second seq length == " << rB.size());
111 return false;
113 auto idx = std::distance(rA.begin(), rv.first);
114 SAL_WARN("svgio",
115 "first difference at index " << idx <<
116 " expected element " << typeid(*rA[idx]).name() <<
117 " but got element " << typeid(*rB[idx]).name());
118 return false;
122 // Attributes for an object (like rect as in this case) can be defined
123 // in different ways (directly with xml attributes, or with CSS styles),
124 // however the end result should be the same.
125 CPPUNIT_TEST_FIXTURE(Test, testStyles)
127 Primitive2DSequence aSequenceRect = parseSvg(u"/svgio/qa/cppunit/data/Rect.svg");
128 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRect.getLength()));
129 checkRectPrimitive(aSequenceRect);
131 Primitive2DSequence aSequenceRectWithStyle = parseSvg(u"/svgio/qa/cppunit/data/RectWithStyles.svg");
132 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithStyle.getLength()));
133 checkRectPrimitive(aSequenceRectWithStyle);
135 Primitive2DSequence aSequenceRectWithParentStyle = parseSvg(u"/svgio/qa/cppunit/data/RectWithParentStyles.svg");
136 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithParentStyle.getLength()));
137 checkRectPrimitive(aSequenceRectWithParentStyle);
139 Primitive2DSequence aSequenceRectWithStylesByGroup = parseSvg(u"/svgio/qa/cppunit/data/RectWithStylesByGroup.svg");
140 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithStylesByGroup.getLength()));
141 checkRectPrimitive(aSequenceRectWithStylesByGroup);
143 CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect, aSequenceRectWithStyle));
144 CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect, aSequenceRectWithParentStyle));
145 CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect, aSequenceRectWithStylesByGroup));
148 CPPUNIT_TEST_FIXTURE(Test, testSymbol)
150 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/symbol.svg");
152 // tdf#126330: Without the fix in place, this test would have failed with
153 // - Expected: 1
154 // - Actual : 2
155 // number of nodes is incorrect
156 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", u"#00d000");
159 CPPUNIT_TEST_FIXTURE(Test, testTdf150124)
161 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf150124.svg");
163 assertXPathChildren(pDocument, "/primitive2D", 1);
164 assertXPath(pDocument, "/primitive2D/hiddengeometry", 1);
167 CPPUNIT_TEST_FIXTURE(Test, testTdf155819)
169 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf155819.svg");
171 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", 1);
172 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/polypolygon", 1);
173 // Without the fix in place, this test would have failed with
174 // - Expected: 4
175 // - Actual : 0
176 assertXPath(pDocument, "/primitive2D/transform/transform", 4);
179 CPPUNIT_TEST_FIXTURE(Test, testTdf164434)
181 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf164434.svg");
183 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", 1);
184 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", u"#000000");
185 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", 0);
186 assertXPath(pDocument, "/primitive2D/transform/transform/transform/polypolygoncolor", 1);
187 assertXPath(pDocument, "/primitive2D/transform/transform/transform/polypolygoncolor", "color", u"#000000");
190 CPPUNIT_TEST_FIXTURE(Test, testNormalBlend)
192 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/normalBlend.svg");
194 assertXPath(pDocument,
195 "/primitive2D/transform/transform/bitmap", "height", u"170");
196 assertXPath(pDocument,
197 "/primitive2D/transform/transform/bitmap", "width", u"170");
198 assertXPath(pDocument,
199 "/primitive2D/transform/transform/bitmap/data", 170);
201 assertXPath(pDocument,
202 "/primitive2D/transform/transform/bitmap", "xy11", u"170");
203 assertXPath(pDocument,
204 "/primitive2D/transform/transform/bitmap", "xy12", u"0");
205 assertXPath(pDocument,
206 "/primitive2D/transform/transform/bitmap", "xy13", u"0");
207 assertXPath(pDocument,
208 "/primitive2D/transform/transform/bitmap", "xy21", u"0");
209 assertXPath(pDocument,
210 "/primitive2D/transform/transform/bitmap", "xy22", u"170");
211 assertXPath(pDocument,
212 "/primitive2D/transform/transform/bitmap", "xy23", u"0");
213 assertXPath(pDocument,
214 "/primitive2D/transform/transform/bitmap", "xy31", u"0");
215 assertXPath(pDocument,
216 "/primitive2D/transform/transform/bitmap", "xy32", u"0");
217 assertXPath(pDocument,
218 "/primitive2D/transform/transform/bitmap", "xy33", u"1");
220 // Check the colors in the diagonal
221 OUString sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[40]", "row");
222 std::vector<OUString> aPixels = comphelper::string::split(sDataRow, ',');
223 CPPUNIT_ASSERT_EQUAL(u"ffd700"_ustr, aPixels[40]);
225 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[85]", "row");
226 aPixels = comphelper::string::split(sDataRow, ',');
227 CPPUNIT_ASSERT_EQUAL(u"ffd700"_ustr, aPixels[85]);
229 #if defined _WIN32 && defined _ARM64_
230 // skip for windows arm64 build
231 #else
232 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[130]", "row");
233 aPixels = comphelper::string::split(sDataRow, ',');
234 CPPUNIT_ASSERT_EQUAL(u"8a2be2"_ustr, aPixels[130]);
235 #endif
238 CPPUNIT_TEST_FIXTURE(Test, testFeColorMatrix)
240 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/filterFeColorMatrix.svg");
242 assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[1]", "modifier", u"matrix");
243 assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[2]", "modifier", u"saturate");
244 assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[3]", "modifier", u"hueRotate");
245 assertXPath(pDocument, "/primitive2D/transform/mask/modifiedColor[4]", "modifier", u"luminance_to_alpha");
248 CPPUNIT_TEST_FIXTURE(Test, testFilterFeComposite)
250 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/filterFeComposite.svg");
252 assertXPath(pDocument, "/primitive2D/transform/mask", 5);
253 // over operator
254 assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor", 3);
255 assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygon/polygon/point", 8);
256 // xor operator
257 assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor", 3);
258 assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygon/polygon[1]/point", 8);
259 assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygon/polygon[2]/point", 4);
260 // in operator
261 assertXPath(pDocument, "/primitive2D/transform/mask[3]/polypolygoncolor", 3);
262 assertXPath(pDocument, "/primitive2D/transform/mask[3]/polypolygon/polygon/point", 4);
263 // out operator
264 assertXPath(pDocument, "/primitive2D/transform/mask[4]/polypolygoncolor", 3);
265 assertXPath(pDocument, "/primitive2D/transform/mask[4]/polypolygon/polygon/point", 6);
266 // atop operator
267 assertXPath(pDocument, "/primitive2D/transform/mask[5]/polypolygoncolor", 3);
268 assertXPath(pDocument, "/primitive2D/transform/mask[5]/polypolygon/polygon[1]/point", 6);
269 assertXPath(pDocument, "/primitive2D/transform/mask[5]/polypolygon/polygon[2]/point", 4);
272 CPPUNIT_TEST_FIXTURE(Test, testFilterFeGaussianBlur)
274 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/filterFeGaussianBlur.svg");
276 assertXPath(pDocument, "/primitive2D/transform/softedge", "radius", u"5");
279 CPPUNIT_TEST_FIXTURE(Test, testInFilterAttribute)
281 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/inFilterAttribute.svg");
283 // Without the fix in place, the feGaussianBlur and feColorMatrix filter would have been applied
284 assertXPath(pDocument, "/primitive2D/transform/transform", "xy11", u"1");
285 assertXPath(pDocument, "/primitive2D/transform/transform", "xy12", u"0");
286 assertXPath(pDocument, "/primitive2D/transform/transform", "xy13", u"40");
287 assertXPath(pDocument, "/primitive2D/transform/transform", "xy21", u"0");
288 assertXPath(pDocument, "/primitive2D/transform/transform", "xy22", u"1");
289 assertXPath(pDocument, "/primitive2D/transform/transform", "xy23", u"40");
290 assertXPath(pDocument, "/primitive2D/transform/transform", "xy31", u"0");
291 assertXPath(pDocument, "/primitive2D/transform/transform", "xy32", u"0");
292 assertXPath(pDocument, "/primitive2D/transform/transform", "xy33", u"1");
293 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", u"#ffffff");
296 CPPUNIT_TEST_FIXTURE(Test, testResultFilterAttribute)
298 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/resultFilterAttribute.svg");
300 // Without the fix in place, the feColorMatrix filter would have been applied
301 assertXPath(pDocument, "/primitive2D/transform/transform", "xy11", u"1");
302 assertXPath(pDocument, "/primitive2D/transform/transform", "xy12", u"0");
303 assertXPath(pDocument, "/primitive2D/transform/transform", "xy13", u"40");
304 assertXPath(pDocument, "/primitive2D/transform/transform", "xy21", u"0");
305 assertXPath(pDocument, "/primitive2D/transform/transform", "xy22", u"1");
306 assertXPath(pDocument, "/primitive2D/transform/transform", "xy23", u"40");
307 assertXPath(pDocument, "/primitive2D/transform/transform", "xy31", u"0");
308 assertXPath(pDocument, "/primitive2D/transform/transform", "xy32", u"0");
309 assertXPath(pDocument, "/primitive2D/transform/transform", "xy33", u"1");
310 assertXPath(pDocument, "/primitive2D/transform/transform/softedge", "radius", u"2");
311 assertXPath(pDocument, "/primitive2D/transform/transform/softedge/polypolygoncolor", "color", u"#ffffff");
314 CPPUNIT_TEST_FIXTURE(Test, testFilterFeMerge)
316 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/filterFeMerge.svg");
318 assertXPath(pDocument, "/primitive2D/transform/mask/softedge", 2);
319 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygon", 1);
320 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor", 1);
321 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke", 1);
324 CPPUNIT_TEST_FIXTURE(Test, testFilterFeOffset)
326 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/filterFeOffset.svg");
328 assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy11", u"1");
329 assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy12", u"0");
330 assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy13", u"44");
331 assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy21", u"0");
332 assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy22", u"1");
333 assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy23", u"66");
334 assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy31", u"0");
335 assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy32", u"0");
336 assertXPath(pDocument, "/primitive2D/transform/mask/transform", "xy33", u"1");
339 CPPUNIT_TEST_FIXTURE(Test, testFilterFeFlood)
341 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/filterFeFlood.svg");
343 assertXPath(pDocument, "/primitive2D/transform/polypolygonrgba", "transparence", u"50");
344 assertXPath(pDocument, "/primitive2D/transform/polypolygonrgba", "color", u"#008000");
345 assertXPath(pDocument, "/primitive2D/transform/polypolygonrgba/polypolygon", "height", u"100");
346 assertXPath(pDocument, "/primitive2D/transform/polypolygonrgba/polypolygon", "width", u"100");
347 assertXPath(pDocument, "/primitive2D/transform/polypolygonrgba/polypolygon", "minx", u"50");
348 assertXPath(pDocument, "/primitive2D/transform/polypolygonrgba/polypolygon", "miny", u"50");
351 CPPUNIT_TEST_FIXTURE(Test, testFilterFeDropShadow)
353 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/filterFeDropShadow.svg");
355 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence", "transparence", u"50");
356 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/shadow", "color", u"#0000ff");
357 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/shadow", "blur", u"0.2");
358 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/shadow", "blur", u"0.2");
359 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", u"#ffc0cb");
362 CPPUNIT_TEST_FIXTURE(Test, testFilterFeImage)
364 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/filterFeImage.svg");
366 assertXPath(pDocument, "/primitive2D/transform/transform/bitmap");
369 CPPUNIT_TEST_FIXTURE(Test, testTdf87309)
371 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf87309.svg");
373 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", u"#000000");
374 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", u"100");
375 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", u"100");
376 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", u"10");
377 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", u"10");
378 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", u"110");
379 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", u"110");
382 CPPUNIT_TEST_FIXTURE(Test, testFontsizeKeywords)
384 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/FontsizeKeywords.svg");
386 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#000000");
387 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"Sample");
388 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"9");
389 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", u"Times New Roman");
391 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", u"#ffffff");
392 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"Sample");
393 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"11");
394 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "familyname", u"Times New Roman");
396 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "fontcolor", u"#ffd700");
397 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"Sample");
398 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", u"13");
399 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "familyname", u"Times New Roman");
401 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "fontcolor", u"#ff0000");
402 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", u"Sample");
403 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "height", u"16");
404 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "familyname", u"Times New Roman");
406 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "fontcolor", u"#ffff00");
407 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "text", u"Sample");
408 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "height", u"19");
409 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "familyname", u"Times New Roman");
411 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "fontcolor", u"#0000ff");
412 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "text", u"Sample");
413 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "height", u"23");
414 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "familyname", u"Times New Roman");
416 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "fontcolor", u"#008000");
417 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "text", u"Sample");
418 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "height", u"28");
419 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "familyname", u"Times New Roman");
421 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "fontcolor", u"#ff7f50");
422 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "text", u"Sample");
423 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "height", u"13");
424 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "familyname", u"Times New Roman");
426 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "fontcolor", u"#ffc0cb");
427 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "text", u"Sample");
428 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "height", u"19");
429 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "familyname", u"Times New Roman");
431 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]", "fontcolor", u"#fffff0");
432 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]", "text", u"Sample");
433 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]", "height", u"16");
434 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "familyname", u"Times New Roman");
438 CPPUNIT_TEST_FIXTURE(Test, testFontsizePercentage)
440 //Check when font-size uses percentage and defined globally
441 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/FontsizePercentage.svg");
443 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#000000");
444 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"Sample");
445 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"16");
446 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", u"Times New Roman");
449 CPPUNIT_TEST_FIXTURE(Test, testFontsizeRelative)
451 //Check when font-size uses relative units (em,ex) and it's based on its parent's font-size
452 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/FontsizeRelative.svg");
454 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#000000");
455 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"Sample");
456 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"50");
457 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", u"DejaVu Serif");
459 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", u"#000000");
460 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"Sample");
461 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"50");
462 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "familyname", u"DejaVu Serif");
465 CPPUNIT_TEST_FIXTURE(Test, testTdf161985)
467 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf161985.svg");
469 // Without the fix in place, this test would have failed with
470 // - Expected: 0
471 // - Actual : 1
472 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", 0);
474 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", 1);
475 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", "text", u"This is a test file.");
478 CPPUNIT_TEST_FIXTURE(Test, testTdf160386)
480 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf160386.svg");
482 // Without the fix in place, this test would have failed with
483 // - Expected: 1
484 // - Actual : 11
485 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", 1);
486 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", "text", u"Hello!");
489 CPPUNIT_TEST_FIXTURE(Test, testTdf145896)
491 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf145896.svg");
493 // Without the fix in place, this test would have failed with
494 // - Expected: #ffff00
495 // - Actual : #000000
496 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "color", u"#ffff00");
497 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", u"#008000");
498 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", u"#0000ff");
501 CPPUNIT_TEST_FIXTURE(Test, testTdf156579)
503 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156579.svg");
505 // Without the fix in place, nothing would be displayed
506 assertXPath(pDocument, "/primitive2D/transform/mask/transform/polypolygoncolor[1]", "color", u"#0000ff");
509 CPPUNIT_TEST_FIXTURE(Test, testTdf156168)
511 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156168.svg");
513 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", 8);
514 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "color", u"#0000ff");
515 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", u"#0000ff");
516 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", u"#ff0000");
517 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]", "color", u"#ff0000");
518 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]", "color", u"#000000");
519 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]", "color", u"#000000");
520 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]", "color", u"#ff0000");
521 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]", "color", u"#ff0000");
523 // Without the fix in place, this test would have failed with
524 // - Expected: 4
525 // - Actual : 3
526 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke", 4);
527 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[1]/line", "width", u"5");
529 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[1]/line", "color", u"#00ff00");
530 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[2]/line", "width", u"5");
532 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[2]/line", "color", u"#00ff00");
533 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[3]/line", "width", u"5");
535 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[3]/line", "color", u"#00ff00");
536 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[4]/line", "width", u"5");
538 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke[4]/line", "color", u"#00ff00");
541 CPPUNIT_TEST_FIXTURE(Test, testTdf160373)
543 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf160373.svg");
545 // Without the fix in place, nothing would be displayed
546 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", u"#0000ff");
549 CPPUNIT_TEST_FIXTURE(Test, testTdf129356)
551 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf129356.svg");
553 // Without the fix in place, this test would have failed with
554 // - Expected: #008000
555 // - Actual : #0000ff
556 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "color", u"#008000");
557 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", u"#008000");
558 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", u"#008000");
559 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]", "color", u"#008000");
560 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]", "color", u"#008000");
561 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]", "color", u"#008000");
562 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]", "color", u"#008000");
563 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]", "color", u"#008000");
566 CPPUNIT_TEST_FIXTURE(Test, testTdf156034)
568 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156034.svg");
570 // Without the fix in place, this test would have failed with
571 // - Expected: #008000
572 // - Actual : #0000ff
573 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "color", u"#008000");
574 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", u"#008000");
575 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", u"#008000");
576 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]", "color", u"#008000");
577 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]", "color", u"#008000");
578 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]", "color", u"#008000");
579 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]", "color", u"#008000");
580 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]", "color", u"#008000");
583 CPPUNIT_TEST_FIXTURE(Test, testTdf156038)
585 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156038.svg");
587 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "color", u"#0000ff");
589 // Without the fix in place, this test would have failed with
590 // - Expected: #008000
591 // - Actual : #0000ff
592 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", u"#008000");
593 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", u"#0000ff");
594 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]", "color", u"#008000");
595 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[5]", "color", u"#0000ff");
596 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[6]", "color", u"#008000");
597 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[7]", "color", u"#0000ff");
598 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[8]", "color", u"#008000");
601 CPPUNIT_TEST_FIXTURE(Test, testTdf156018)
603 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156018.svg");
605 // Without the fix in place, this test would have failed with
606 // - Expected: #008000
607 // - Actual : #0000ff
608 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "color", u"#008000");
609 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", u"#0000ff");
612 CPPUNIT_TEST_FIXTURE(Test, testTdf156201)
614 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156201.svg");
616 assertXPath(pDocument, "/primitive2D/transform/transform/transform/polypolygoncolor", "color", u"#2f3ba1");
619 CPPUNIT_TEST_FIXTURE(Test, testTdf156167)
621 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156167.svg");
623 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]", "color", u"#ffa500");
625 // Without the fix in place, this test would have failed with
626 // - Expected: #ffa500
627 // - Actual : #ff0000
628 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]", "color", u"#ffa500");
629 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]", "color", u"#ffa500");
632 CPPUNIT_TEST_FIXTURE(Test, testTdf155932)
634 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf155932.svg");
636 assertXPath(pDocument, "/primitive2D/transform/mask/mask/polypolygonrgba", "transparence", u"50");
637 assertXPath(pDocument, "/primitive2D/transform/mask/mask/polypolygonrgba[1]", "color", u"#0000ff");
640 CPPUNIT_TEST_FIXTURE(Test, testTdf97717)
642 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf97717.svg");
644 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence[1]", "transparence", u"50");
645 // Without the fix in place, this test would have failed here since the patch
646 // would have contained two unifiedtransparence
647 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence[1]/polypolygoncolor", "color", u"#ccccff");
648 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence[2]", "transparence", u"50");
649 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence[2]/polypolygoncolor", "color", u"#ccccff");
652 CPPUNIT_TEST_FIXTURE(Test, testMarkerOrient)
654 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/MarkerOrient.svg");
656 assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy11", u"0");
657 assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy12", u"1");
658 assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy13", u"7");
659 assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy21", u"-1");
660 assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy22", u"0");
661 assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy23", u"13");
662 assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy31", u"0");
663 assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy32", u"0");
664 assertXPath(pDocument, "/primitive2D/transform/transform[1]", "xy33", u"1");
666 assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy11", u"1");
667 assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy12", u"0");
668 assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy13", u"87");
669 assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy21", u"0");
670 assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy22", u"1");
671 assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy23", u"87");
672 assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy31", u"0");
673 assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy32", u"0");
674 assertXPath(pDocument, "/primitive2D/transform/transform[2]", "xy33", u"1");
677 CPPUNIT_TEST_FIXTURE(Test, testContextFill)
679 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/contextFill.svg");
681 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", u"#ff0000");
682 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", u"#ff0000");
685 CPPUNIT_TEST_FIXTURE(Test, testFillContextStroke)
687 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/fillContextStroke.svg");
689 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", u"#ff0000");
690 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", u"#ff0000");
693 CPPUNIT_TEST_FIXTURE(Test, testContextStroke)
695 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/contextStroke.svg");
697 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", u"#ff0000");
698 assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "color", u"#ff0000");
699 assertXPath(pDocument, "/primitive2D/transform/transform[2]/polypolygonstroke/line", "color", u"#ff0000");
700 assertXPath(pDocument, "/primitive2D/transform/transform[3]/polypolygonstroke/line", "color", u"#ff0000");
701 assertXPath(pDocument, "/primitive2D/transform/transform[4]/polypolygonstroke/line", "color", u"#ff0000");
704 CPPUNIT_TEST_FIXTURE(Test, testContextStrokeGradient)
706 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/contextStrokeGradient.svg");
708 assertXPath(pDocument, "/primitive2D/transform/svglineargradient"_ostr);
709 assertXPath(pDocument, "/primitive2D/transform/transform[1]/svglineargradient"_ostr);
710 assertXPath(pDocument, "/primitive2D/transform/transform[2]/svglineargradient"_ostr);
711 assertXPath(pDocument, "/primitive2D/transform/transform[3]/svglineargradient"_ostr);
712 assertXPath(pDocument, "/primitive2D/transform/transform[4]/svglineargradient"_ostr);
715 CPPUNIT_TEST_FIXTURE(Test, testMarkerInPresentation)
717 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/markerInPresentation.svg");
719 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", 1);
720 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/polypolygon/polygon", 1);
721 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/polypolygon/polygon", 1);
723 // Without the fix in place, this test would have failed with
724 // - Expected: 0
725 // - Actual : 2
726 assertXPath(pDocument, "/primitive2D/transform/transform/transform", 0);
729 CPPUNIT_TEST_FIXTURE(Test, testMarkerInCssStyle)
731 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/markerInCssStyle.svg");
733 // Without the fix in place, this test would have failed with
734 // - Expected: 20
735 // - Actual : 0
736 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", 20);
738 assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "color", u"#008000");
739 assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "width", u"1");
740 assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "linejoin", u"Miter");
741 assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "miterangle", u"29");
742 assertXPath(pDocument, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "linecap", u"BUTT");
745 CPPUNIT_TEST_FIXTURE(Test, testTextXmlSpace)
747 //Check tspan fontsize when using relative units
748 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/textXmlSpace.svg");
750 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "text", u"a b");
751 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "text", u"a b");
752 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "text", u"a b");
753 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "text", u"ab");
754 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[5]", "text", u" a b ");
755 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[6]", "text", u"a b");
756 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[7]", "text", u"a b");
757 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[8]", "text", u"a b");
760 CPPUNIT_TEST_FIXTURE(Test, testTdf45771)
762 //Check text fontsize when using relative units
763 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf45771.svg");
765 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#000000");
766 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"Sample");
767 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"32");
768 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", u"Times New Roman");
771 CPPUNIT_TEST_FIXTURE(Test, testTdf155833)
773 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf155833.svg");
775 assertXPath(pDocument, "/primitive2D/transform/mask/transform/transform/transform/transform/transform/bitmap", 1);
778 CPPUNIT_TEST_FIXTURE(Test, testTdf97941)
780 //Check tspan fontsize when using relative units
781 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf97941.svg");
783 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#000000");
784 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"Sample");
785 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"48");
786 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", u"Times New Roman");
789 CPPUNIT_TEST_FIXTURE(Test, testTdf156777)
791 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156777.svg");
793 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", 23);
794 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"Quick brown fox jumps over the lazy dog.");
796 // Without the fix in place, this test would have failed with
797 // - Expected: #008000
798 // - Actual : #000000
799 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#008000");
800 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"85");
801 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"23");
804 CPPUNIT_TEST_FIXTURE(Test, testTdf156834)
806 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156834.svg");
808 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", 4);
809 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"Auto");
810 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"30");
811 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"20");
813 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"Middle");
814 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"30");
815 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"57");
817 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"Hanging");
818 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", u"30");
819 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", 93.5, 0.5);
821 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", u"Central");
822 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "x", u"30");
823 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "y", u"117");
826 CPPUNIT_TEST_FIXTURE(Test, testTdf104339)
828 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf104339.svg");
830 assertXPath(pDocument, "/primitive2D/transform/transform/transform/transform/transform/polypolygoncolor", "color", u"#000000");
833 CPPUNIT_TEST_FIXTURE(Test, testTdf85770)
835 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf85770.svg");
837 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#000000");
838 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"Start Middle End");
839 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"11");
840 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", u"Times New Roman");
841 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", u"#000000");
842 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"Start ");
843 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"11");
844 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "familyname", u"Times New Roman");
845 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "fontcolor", u"#000000");
846 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u" End");
847 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", u"11");
848 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "familyname", u"Times New Roman");
851 CPPUNIT_TEST_FIXTURE(Test, testTdf86938)
853 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf86938.svg");
855 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"line");
856 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"290");
857 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"183");
858 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"above");
859 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"290");
861 // Without the fix in place, this test would have failed with
862 // - Expected: 159
863 // - Actual : 207
864 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"159");
865 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"below");
866 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", u"290");
867 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", u"207");
870 CPPUNIT_TEST_FIXTURE(Test, testTdf93583)
872 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf93583.svg");
874 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"This is the");
875 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"58");
876 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"303");
877 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "width", u"16");
878 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"16");
879 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u" first ");
880 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"125");
881 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"303");
882 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", u"32");
883 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"32");
884 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"line");
885 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", u"192");
886 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", u"303");
887 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "width", u"16");
888 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", u"16");
891 CPPUNIT_TEST_FIXTURE(Test, testTdf156616)
893 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156616.svg");
895 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"First ");
896 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"114");
897 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"103");
898 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"line ");
899 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"147");
900 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"103");
901 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"Second line");
902 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", u"114");
903 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", u"122");
904 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", u"First ");
905 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "x", u"85");
906 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "y", u"153");
907 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "text", u"line ");
908 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "x", u"118");
909 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "y", u"153");
910 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "text", u"Second line");
911 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "x", u"77");
912 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "y", u"172");
913 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "text", u"First ");
914 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "x", u"55");
915 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "y", u"203");
916 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "text", u"line ");
917 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "x", u"88");
918 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "y", u"203");
919 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "text", u"Second line");
920 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "x", u"40");
921 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "y", u"222");
924 CPPUNIT_TEST_FIXTURE(Test, testTdf79163)
926 //Check Opacity
927 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf79163.svg");
929 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence", "transparence", u"50");
932 CPPUNIT_TEST_FIXTURE(Test, testTdf97542_1)
934 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf97542_1.svg");
936 assertXPath(pDocument, "/primitive2D/transform/objectinfo/textsimpleportion", "fontcolor", u"#ffff00");
937 assertXPath(pDocument, "/primitive2D/transform/objectinfo/textsimpleportion", "text", u"Text");
938 assertXPath(pDocument, "/primitive2D/transform/objectinfo/textsimpleportion", "height", u"48");
939 assertXPath(pDocument, "/primitive2D/transform/objectinfo/textsimpleportion", "familyname", u"DejaVu Serif");
942 CPPUNIT_TEST_FIXTURE(Test, testTdf97542_2)
944 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf97542_2.svg");
946 assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient", "startx", u"1");
947 assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient", "starty", u"1");
948 assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient/focalx", 0);
949 assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient/focaly", 0);
950 assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient", "radius", u"3");
951 assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient", "spreadmethod", u"pad");
952 assertXPath(pDocument, "/primitive2D/transform/objectinfo/svgradialgradient", "opacity", u"1");
955 CPPUNIT_TEST_FIXTURE(Test, testTdf97543)
957 // check visibility="inherit"
958 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf97543.svg");
960 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", u"#00cc00");
961 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", u"100");
962 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", u"100");
963 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", u"10");
964 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", u"10");
965 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", u"110");
966 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", u"110");
969 CPPUNIT_TEST_FIXTURE(Test, testRGBColor)
971 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/RGBColor.svg");
973 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", u"#646464");
974 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", u"100");
975 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", u"100");
976 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", u"10");
977 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", u"10");
978 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", u"110");
979 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", u"110");
982 CPPUNIT_TEST_FIXTURE(Test, testTdf149673)
984 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf149673.svg");
986 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence", "transparence", u"90");
987 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[1]", "color", u"#ff0000");
988 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[2]", "color", u"#00ff00");
989 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[3]", "color", u"#0000ff");
992 CPPUNIT_TEST_FIXTURE(Test, testRGBAColor)
994 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/RGBAColor.svg");
996 assertXPath(pDocument, "/primitive2D/transform/unifiedtransparence", "transparence", u"50");
999 CPPUNIT_TEST_FIXTURE(Test, testNoneColor)
1001 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/noneColor.svg");
1003 //No polypolygoncolor exists
1004 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor", 0);
1005 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line", "color", u"#000000");
1006 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line", "width", u"3");
1009 CPPUNIT_TEST_FIXTURE(Test, testTdf117920)
1011 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf117920.svg");
1013 assertXPath(pDocument, "/primitive2D/transform/transform", "xy11", u"1");
1014 assertXPath(pDocument, "/primitive2D/transform/transform", "xy12", u"0");
1015 assertXPath(pDocument, "/primitive2D/transform/transform", "xy13", u"-18");
1016 assertXPath(pDocument, "/primitive2D/transform/transform", "xy21", u"0");
1017 assertXPath(pDocument, "/primitive2D/transform/transform", "xy22", u"1");
1018 assertXPath(pDocument, "/primitive2D/transform/transform", "xy23", u"-6");
1019 assertXPath(pDocument, "/primitive2D/transform/transform", "xy31", u"0");
1020 assertXPath(pDocument, "/primitive2D/transform/transform", "xy32", u"0");
1021 assertXPath(pDocument, "/primitive2D/transform/transform", "xy33", u"1");
1024 CPPUNIT_TEST_FIXTURE(Test, testTdf97936)
1026 // check that both rectangles are rendered in the viewBox
1027 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf97936.svg");
1029 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]");
1030 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "height", u"50");
1031 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "width", u"50");
1032 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "minx", u"70");
1033 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "miny", u"50");
1034 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "maxx", u"120");
1035 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "maxy", u"100");
1036 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]");
1037 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "height", u"50");
1038 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "width", u"50");
1039 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "minx", u"10");
1040 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "miny", u"50");
1041 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "maxx", u"60");
1042 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "maxy", u"100");
1045 CPPUNIT_TEST_FIXTURE(Test, testTdf149893)
1047 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf149893.svg");
1049 // Without the fix in place, this test would have failed with
1050 // - Expected: #008000
1051 // - Actual : #000000
1052 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", u"#008000");
1055 CPPUNIT_TEST_FIXTURE(Test, testShapeWithClipPathAndCssStyle)
1057 // tdf#97539: Check there is a mask and 3 polygons
1058 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg");
1060 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygon/polygon", 2);
1061 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor/polypolygon/polygon", 1);
1064 CPPUNIT_TEST_FIXTURE(Test, testClipPathAndParentStyle)
1066 //Check that fill color, stroke color and stroke-width are inherited from use element
1067 //when the element is within a clipPath element
1068 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/ClipPathAndParentStyle.svg");
1070 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", u"#ff0000");
1071 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "color", u"#000000");
1072 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "width", u"5");
1075 CPPUNIT_TEST_FIXTURE(Test, testTdf155814)
1077 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf155814.svg");
1079 assertXPath(pDocument, "/primitive2D/transform/mask/mask/transform/polypolygonrgba", "transparence", u"50");
1080 assertXPath(pDocument, "/primitive2D/transform/mask/mask/transform/polypolygonrgba", "color", u"#0000ff");
1083 CPPUNIT_TEST_FIXTURE(Test, testClipPathAndStyle)
1085 //Check that fill color, stroke color and stroke-width are inherited from use element
1086 //when the element is within a clipPath element
1087 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/ClipPathAndStyle.svg");
1089 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", u"#ccccff");
1090 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "color", u"#0000cc");
1091 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonstroke/line", "width", u"2");
1095 CPPUNIT_TEST_FIXTURE(Test, testShapeWithClipPath)
1097 // Check there is a mask and 3 polygons
1098 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/ShapeWithClipPath.svg");
1100 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygon/polygon", 2);
1101 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor/polypolygon/polygon", 1);
1104 CPPUNIT_TEST_FIXTURE(Test, testClipPathUsingClipPath)
1106 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/ClipPathUsingClipPath.svg");
1108 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygon/polygon/point", 20);
1109 assertXPath(pDocument, "/primitive2D/transform/mask/mask/polypolygon/polygon/point", 13);
1112 CPPUNIT_TEST_FIXTURE(Test, testFillRule)
1114 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/FillRule.svg");
1116 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", u"#000000");
1117 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor/polypolygon/polygon", 2);
1118 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", u"#ff0000");
1119 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/polypolygon/polygon", 2);
1122 CPPUNIT_TEST_FIXTURE(Test, testClipRule)
1124 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/ClipRule.svg");
1126 // Without the place in place, this test would have failed with
1127 // - Expected: 5
1128 // - Actual : 10
1129 assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygon/polygon/point", 5);
1130 assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor", "color", u"#0000ff");
1131 assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor/polypolygon/polygon/point", 4);
1133 assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygon/polygon/point", 5);
1134 assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor", "color", u"#ff0000");
1135 assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor/polypolygon/polygon/point", 4);
1138 CPPUNIT_TEST_FIXTURE(Test, testi125329)
1140 //Check style inherit from * css element
1141 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/i125329.svg");
1143 assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor", "color", u"#c0c0c0"); // rect background color
1144 assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "height", u"30"); // rect background height
1145 assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "width", u"50"); // rect background width
1146 assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "minx", u"15");
1147 assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "miny", u"15");
1148 assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "maxx", u"65");
1149 assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "maxy", u"45");
1150 assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygonstroke/line", "color", u"#008000"); // rect stroke color
1151 assertXPath(pDocument, "/primitive2D/transform/transform/objectinfo/polypolygonstroke/line", "width", u"1"); // rect stroke width
1154 CPPUNIT_TEST_FIXTURE(Test, testMaskingPath07b)
1156 //For the time being, check that masking-path-07-b.svg can be imported and it doesn't hang on loading
1157 //it used to hang after d5649ae7b76278cb3155f951d6327157c7c92b65
1158 dumpAndParseSvg(u"/svgio/qa/cppunit/data/masking-path-07-b.svg");
1161 CPPUNIT_TEST_FIXTURE(Test, test123926)
1163 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf123926.svg");
1165 assertXPath(pDocument, "/primitive2D/transform/transform/transform/polypolygonrgba", "color", u"#7cb5ec");
1168 CPPUNIT_TEST_FIXTURE(Test, test47446)
1170 //Check that marker's fill attribute is black is not set
1171 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/47446.svg");
1173 assertXPath(pDocument, "/primitive2D/transform/transform/transform/polypolygoncolor", "color", u"#000000");
1176 CPPUNIT_TEST_FIXTURE(Test, test47446b)
1178 //Check that marker's fill attribute is inherit from def
1179 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/47446b.svg");
1181 assertXPath(pDocument, "/primitive2D/transform/transform/transform/polypolygoncolor", "color", u"#ffff00");
1184 CPPUNIT_TEST_FIXTURE(Test, testTdf103888)
1186 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf103888.svg");
1188 // Without the fix in place, this test would have failed here with number of nodes is incorrect
1189 assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion[1]", "text", u"Her");
1190 assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion[2]", "text", u"vor");
1191 assertXPath(pDocument, "/primitive2D/transform/transform/textsimpleportion[3]", "text", u"hebung");
1194 CPPUNIT_TEST_FIXTURE(Test, testTdf156251)
1196 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156251.svg");
1198 // Without the fix in place, this test would have failed with
1199 // - Expected: 'You are '
1200 // - Actual : 'You are'
1201 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"You are ");
1202 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"not");
1203 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u" a banana!");
1204 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", u"You are");
1205 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "text", u" not ");
1206 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "text", u"a banana!");
1209 CPPUNIT_TEST_FIXTURE(Test, testMaskText)
1211 //Check that mask is applied on text
1212 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/maskText.svg");
1214 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", u"#000000");
1215 assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion", "fontcolor", u"#ffffff");
1216 assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion", "text", u"Black White");
1217 assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion", "height", u"26");
1218 assertXPath(pDocument, "/primitive2D/transform/transform/transform/textsimpleportion", "familyname", u"Times New Roman");
1221 CPPUNIT_TEST_FIXTURE(Test, testTdf99994)
1223 //Check text fontsize when using relative units
1224 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf99994.svg");
1226 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#0000ff");
1227 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"16");
1228 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"test");
1229 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", u"DejaVu Sans");
1232 CPPUNIT_TEST_FIXTURE(Test, testTdf99115)
1234 //Check that styles are resolved correctly where there is a * css selector
1235 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf99115.svg");
1237 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"red 1");
1238 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#ff0000");
1239 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"18");
1241 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"red 2");
1242 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", u"#ff0000");
1243 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"18");
1245 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"red 3");
1246 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "fontcolor", u"#ff0000");
1247 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "height", u"18");
1249 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", u"blue 4");
1250 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "fontcolor", u"#0000ff");
1251 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "height", u"18");
1253 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "text", u"blue 5");
1254 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "fontcolor", u"#0000ff");
1255 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "height", u"18");
1257 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "text", u"blue 6");
1258 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "fontcolor", u"#0000ff");
1259 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "height", u"18");
1261 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "text", u"green 7");
1262 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "fontcolor", u"#008000");
1263 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "height", u"18");
1265 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "text", u"green 8");
1266 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "fontcolor", u"#008000");
1267 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "height", u"18");
1269 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "text", u"green 9");
1270 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "fontcolor", u"#008000");
1271 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "height", u"18");
1274 CPPUNIT_TEST_FIXTURE(Test, testTdf101237)
1276 //Check that fill color, stroke color and stroke-width are inherited from use element
1277 //when the element is within a clipPath element
1278 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf101237.svg");
1280 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", u"#ff0000");
1281 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", u"#000000");
1282 assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", u"5");
1285 CPPUNIT_TEST_FIXTURE(Test, testTdf97710)
1287 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf97710.svg");
1289 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[1]", "color", u"#000000");
1291 // Without the fix in place, this test would have failed with
1292 // - Expected: 100
1293 // - Actual : 0
1294 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon", "width", u"100");
1295 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon", "height", u"100");
1296 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]", "color", u"#008000");
1297 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon", "width", u"100");
1298 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon", "height", u"100");
1299 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line", "color", u"#000000");
1300 assertXPath(pDocument, "/primitive2D/transform/mask/polypolygonstroke/line", "width", u"1");
1303 CPPUNIT_TEST_FIXTURE(Test, testTdf94765)
1305 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf94765.svg");
1307 //Check that both rectangles use the gradient as fill
1308 assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "startx", u"1");
1309 assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "starty", u"1");
1310 assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "endx", u"2");
1311 assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[1]", "endy", u"1");
1312 assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "startx", u"0");
1313 assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "starty", u"0");
1314 assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "endx", u"1");
1315 assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "endy", u"0");
1318 CPPUNIT_TEST_FIXTURE(Test, testTdf156236)
1320 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156236.svg");
1322 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "path", u"m50 180h-30v-60h60v60z");
1323 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "path", u"m150 180h15c8.2842712474619 0 15-6.7157287525381 15-15v-30c0-8.2842712474619-6.7157287525381-15-15-15h-30c-8.2842712474619 0-15 6.7157287525381-15 15v30c0 8.2842712474619 6.7157287525381 15 15 15z");
1324 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]/polypolygon", "path", u"m250 180h15c8.2842712474619 0 15-6.7157287525381 15-15v-30c0-8.2842712474619-6.7157287525381-15-15-15h-30c-8.2842712474619 0-15 6.7157287525381-15 15v30c0 8.2842712474619 6.7157287525381 15 15 15z");
1325 assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]/polypolygon", "path", u"m350 180c16.5685424949238 0 30-6.7157287525381 30-15v-30c0-8.2842712474619-13.4314575050762-15-30-15s-30 6.7157287525381-30 15v30c0 8.2842712474619 13.4314575050762 15 30 15z");
1328 CPPUNIT_TEST_FIXTURE(Test, testBehaviourWhenWidthAndHeightIsOrIsNotSet)
1330 // This test checks the behaviour when width and height attributes
1331 // are and are not set. In both cases the result must be the same,
1332 // however if the width / height are set, then the size of the image
1333 // is enforced, but this isn't really possible in LibreOffice (or
1334 // maybe we could lock the size in this case).
1335 // The behaviour in browsers is that when a SVG image has width / height
1336 // attributes set, then the image is shown with that size, but if it
1337 // isn't set then it is shown as scalable image which is the size of
1338 // the container.
1341 Primitive2DSequence aSequence = parseSvg(u"svgio/qa/cppunit/data/Drawing_WithWidthHeight.svg");
1342 CPPUNIT_ASSERT(aSequence.hasElements());
1344 geometry::RealRectangle2D aRealRect;
1345 basegfx::B2DRange aRange;
1346 uno::Sequence<beans::PropertyValue> aViewParameters;
1348 for (css::uno::Reference<css::graphic::XPrimitive2D> const & xReference : aSequence)
1350 if (xReference.is())
1352 aRealRect = xReference->getRange(aViewParameters);
1353 aRange.expand(basegfx::B2DRange(aRealRect.X1, aRealRect.Y1, aRealRect.X2, aRealRect.Y2));
1357 double fWidth = (aRange.getWidth() / 2540.0) * 96.0;
1358 double fHeight = (aRange.getHeight() / 2540.0) * 96.0;
1360 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fWidth, 1E-12);
1361 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fHeight, 1E-12);
1365 Primitive2DSequence aSequence = parseSvg(u"svgio/qa/cppunit/data/Drawing_NoWidthHeight.svg");
1366 CPPUNIT_ASSERT(aSequence.hasElements());
1369 geometry::RealRectangle2D aRealRect;
1370 basegfx::B2DRange aRange;
1371 uno::Sequence<beans::PropertyValue> aViewParameters;
1373 for (css::uno::Reference<css::graphic::XPrimitive2D> const & xReference : aSequence)
1375 if (xReference.is())
1377 aRealRect = xReference->getRange(aViewParameters);
1378 aRange.expand(basegfx::B2DRange(aRealRect.X1, aRealRect.Y1, aRealRect.X2, aRealRect.Y2));
1382 double fWidth = (aRange.getWidth() / 2540.0) * 96.0;
1383 double fHeight = (aRange.getHeight() / 2540.0) * 96.0;
1385 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fWidth, 1E-12);
1386 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fHeight, 1E-12);
1390 CPPUNIT_TEST_FIXTURE(Test, testTdf155733)
1392 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf155733.svg");
1394 assertXPath(pDocument, "/primitive2D/transform/softedge", "radius", u"5");
1396 // Without the fix in place, the softedge would have been applied to the second element
1397 // - Expected: 1
1398 // - Actual : 0
1399 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygonrgba", "transparence", u"50");
1402 CPPUNIT_TEST_FIXTURE(Test, testTdf158445)
1404 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf158445.svg");
1406 assertXPath(pDocument, "/primitive2D/transform/mask/transform/transform/transform/polypolygoncolor", "color", u"#000000");
1407 assertXPath(pDocument, "/primitive2D/transform/mask/transform/transform/transform/polypolygoncolor/polypolygon", "height", u"8.052");
1408 assertXPath(pDocument, "/primitive2D/transform/mask/transform/transform/transform/polypolygoncolor/polypolygon", "width", u"5.328");
1411 CPPUNIT_TEST_FIXTURE(Test, testTdf159594)
1413 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf159594.svg");
1415 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor", "color", u"#000000");
1416 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "height", u"11.671875");
1417 assertXPath(pDocument, "/primitive2D/transform/transform/polypolygoncolor/polypolygon", "width", u"7.5");
1420 CPPUNIT_TEST_FIXTURE(Test, testTdf97663)
1422 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/em_units.svg");
1424 // tdf#97663: Without the fix in place, this test would have failed with
1425 // - Expected: 236
1426 // - Actual : 204
1427 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"237");
1430 CPPUNIT_TEST_FIXTURE(Test, testTdf156269)
1432 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156269.svg");
1434 assertXPath(pDocument, "//textsimpleportion[@text='one']", "width", u"16");
1435 assertXPath(pDocument, "//textsimpleportion[@text='one']", "height", u"16");
1436 assertXPath(pDocument, "//textsimpleportion[@text='one']", "x", u"10");
1437 assertXPath(pDocument, "//textsimpleportion[@text='one']", "y", u"50");
1438 assertXPath(pDocument, "//textsimpleportion[@text='one']", "fontcolor", u"#808080");
1440 assertXPath(pDocument, "//textsimpleportion[@text='two']", "width", u"16");
1441 assertXPath(pDocument, "//textsimpleportion[@text='two']", "height", u"16");
1443 // Without the fix in place, this test would have failed with
1444 // - Expected: 60
1445 // - Actual : 10
1446 assertXPath(pDocument, "//textsimpleportion[@text='two']", "x", u"60");
1447 assertXPath(pDocument, "//textsimpleportion[@text='two']", "y", u"100");
1448 assertXPath(pDocument, "//textsimpleportion[@text='two']", "fontcolor", u"#000000");
1451 CPPUNIT_TEST_FIXTURE(Test, testTdf95400)
1453 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf95400.svg");
1455 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "width", u"16");
1456 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"16");
1457 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"30");
1458 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"20");
1459 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"ABC");
1460 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx0", 36, 0.5);
1461 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx1", 69, 0.5);
1462 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx2", 102, 0.5);
1464 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", u"50");
1465 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"16");
1466 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"30");
1467 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"30");
1468 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"ABC");
1469 assertXPathNoAttribute(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx0");
1472 CPPUNIT_TEST_FIXTURE(Test, testTextAnchor)
1474 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf151103.svg");
1476 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"60");
1477 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"40");
1478 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"ABC");
1480 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"43");
1481 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"50");
1482 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"ABC");
1484 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "x", u"26");
1485 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "y", u"60");
1486 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[3]", "text", u"ABC");
1488 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "x", u"60");
1489 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "y", u"40");
1490 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[4]", "text", u"ABC");
1492 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "x", u"43");
1493 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "y", u"50");
1494 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[5]", "text", u"ABC");
1496 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "x", u"26");
1497 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "y", u"60");
1498 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[6]", "text", u"ABC");
1500 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "x", u"60");
1501 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "y", u"40");
1502 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[7]", "text", u"ABC");
1504 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "x", u"43");
1505 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "y", u"50");
1506 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[8]", "text", u"ABC");
1508 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "x", u"26");
1509 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "y", u"60");
1510 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[9]", "text", u"ABC");
1512 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]", "x", u"60");
1513 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]", "y", u"40");
1514 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[10]", "text", u"A");
1516 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[11]", "x", u"72");
1517 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[11]", "y", u"40");
1518 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[11]", "text", u"B");
1520 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[12]", "x", u"82");
1521 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[12]", "y", u"40");
1522 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[12]", "text", u"C");
1524 // Without the fix in place, this test would have failed with
1525 // - Expected: 43
1526 // - Actual : 54
1527 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[13]", "x", u"43");
1528 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[13]", "y", u"50");
1529 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[13]", "text", u"A");
1531 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[14]", "x", u"55");
1532 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[14]", "y", u"50");
1533 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[14]", "text", u"B");
1535 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[15]", "x", u"65");
1536 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[15]", "y", u"50");
1537 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[15]", "text", u"C");
1539 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[16]", "x", u"26");
1540 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[16]", "y", u"60");
1541 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[16]", "text", u"A");
1543 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[17]", "x", u"38");
1544 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[17]", "y", u"60");
1545 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[17]", "text", u"B");
1547 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[18]", "x", u"48");
1548 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[18]", "y", u"60");
1549 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[18]", "text", u"C");
1552 CPPUNIT_TEST_FIXTURE(Test, testTdf156577)
1554 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156577.svg");
1556 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "width", u"16");
1557 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"16");
1558 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"30");
1559 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"20");
1560 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"ABC");
1561 assertXPathNoAttribute(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx0");
1563 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", u"16");
1564 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"16");
1565 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"30");
1566 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"30");
1567 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"ABC");
1569 // Without the fix in place, this test would have failed with
1570 // - Expected: 22
1571 // - Actual : 52
1572 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx0", 22, 0.5);
1573 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx1", 52, 0.5);
1574 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx2", 93, 0.5);
1577 CPPUNIT_TEST_FIXTURE(Test, testTdf156283)
1579 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156283.svg");
1581 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "width", u"16");
1582 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"16");
1583 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"30");
1584 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"20");
1585 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"ABC");
1586 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx0", 41, 0.5);
1587 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx1", 52, 0.5);
1588 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx2", 62, 0.5);
1590 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", u"16");
1591 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"16");
1592 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"30");
1593 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"30");
1594 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"ABC");
1596 // Without the fix in place, this test would have failed with
1597 // - Expected: 41
1598 // - Actual : 12
1599 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx0", 41, 0.5);
1600 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx1", 51, 0.5);
1601 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx2", 62, 0.5);
1604 CPPUNIT_TEST_FIXTURE(Test, testTdf156569)
1606 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156569.svg");
1608 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "width", u"16");
1609 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"16");
1610 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"0");
1611 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"20");
1612 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"ABC");
1613 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx0", 40, 0.5);
1614 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx1", 80, 0.5);
1615 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[1]", "dx2", 91, 0.5);
1617 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "width", u"16");
1618 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"16");
1619 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"0");
1620 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"30");
1621 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"ABC");
1622 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx0", 40, 0.5);
1624 // Without the fix in place, this test would have failed with
1625 // - Expected: 80
1626 // - Actual : 51
1627 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx1", u"80");
1628 assertXPathDoubleValue(pDocument, "/primitive2D/transform/textsimpleportion[2]", "dx2", 91, 0.5);
1631 CPPUNIT_TEST_FIXTURE(Test, testTdf156837)
1633 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156837.svg");
1635 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion", 2);
1636 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "x", u"114");
1637 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "y", u"103");
1638 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "height", u"16");
1639 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"x ");
1640 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "x", u"126");
1642 // Without the fix in place, this test would have failed with
1643 // - Expected: 94
1644 // - Actual : 103
1645 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", u"94");
1646 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "height", u"10");
1647 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "text", u"3");
1650 CPPUNIT_TEST_FIXTURE(Test, testTdf160773)
1652 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf160773.svg");
1654 // tdf#160773 Check there is a rectangle
1655 assertXPath(pDocument, "/primitive2D/transform/mask/transform/polypolygoncolor", "color", u"#ff0000");
1657 // tdf#159661 Check there is text in the right position
1658 assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", 1);
1659 assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "x", u"0");
1660 assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "y", u"1");
1661 assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "height", u"0");
1662 assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "width", u"0");
1663 assertXPath(pDocument, "/primitive2D/transform/mask/transform/textsimpleportion", "text", u"Red");
1666 CPPUNIT_TEST_FIXTURE(Test, testTdf156271)
1668 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf156271.svg");
1670 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "width", u"16");
1671 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "height", u"16");
1672 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "x", u"40");
1673 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "y", u"10");
1674 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "text", u"AB");
1675 assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "dx0", -30, 0.5);
1676 assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/textsimpleportion[1]", "dx1", -19, 0.5);
1678 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "width", u"16");
1679 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "height", u"16");
1680 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "x", u"40");
1681 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "y", u"20");
1682 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "text", u"AB");
1684 // Without the fix in place, this test would have failed with
1685 // - Expected: -30
1686 // - Actual : 0
1687 assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "dx0", -30, 0.5);
1688 assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/textsimpleportion[2]", "dx1", -19, 0.5);
1690 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "width", u"16");
1691 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "height", u"16");
1692 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "x", u"40");
1693 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "y", u"30");
1694 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "text", u"AB");
1695 assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "dx0", -30, 0.5);
1696 assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/textsimpleportion[3]", "dx1", -19, 0.5);
1698 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "width", u"16");
1699 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "height", u"16");
1700 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "x", u"40");
1701 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "y", u"40");
1702 assertXPath(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "text", u"AB");
1703 assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "dx0", 12, 0.5);
1704 assertXPathDoubleValue(pDocument, "/primitive2D/transform/mask/textsimpleportion[4]", "dx1", 22, 0.5);
1707 CPPUNIT_TEST_FIXTURE(Test, testTdf159968)
1709 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf159968.svg");
1711 // Check no mask is applied to the marker
1712 assertXPath(pDocument,
1713 "/primitive2D/transform/transform/transform/transform/polypolygoncolor", "color", u"#000000");
1714 assertXPath(pDocument,
1715 "/primitive2D/transform/transform/transform/transform/polypolygoncolor/polypolygon/polygon/point", 5);
1718 CPPUNIT_TEST_FIXTURE(Test, testTdf160517)
1720 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf160517.svg");
1722 assertXPath(pDocument,
1723 "/primitive2D/transform/bitmap", "height", u"110");
1724 assertXPath(pDocument,
1725 "/primitive2D/transform/bitmap", "width", u"110");
1726 assertXPath(pDocument,
1727 "/primitive2D/transform/bitmap/data", 110);
1729 assertXPath(pDocument,
1730 "/primitive2D/transform/bitmap", "xy11", u"110");
1731 assertXPath(pDocument,
1732 "/primitive2D/transform/bitmap", "xy12", u"0");
1733 assertXPath(pDocument,
1734 "/primitive2D//transform/bitmap", "xy13", u"0");
1735 assertXPath(pDocument,
1736 "/primitive2D//transform/bitmap", "xy21", u"0");
1737 assertXPath(pDocument,
1738 "/primitive2D//transform/bitmap", "xy22", u"110");
1739 assertXPath(pDocument,
1740 "/primitive2D//transform/bitmap", "xy23", u"0");
1741 assertXPath(pDocument,
1742 "/primitive2D//transform/bitmap", "xy31", u"0");
1743 assertXPath(pDocument,
1744 "/primitive2D//transform/bitmap", "xy32", u"0");
1745 assertXPath(pDocument,
1746 "/primitive2D//transform/bitmap", "xy33", u"1");
1748 // Check the color of a pixel in the middle
1749 const OUString sDataRow = getXPath(pDocument, "/primitive2D/transform/bitmap/data[55]", "row");
1750 std::vector<OUString> aPixels = comphelper::string::split(sDataRow, ',');
1751 CPPUNIT_ASSERT_EQUAL(u"008100"_ustr, aPixels[55]);
1754 CPPUNIT_TEST_FIXTURE(Test, testArithmeticComposite)
1756 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/arithmetic.svg");
1758 assertXPath(pDocument,
1759 "/primitive2D/transform/transform/bitmap", "height", u"150");
1760 assertXPath(pDocument,
1761 "/primitive2D/transform/transform/bitmap", "width", u"150");
1762 assertXPath(pDocument,
1763 "/primitive2D/transform/transform/bitmap/data", 150);
1765 assertXPath(pDocument,
1766 "/primitive2D/transform/transform/bitmap", "xy11", u"150");
1767 assertXPath(pDocument,
1768 "/primitive2D/transform/transform/bitmap", "xy12", u"0");
1769 assertXPath(pDocument,
1770 "/primitive2D/transform/transform/bitmap", "xy13", u"0");
1771 assertXPath(pDocument,
1772 "/primitive2D/transform/transform/bitmap", "xy21", u"0");
1773 assertXPath(pDocument,
1774 "/primitive2D/transform/transform/bitmap", "xy22", u"150");
1775 assertXPath(pDocument,
1776 "/primitive2D/transform/transform/bitmap", "xy23", u"0");
1777 assertXPath(pDocument,
1778 "/primitive2D/transform/transform/bitmap", "xy31", u"0");
1779 assertXPath(pDocument,
1780 "/primitive2D/transform/transform/bitmap", "xy32", u"0");
1781 assertXPath(pDocument,
1782 "/primitive2D/transform/transform/bitmap", "xy33", u"1");
1784 // Check the colors in the diagonal
1785 OUString sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[25]", "row");
1786 std::vector<OUString> aPixels = comphelper::string::split(sDataRow, ',');
1787 CPPUNIT_ASSERT_EQUAL(u"000000"_ustr, aPixels[25]);
1789 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[75]", "row");
1790 aPixels = comphelper::string::split(sDataRow, ',');
1791 CPPUNIT_ASSERT_EQUAL(u"ff8000"_ustr, aPixels[75]);
1793 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[125]", "row");
1794 aPixels = comphelper::string::split(sDataRow, ',');
1795 CPPUNIT_ASSERT_EQUAL(u"ff8000"_ustr, aPixels[125]);
1798 CPPUNIT_TEST_FIXTURE(Test, testArithmeticComposite2)
1800 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/arithmetic2.svg");
1802 assertXPath(pDocument,
1803 "/primitive2D/transform/transform/bitmap", "height", u"150");
1804 assertXPath(pDocument,
1805 "/primitive2D/transform/transform/bitmap", "width", u"150");
1806 assertXPath(pDocument,
1807 "/primitive2D/transform/transform/bitmap/data", 150);
1809 assertXPath(pDocument,
1810 "/primitive2D/transform/transform/bitmap", "xy11", u"150");
1811 assertXPath(pDocument,
1812 "/primitive2D/transform/transform/bitmap", "xy12", u"0");
1813 assertXPath(pDocument,
1814 "/primitive2D/transform/transform/bitmap", "xy13", u"0");
1815 assertXPath(pDocument,
1816 "/primitive2D/transform/transform/bitmap", "xy21", u"0");
1817 assertXPath(pDocument,
1818 "/primitive2D/transform/transform/bitmap", "xy22", u"150");
1819 assertXPath(pDocument,
1820 "/primitive2D/transform/transform/bitmap", "xy23", u"0");
1821 assertXPath(pDocument,
1822 "/primitive2D/transform/transform/bitmap", "xy31", u"0");
1823 assertXPath(pDocument,
1824 "/primitive2D/transform/transform/bitmap", "xy32", u"0");
1825 assertXPath(pDocument,
1826 "/primitive2D/transform/transform/bitmap", "xy33", u"1");
1828 // Check the colors in the diagonal
1829 OUString sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[25]", "row");
1830 std::vector<OUString> aPixels = comphelper::string::split(sDataRow, ',');
1831 CPPUNIT_ASSERT_EQUAL(u"ff0000"_ustr, aPixels[25]);
1833 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[75]", "row");
1834 aPixels = comphelper::string::split(sDataRow, ',');
1835 CPPUNIT_ASSERT_EQUAL(u"ff8000"_ustr, aPixels[75]);
1837 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[125]", "row");
1838 aPixels = comphelper::string::split(sDataRow, ',');
1839 CPPUNIT_ASSERT_EQUAL(u"008000"_ustr, aPixels[125]);
1842 CPPUNIT_TEST_FIXTURE(Test, testTdf160726)
1844 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf160726.svg");
1846 assertXPath(pDocument,
1847 "/primitive2D/transform/transform/bitmap", "height", u"250");
1848 assertXPath(pDocument,
1849 "/primitive2D/transform/transform/bitmap", "width", u"250");
1850 assertXPath(pDocument,
1851 "/primitive2D/transform/transform/bitmap/data", 250);
1853 assertXPath(pDocument,
1854 "/primitive2D/transform/transform/bitmap", "xy11", u"250");
1855 assertXPath(pDocument,
1856 "/primitive2D/transform/transform/bitmap", "xy12", u"0");
1857 assertXPath(pDocument,
1858 "/primitive2D/transform/transform/bitmap", "xy13", u"0");
1859 assertXPath(pDocument,
1860 "/primitive2D/transform/transform/bitmap", "xy21", u"0");
1861 assertXPath(pDocument,
1862 "/primitive2D/transform/transform/bitmap", "xy22", u"250");
1863 assertXPath(pDocument,
1864 "/primitive2D/transform/transform/bitmap", "xy23", u"0");
1865 assertXPath(pDocument,
1866 "/primitive2D/transform/transform/bitmap", "xy31", u"0");
1867 assertXPath(pDocument,
1868 "/primitive2D/transform/transform/bitmap", "xy32", u"0");
1869 assertXPath(pDocument,
1870 "/primitive2D/transform/transform/bitmap", "xy33", u"1");
1872 // Check the colors in the diagonal
1873 OUString sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[50]", "row");
1874 std::vector<OUString> aPixels = comphelper::string::split(sDataRow, ',');
1875 CPPUNIT_ASSERT_EQUAL(u"ff0000"_ustr, aPixels[50]);
1877 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[125]", "row");
1878 aPixels = comphelper::string::split(sDataRow, ',');
1879 CPPUNIT_ASSERT_EQUAL(u"ffff00"_ustr, aPixels[125]);
1881 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[200]", "row");
1882 aPixels = comphelper::string::split(sDataRow, ',');
1883 CPPUNIT_ASSERT_EQUAL(u"ffff00"_ustr, aPixels[200]);
1886 CPPUNIT_TEST_FIXTURE(Test, testTdf160782)
1888 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf160782.svg");
1890 assertXPath(pDocument,
1891 "/primitive2D/transform/transform/bitmap", "height", u"255");
1892 assertXPath(pDocument,
1893 "/primitive2D/transform/transform/bitmap", "width", u"255");
1894 assertXPath(pDocument,
1895 "/primitive2D/transform/transform/bitmap/data", 255);
1897 assertXPath(pDocument,
1898 "/primitive2D/transform/transform/bitmap", "xy11", u"255");
1899 assertXPath(pDocument,
1900 "/primitive2D/transform/transform/bitmap", "xy12", u"0");
1901 assertXPath(pDocument,
1902 "/primitive2D/transform/transform/bitmap", "xy13", u"0");
1903 assertXPath(pDocument,
1904 "/primitive2D/transform/transform/bitmap", "xy21", u"0");
1905 assertXPath(pDocument,
1906 "/primitive2D/transform/transform/bitmap", "xy22", u"255");
1907 assertXPath(pDocument,
1908 "/primitive2D/transform/transform/bitmap", "xy23", u"0");
1909 assertXPath(pDocument,
1910 "/primitive2D/transform/transform/bitmap", "xy31", u"0");
1911 assertXPath(pDocument,
1912 "/primitive2D/transform/transform/bitmap", "xy32", u"0");
1913 assertXPath(pDocument,
1914 "/primitive2D/transform/transform/bitmap", "xy33", u"1");
1916 // Check the colors in the diagonal
1917 OUString sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[50]", "row");
1918 std::vector<OUString> aPixels = comphelper::string::split(sDataRow, ',');
1919 CPPUNIT_ASSERT_EQUAL(u"ff0000"_ustr, aPixels[50]);
1921 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[125]", "row");
1922 aPixels = comphelper::string::split(sDataRow, ',');
1923 CPPUNIT_ASSERT_EQUAL(u"ffff00"_ustr, aPixels[125]);
1925 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[200]", "row");
1926 aPixels = comphelper::string::split(sDataRow, ',');
1927 CPPUNIT_ASSERT_EQUAL(u"ffff00"_ustr, aPixels[200]);
1930 CPPUNIT_TEST_FIXTURE(Test, testScreenBlend)
1932 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/screenBlend.svg");
1934 assertXPath(pDocument,
1935 "/primitive2D/transform/transform/bitmap", "height", u"150");
1936 assertXPath(pDocument,
1937 "/primitive2D/transform/transform/bitmap", "width", u"150");
1938 assertXPath(pDocument,
1939 "/primitive2D/transform/transform/bitmap/data", 150);
1941 assertXPath(pDocument,
1942 "/primitive2D/transform/transform/bitmap", "xy11", u"150");
1943 assertXPath(pDocument,
1944 "/primitive2D/transform/transform/bitmap", "xy12", u"0");
1945 assertXPath(pDocument,
1946 "/primitive2D/transform/transform/bitmap", "xy13", u"0");
1947 assertXPath(pDocument,
1948 "/primitive2D/transform/transform/bitmap", "xy21", u"0");
1949 assertXPath(pDocument,
1950 "/primitive2D/transform/transform/bitmap", "xy22", u"150");
1951 assertXPath(pDocument,
1952 "/primitive2D/transform/transform/bitmap", "xy23", u"0");
1953 assertXPath(pDocument,
1954 "/primitive2D/transform/transform/bitmap", "xy31", u"0");
1955 assertXPath(pDocument,
1956 "/primitive2D/transform/transform/bitmap", "xy32", u"0");
1957 assertXPath(pDocument,
1958 "/primitive2D/transform/transform/bitmap", "xy33", u"1");
1960 // Check the colors in the diagonal
1961 OUString sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[25]", "row");
1962 std::vector<OUString> aPixels = comphelper::string::split(sDataRow, ',');
1963 CPPUNIT_ASSERT_EQUAL(u"ff0000"_ustr, aPixels[25]);
1965 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[75]", "row");
1966 aPixels = comphelper::string::split(sDataRow, ',');
1967 CPPUNIT_ASSERT_EQUAL(u"ff8000"_ustr, aPixels[75]);
1969 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[125]", "row");
1970 aPixels = comphelper::string::split(sDataRow, ',');
1971 CPPUNIT_ASSERT_EQUAL(u"008000"_ustr, aPixels[125]);
1974 CPPUNIT_TEST_FIXTURE(Test, testMultiplyBlend)
1976 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/multiplyBlend.svg");
1978 assertXPath(pDocument,
1979 "/primitive2D/transform/transform/bitmap", "height", u"150");
1980 assertXPath(pDocument,
1981 "/primitive2D/transform/transform/bitmap", "width", u"150");
1982 assertXPath(pDocument,
1983 "/primitive2D/transform/transform/bitmap/data", 150);
1985 assertXPath(pDocument,
1986 "/primitive2D/transform/transform/bitmap", "xy11", u"150");
1987 assertXPath(pDocument,
1988 "/primitive2D/transform/transform/bitmap", "xy12", u"0");
1989 assertXPath(pDocument,
1990 "/primitive2D/transform/transform/bitmap", "xy13", u"0");
1991 assertXPath(pDocument,
1992 "/primitive2D/transform/transform/bitmap", "xy21", u"0");
1993 assertXPath(pDocument,
1994 "/primitive2D/transform/transform/bitmap", "xy22", u"150");
1995 assertXPath(pDocument,
1996 "/primitive2D/transform/transform/bitmap", "xy23", u"0");
1997 assertXPath(pDocument,
1998 "/primitive2D/transform/transform/bitmap", "xy31", u"0");
1999 assertXPath(pDocument,
2000 "/primitive2D/transform/transform/bitmap", "xy32", u"0");
2001 assertXPath(pDocument,
2002 "/primitive2D/transform/transform/bitmap", "xy33", u"1");
2004 // Check the colors in the diagonal
2005 OUString sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[25]", "row");
2006 std::vector<OUString> aPixels = comphelper::string::split(sDataRow, ',');
2007 CPPUNIT_ASSERT_EQUAL(u"ff0000"_ustr, aPixels[25]);
2009 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[75]", "row");
2010 aPixels = comphelper::string::split(sDataRow, ',');
2011 CPPUNIT_ASSERT_EQUAL(u"000000"_ustr, aPixels[75]);
2013 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[125]", "row");
2014 aPixels = comphelper::string::split(sDataRow, ',');
2015 CPPUNIT_ASSERT_EQUAL(u"008000"_ustr, aPixels[125]);
2018 CPPUNIT_TEST_FIXTURE(Test, testDarkenBlend)
2020 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/darkenBlend.svg");
2022 assertXPath(pDocument,
2023 "/primitive2D/transform/transform/bitmap", "height", u"150");
2024 assertXPath(pDocument,
2025 "/primitive2D/transform/transform/bitmap", "width", u"150");
2026 assertXPath(pDocument,
2027 "/primitive2D/transform/transform/bitmap/data", 150);
2029 assertXPath(pDocument,
2030 "/primitive2D/transform/transform/bitmap", "xy11", u"150");
2031 assertXPath(pDocument,
2032 "/primitive2D/transform/transform/bitmap", "xy12", u"0");
2033 assertXPath(pDocument,
2034 "/primitive2D/transform/transform/bitmap", "xy13", u"0");
2035 assertXPath(pDocument,
2036 "/primitive2D/transform/transform/bitmap", "xy21", u"0");
2037 assertXPath(pDocument,
2038 "/primitive2D/transform/transform/bitmap", "xy22", u"150");
2039 assertXPath(pDocument,
2040 "/primitive2D/transform/transform/bitmap", "xy23", u"0");
2041 assertXPath(pDocument,
2042 "/primitive2D/transform/transform/bitmap", "xy31", u"0");
2043 assertXPath(pDocument,
2044 "/primitive2D/transform/transform/bitmap", "xy32", u"0");
2045 assertXPath(pDocument,
2046 "/primitive2D/transform/transform/bitmap", "xy33", u"1");
2048 // Check the colors in the diagonal
2049 OUString sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[25]", "row");
2050 std::vector<OUString> aPixels = comphelper::string::split(sDataRow, ',');
2051 CPPUNIT_ASSERT_EQUAL(u"ff0000"_ustr, aPixels[25]);
2053 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[75]", "row");
2054 aPixels = comphelper::string::split(sDataRow, ',');
2055 CPPUNIT_ASSERT_EQUAL(u"000000"_ustr, aPixels[75]);
2057 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[125]", "row");
2058 aPixels = comphelper::string::split(sDataRow, ',');
2059 CPPUNIT_ASSERT_EQUAL(u"008000"_ustr, aPixels[125]);
2062 CPPUNIT_TEST_FIXTURE(Test, testLightenBlend)
2064 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/lightenBlend.svg");
2066 assertXPath(pDocument,
2067 "/primitive2D/transform/transform/bitmap", "height", u"150");
2068 assertXPath(pDocument,
2069 "/primitive2D/transform/transform/bitmap", "width", u"150");
2070 assertXPath(pDocument,
2071 "/primitive2D/transform/transform/bitmap/data", 150);
2073 assertXPath(pDocument,
2074 "/primitive2D/transform/transform/bitmap", "xy11", u"150");
2075 assertXPath(pDocument,
2076 "/primitive2D/transform/transform/bitmap", "xy12", u"0");
2077 assertXPath(pDocument,
2078 "/primitive2D/transform/transform/bitmap", "xy13", u"0");
2079 assertXPath(pDocument,
2080 "/primitive2D/transform/transform/bitmap", "xy21", u"0");
2081 assertXPath(pDocument,
2082 "/primitive2D/transform/transform/bitmap", "xy22", u"150");
2083 assertXPath(pDocument,
2084 "/primitive2D/transform/transform/bitmap", "xy23", u"0");
2085 assertXPath(pDocument,
2086 "/primitive2D/transform/transform/bitmap", "xy31", u"0");
2087 assertXPath(pDocument,
2088 "/primitive2D/transform/transform/bitmap", "xy32", u"0");
2089 assertXPath(pDocument,
2090 "/primitive2D/transform/transform/bitmap", "xy33", u"1");
2092 // Check the colors in the diagonal
2093 OUString sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[25]", "row");
2094 std::vector<OUString> aPixels = comphelper::string::split(sDataRow, ',');
2095 CPPUNIT_ASSERT_EQUAL(u"ff0000"_ustr, aPixels[25]);
2097 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[75]", "row");
2098 aPixels = comphelper::string::split(sDataRow, ',');
2099 CPPUNIT_ASSERT_EQUAL(u"ff8000"_ustr, aPixels[75]);
2101 sDataRow = getXPath(pDocument, "/primitive2D/transform/transform/bitmap/data[125]", "row");
2102 aPixels = comphelper::string::split(sDataRow, ',');
2103 CPPUNIT_ASSERT_EQUAL(u"008000"_ustr, aPixels[125]);
2106 CPPUNIT_TEST_FIXTURE(Test, testTdf149880)
2108 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tdf149880.svg");
2110 // Without the fix in place, this test would have failed with
2111 // - Expected: 1
2112 // - Actual : 0
2113 // - In <>, XPath '/primitive2D/transform/mask/unhandled' number of nodes is incorrect
2114 assertXPath(pDocument,
2115 "/primitive2D/transform/mask/unhandled", "id", u"PATTERNFILL");
2116 assertXPath(pDocument,
2117 "/primitive2D/transform/mask/unhandled/mask/transform/transform/bitmap", 28);
2120 CPPUNIT_TEST_FIXTURE(Test, testCssClassRedefinition)
2122 // Tests for svg css class redefinition behavior
2123 // Example:
2124 // .c1 {fill:#00ff00}
2125 // .c1 {font-family:Sans}
2126 // .c1 {fill:#ff0000}
2127 // Expected result is .c1 {font-family:Sans; fill:#ff0000} because
2128 // the second redefinition appends attributes to the class and the
2129 // third redefinition replaces the already existing
2130 // attribute in the original definition
2131 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/CssClassRedefinition.svg");
2133 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "text", u"012");
2134 assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", u"#ff0000");
2135 assertXPath(
2136 pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", u"Open Symbol");
2139 CPPUNIT_TEST_FIXTURE(Test, testTspanFillOpacity)
2141 // Given an SVG file with <tspan fill-opacity="0.30">:
2142 // When rendering that SVG:
2143 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/tspan-fill-opacity.svg");
2145 // Then make sure that the text portion is wrapped in a transparency primitive with the correct
2146 // transparency value:
2147 sal_Int32 nTransparence = getXPath(pDocument, "//textsimpleportion[@text='hello']/parent::unifiedtransparence", "transparence").toInt32();
2148 // Without the accompanying fix in place, this test would have failed with:
2149 // - Expected: 1
2150 // - Actual : 0
2151 // - XPath '//textsimpleportion[@text='hello']/parent::unifiedtransparence' number of nodes is incorrect
2152 // i.e. the relevant <textsimpleportion> had no <unifiedtransparence> parent, the text was not
2153 // semi-transparent.
2154 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(70), nTransparence);
2157 CPPUNIT_TEST_FIXTURE(Test, testDyInEms)
2159 // tdf#160593 given an SVG file with <tspan dy="1.5em" style="font-size:0.5em">:
2160 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/dy_in_ems.svg");
2162 assertXPath(pDocument, "//textsimpleportion", 2);
2163 assertXPath(pDocument, "//textsimpleportion[1]", "y", u"20");
2164 // Then make sure that the vertical offset is based on font-size of tspan, not of its parent.
2165 // Given the parent's font-size is 16 px, the expected vertical offset is 1.5 * (16 * 0.5) = 12,
2166 // which means that the resulting y is expected to be 20 + 12 = 32.
2167 // Without the accompanying fix in place, this test would have failed with:
2168 // - Expected: 32
2169 // - Actual : 44
2170 // i.e. the offset was calculated as 1.5 multiplied by the parent's font-size of 16 px,
2171 // not by the current tspan's half font-size.
2172 assertXPath(pDocument, "//textsimpleportion[2]", "y", u"32");
2175 CPPUNIT_TEST_FIXTURE(Test, testExs)
2177 // tdf#160594, tdf#160717 given an SVG file with <tspan dy="3ex" style="font-size:1ex">:
2178 xmlDocUniquePtr pDocument = dumpAndParseSvg(u"/svgio/qa/cppunit/data/dy_in_exs.svg");
2180 assertXPath(pDocument, "//textsimpleportion", 2);
2181 assertXPath(pDocument, "//textsimpleportion[1]", "height", u"16");
2182 assertXPath(pDocument, "//textsimpleportion[1]", "y", u"20");
2184 sal_Int32 nSize = getXPath(pDocument, "//textsimpleportion[2]", "height").toInt32();
2185 // Without the accompanying fix in place, this test would have failed with:
2186 // - Expected less than: 16
2187 // - Actual : 16
2188 // i.e. the parent font-size was used, instead of its x-size.
2189 CPPUNIT_ASSERT_LESS(sal_Int32(16), nSize);
2191 sal_Int32 nYPos = getXPath(pDocument, "//textsimpleportion[2]", "y").toInt32();
2192 // Then make sure that the vertical offset is based on x-size of tspan, not of its parent.
2193 // Given the tspan's font-size is nSize, its x-size is less than nSize, and the expected
2194 // vertical offset is less than 3 * nSize, which means that the resulting y is expected
2195 // to be strictly less than 20 + 3 * nSize.
2196 // Without the accompanying fix in place, this test would have failed with:
2197 // - Expected less than: 44
2198 // - Actual : 44
2199 // i.e. the parent x-size (or current font-size) was used, instead of current x-size.
2200 CPPUNIT_ASSERT_LESS(sal_Int32(20 + 3 * nSize), nYPos);
2203 CPPUNIT_PLUGIN_IMPLEMENT();
2205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */