1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #include <sal/config.h>
12 #include <test/bootstrapfixture.hxx>
13 #include <test/xmltesttools.hxx>
15 #include <comphelper/seqstream.hxx>
17 #include <com/sun/star/graphic/SvgTools.hpp>
18 #include <com/sun/star/graphic/XPrimitive2D.hpp>
20 #include <drawinglayer/primitive2d/Tools.hxx>
21 #include <drawinglayer/tools/primitive2dxmldump.hxx>
22 #include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
25 #include <string_view>
28 using namespace css::uno
;
29 using namespace css::io
;
30 using namespace css::graphic
;
31 using drawinglayer::primitive2d::Primitive2DSequence
;
32 using drawinglayer::primitive2d::Primitive2DContainer
;
33 using drawinglayer::primitive2d::Primitive2DReference
;
35 class Test
: public test::BootstrapFixture
, public XmlTestTools
38 void checkRectPrimitive(Primitive2DSequence
const & rPrimitive
);
40 Primitive2DSequence
parseSvg(std::u16string_view aSource
);
43 Primitive2DSequence
Test::parseSvg(std::u16string_view aSource
)
45 const Reference
<XSvgParser
> xSvgParser
= SvgTools::create(m_xContext
);
47 OUString aUrl
= m_directories
.getURLFromSrc(aSource
);
48 OUString aPath
= m_directories
.getPathFromSrc(aSource
);
50 SvFileStream
aFileStream(aUrl
, StreamMode::READ
);
51 std::size_t nSize
= aFileStream
.remainingSize();
52 std::unique_ptr
<sal_Int8
[]> pBuffer(new sal_Int8
[nSize
+ 1]);
53 aFileStream
.ReadBytes(pBuffer
.get(), nSize
);
56 Sequence
<sal_Int8
> aData(pBuffer
.get(), nSize
+ 1);
57 Reference
<XInputStream
> aInputStream(new comphelper::SequenceInputStream(aData
));
59 return xSvgParser
->getDecomposition(aInputStream
, aPath
);
62 void Test::checkRectPrimitive(Primitive2DSequence
const & rPrimitive
)
64 drawinglayer::Primitive2dXmlDump dumper
;
65 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(rPrimitive
));
67 CPPUNIT_ASSERT (pDocument
);
69 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor", "color", "#00cc00"); // rect background color
70 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", "100"); // rect background height
71 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", "100"); // rect background width
72 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", "10");
73 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", "10");
74 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", "110");
75 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", "110");
76 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line", "color", "#ff0000"); // rect stroke color
77 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line", "width", "3"); // rect stroke width
84 bool arePrimitive2DSequencesEqual(const Primitive2DSequence
& rA
, const Primitive2DSequence
& rB
)
86 return std::equal(rA
.begin(), rA
.end(), rB
.begin(), rB
.end(),
87 [](const css::uno::Reference
<css::graphic::XPrimitive2D
>& a
,
88 const css::uno::Reference
<css::graphic::XPrimitive2D
>& b
)
90 return drawinglayer::primitive2d::arePrimitive2DReferencesEqual(a
, b
);
95 // Attributes for an object (like rect as in this case) can be defined
96 // in different ways (directly with xml attributes, or with CSS styles),
97 // however the end result should be the same.
98 CPPUNIT_TEST_FIXTURE(Test
, testStyles
)
100 Primitive2DSequence aSequenceRect
= parseSvg(u
"/svgio/qa/cppunit/data/Rect.svg");
101 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRect
.getLength()));
102 checkRectPrimitive(aSequenceRect
);
104 Primitive2DSequence aSequenceRectWithStyle
= parseSvg(u
"/svgio/qa/cppunit/data/RectWithStyles.svg");
105 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithStyle
.getLength()));
106 checkRectPrimitive(aSequenceRectWithStyle
);
108 Primitive2DSequence aSequenceRectWithParentStyle
= parseSvg(u
"/svgio/qa/cppunit/data/RectWithParentStyles.svg");
109 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithParentStyle
.getLength()));
110 checkRectPrimitive(aSequenceRectWithParentStyle
);
112 Primitive2DSequence aSequenceRectWithStylesByGroup
= parseSvg(u
"/svgio/qa/cppunit/data/RectWithStylesByGroup.svg");
113 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithStylesByGroup
.getLength()));
114 checkRectPrimitive(aSequenceRectWithStylesByGroup
);
116 CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect
, aSequenceRectWithStyle
));
117 CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect
, aSequenceRectWithParentStyle
));
118 CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect
, aSequenceRectWithStylesByGroup
));
121 CPPUNIT_TEST_FIXTURE(Test
, testSymbol
)
123 Primitive2DSequence aSequenceTdf87309
= parseSvg(u
"/svgio/qa/cppunit/data/symbol.svg");
124 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf87309
.getLength()));
126 drawinglayer::Primitive2dXmlDump dumper
;
127 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf87309
);
129 CPPUNIT_ASSERT (pDocument
);
131 // tdf#126330: Without the fix in place, this test would have failed with
134 // number of nodes is incorrect
135 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor", "color", "#00d000");
138 CPPUNIT_TEST_FIXTURE(Test
, testTdf150124
)
140 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf150124.svg");
141 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
143 drawinglayer::Primitive2dXmlDump dumper
;
144 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
146 CPPUNIT_ASSERT (pDocument
);
148 assertXPathChildren(pDocument
, "/primitive2D", 1);
149 assertXPath(pDocument
, "/primitive2D/hiddengeometry", 1);
152 CPPUNIT_TEST_FIXTURE(Test
, testTdf155819
)
154 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf155819.svg");
155 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
157 drawinglayer::Primitive2dXmlDump dumper
;
158 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
160 CPPUNIT_ASSERT (pDocument
);
162 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line", 1);
163 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/polypolygon", 1);
164 // Without the fix in place, this test would have failed with
167 assertXPath(pDocument
, "/primitive2D/transform/transform", 4);
170 CPPUNIT_TEST_FIXTURE(Test
, testFeColorMatrix
)
172 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeColorMatrix.svg");
173 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
175 drawinglayer::Primitive2dXmlDump dumper
;
176 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
178 CPPUNIT_ASSERT (pDocument
);
180 assertXPath(pDocument
, "/primitive2D/transform/mask/modifiedColor[1]", "modifier", "matrix");
181 assertXPath(pDocument
, "/primitive2D/transform/mask/modifiedColor[2]", "modifier", "saturate");
182 assertXPath(pDocument
, "/primitive2D/transform/mask/modifiedColor[3]", "modifier", "hueRotate");
183 assertXPath(pDocument
, "/primitive2D/transform/mask/modifiedColor[4]", "modifier", "luminance_to_alpha");
186 CPPUNIT_TEST_FIXTURE(Test
, testFilterFeGaussianBlur
)
188 Primitive2DSequence aSequenceTdf132246
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeGaussianBlur.svg");
189 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246
.getLength()));
191 drawinglayer::Primitive2dXmlDump dumper
;
192 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf132246
);
194 CPPUNIT_ASSERT (pDocument
);
196 assertXPath(pDocument
, "/primitive2D/transform/softedge", "radius", "5");
199 CPPUNIT_TEST_FIXTURE(Test
, testFilterFeOffset
)
201 Primitive2DSequence aSequenceTdf132246
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeOffset.svg");
202 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246
.getLength()));
204 drawinglayer::Primitive2dXmlDump dumper
;
205 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf132246
);
207 CPPUNIT_ASSERT (pDocument
);
209 assertXPath(pDocument
, "/primitive2D/transform/mask/transform", "xy11", "1");
210 assertXPath(pDocument
, "/primitive2D/transform/mask/transform", "xy12", "0");
211 assertXPath(pDocument
, "/primitive2D/transform/mask/transform", "xy13", "44");
212 assertXPath(pDocument
, "/primitive2D/transform/mask/transform", "xy21", "0");
213 assertXPath(pDocument
, "/primitive2D/transform/mask/transform", "xy22", "1");
214 assertXPath(pDocument
, "/primitive2D/transform/mask/transform", "xy23", "66");
215 assertXPath(pDocument
, "/primitive2D/transform/mask/transform", "xy31", "0");
216 assertXPath(pDocument
, "/primitive2D/transform/mask/transform", "xy32", "0");
217 assertXPath(pDocument
, "/primitive2D/transform/mask/transform", "xy33", "1");
220 CPPUNIT_TEST_FIXTURE(Test
, testFilterFeFlood
)
222 Primitive2DSequence aSequenceTdf132246
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeFlood.svg");
223 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246
.getLength()));
225 drawinglayer::Primitive2dXmlDump dumper
;
226 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf132246
);
228 CPPUNIT_ASSERT (pDocument
);
230 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence", "transparence", "50");
231 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor", "color", "#008000");
232 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon", "height", "100");
233 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon", "width", "100");
234 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon", "minx", "50");
235 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon", "miny", "50");
238 CPPUNIT_TEST_FIXTURE(Test
, testFilterFeDropShadow
)
240 Primitive2DSequence aSequenceTdf132246
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeDropShadow.svg");
241 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246
.getLength()));
243 drawinglayer::Primitive2dXmlDump dumper
;
244 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf132246
);
246 CPPUNIT_ASSERT (pDocument
);
248 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence", "transparence", "50");
249 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/shadow", "color", "#0000ff");
250 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/shadow", "blur", "0.2");
251 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/shadow", "blur", "0.2");
252 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor", "color", "#ffc0cb");
255 CPPUNIT_TEST_FIXTURE(Test
, testFilterFeImage
)
257 Primitive2DSequence aSequenceTdf132246
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeImage.svg");
258 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246
.getLength()));
260 drawinglayer::Primitive2dXmlDump dumper
;
261 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf132246
);
263 CPPUNIT_ASSERT (pDocument
);
265 assertXPath(pDocument
, "/primitive2D/transform/transform/bitmap");
268 CPPUNIT_TEST_FIXTURE(Test
, testTdf87309
)
270 Primitive2DSequence aSequenceTdf87309
= parseSvg(u
"/svgio/qa/cppunit/data/tdf87309.svg");
271 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf87309
.getLength()));
273 drawinglayer::Primitive2dXmlDump dumper
;
274 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf87309
);
276 CPPUNIT_ASSERT (pDocument
);
278 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor", "color", "#000000");
279 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", "100");
280 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", "100");
281 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", "10");
282 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", "10");
283 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", "110");
284 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", "110");
287 CPPUNIT_TEST_FIXTURE(Test
, testFontsizeKeywords
)
289 Primitive2DSequence aSequenceFontsizeKeywords
= parseSvg(u
"/svgio/qa/cppunit/data/FontsizeKeywords.svg");
290 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeKeywords
.getLength()));
292 drawinglayer::Primitive2dXmlDump dumper
;
293 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceFontsizeKeywords
);
295 CPPUNIT_ASSERT (pDocument
);
297 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#000000");
298 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "Sample");
299 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "9");
300 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Times New Roman");
302 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", "#ffffff");
303 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", "Sample");
304 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "height", "11");
305 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "familyname", "Times New Roman");
307 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "fontcolor", "#ffd700");
308 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "text", "Sample");
309 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "height", "13");
310 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "familyname", "Times New Roman");
312 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "fontcolor", "#ff0000");
313 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "text", "Sample");
314 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "height", "16");
315 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "familyname", "Times New Roman");
317 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "fontcolor", "#ffff00");
318 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "text", "Sample");
319 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "height", "19");
320 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "familyname", "Times New Roman");
322 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "fontcolor", "#0000ff");
323 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "text", "Sample");
324 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "height", "23");
325 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "familyname", "Times New Roman");
327 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "fontcolor", "#008000");
328 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "text", "Sample");
329 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "height", "27");
330 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "familyname", "Times New Roman");
332 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "fontcolor", "#ff7f50");
333 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "text", "Sample");
334 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "height", "13");
335 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "familyname", "Times New Roman");
337 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "fontcolor", "#ffc0cb");
338 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "text", "Sample");
339 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "height", "19");
340 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "familyname", "Times New Roman");
342 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]", "fontcolor", "#fffff0");
343 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]", "text", "Sample");
344 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]", "height", "16");
345 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "familyname", "Times New Roman");
349 CPPUNIT_TEST_FIXTURE(Test
, testFontsizePercentage
)
351 //Check when font-size uses percentage and defined globally
352 Primitive2DSequence aSequenceFontsizePercentage
= parseSvg(u
"/svgio/qa/cppunit/data/FontsizePercentage.svg");
353 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizePercentage
.getLength()));
355 drawinglayer::Primitive2dXmlDump dumper
;
356 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceFontsizePercentage
);
358 CPPUNIT_ASSERT (pDocument
);
360 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#000000");
361 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "Sample");
362 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "16");
363 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Times New Roman");
366 CPPUNIT_TEST_FIXTURE(Test
, testFontsizeRelative
)
368 //Check when font-size uses relative units (em,ex) and it's based on its parent's font-size
369 Primitive2DSequence aSequenceFontsizeRelative
= parseSvg(u
"/svgio/qa/cppunit/data/FontsizeRelative.svg");
370 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeRelative
.getLength()));
372 drawinglayer::Primitive2dXmlDump dumper
;
373 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceFontsizeRelative
);
375 CPPUNIT_ASSERT (pDocument
);
377 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#000000");
378 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "Sample");
379 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "50");
380 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "familyname", "serif");
382 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", "#000000");
383 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", "Sample");
384 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "height", "50");
385 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "familyname", "serif");
388 CPPUNIT_TEST_FIXTURE(Test
, testTdf145896
)
390 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf145896.svg");
391 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
393 drawinglayer::Primitive2dXmlDump dumper
;
394 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
396 CPPUNIT_ASSERT (pDocument
);
398 // Without the fix in place, this test would have failed with
399 // - Expected: #ffff00
400 // - Actual : #000000
401 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]", "color", "#ffff00");
402 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]", "color", "#008000");
403 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]", "color", "#0000ff");
406 CPPUNIT_TEST_FIXTURE(Test
, testTdf156168
)
408 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156168.svg");
409 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
411 drawinglayer::Primitive2dXmlDump dumper
;
412 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
414 CPPUNIT_ASSERT (pDocument
);
416 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor", 8);
417 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]", "color", "#0000ff");
418 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]", "color", "#0000ff");
419 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]", "color", "#ff0000");
420 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[4]", "color", "#ff0000");
421 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[5]", "color", "#000000");
422 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[6]", "color", "#000000");
423 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[7]", "color", "#ff0000");
424 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[8]", "color", "#ff0000");
426 // Without the fix in place, this test would have failed with
429 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke", 4);
430 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[1]/line", "width", "5");
432 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[1]/line", "color", "#00ff00");
433 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[2]/line", "width", "5");
435 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[2]/line", "color", "#00ff00");
436 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[3]/line", "width", "5");
438 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[3]/line", "color", "#00ff00");
439 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[4]/line", "width", "5");
441 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[4]/line", "color", "#00ff00");
444 CPPUNIT_TEST_FIXTURE(Test
, testTdf129356
)
446 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf129356.svg");
447 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
449 drawinglayer::Primitive2dXmlDump dumper
;
450 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
452 CPPUNIT_ASSERT (pDocument
);
454 // Without the fix in place, this test would have failed with
455 // - Expected: #008000
456 // - Actual : #0000ff
457 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]", "color", "#008000");
458 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]", "color", "#008000");
459 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]", "color", "#008000");
460 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[4]", "color", "#008000");
461 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[5]", "color", "#008000");
462 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[6]", "color", "#008000");
463 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[7]", "color", "#008000");
464 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[8]", "color", "#008000");
467 CPPUNIT_TEST_FIXTURE(Test
, testTdf156034
)
469 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156034.svg");
470 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
472 drawinglayer::Primitive2dXmlDump dumper
;
473 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
475 CPPUNIT_ASSERT (pDocument
);
477 // Without the fix in place, this test would have failed with
478 // - Expected: #008000
479 // - Actual : #0000ff
480 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]", "color", "#008000");
481 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]", "color", "#008000");
482 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]", "color", "#008000");
483 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[4]", "color", "#008000");
486 CPPUNIT_TEST_FIXTURE(Test
, testTdf156038
)
488 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156038.svg");
489 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
491 drawinglayer::Primitive2dXmlDump dumper
;
492 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
494 CPPUNIT_ASSERT (pDocument
);
496 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]", "color", "#0000ff");
498 // Without the fix in place, this test would have failed with
499 // - Expected: #008000
500 // - Actual : #0000ff
501 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]", "color", "#008000");
502 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]", "color", "#0000ff");
503 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[4]", "color", "#008000");
504 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[5]", "color", "#0000ff");
505 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[6]", "color", "#008000");
506 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[7]", "color", "#0000ff");
507 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[8]", "color", "#008000");
510 CPPUNIT_TEST_FIXTURE(Test
, testTdf156018
)
512 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156018.svg");
513 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
515 drawinglayer::Primitive2dXmlDump dumper
;
516 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
518 CPPUNIT_ASSERT (pDocument
);
520 // Without the fix in place, this test would have failed with
521 // - Expected: #008000
522 // - Actual : #0000ff
523 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]", "color", "#008000");
524 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]", "color", "#0000ff");
527 CPPUNIT_TEST_FIXTURE(Test
, testTdf156201
)
529 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156201.svg");
530 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
532 drawinglayer::Primitive2dXmlDump dumper
;
533 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
535 CPPUNIT_ASSERT (pDocument
);
537 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/polypolygoncolor", "color", "#2f3ba1");
540 CPPUNIT_TEST_FIXTURE(Test
, testTdf156167
)
542 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156167.svg");
543 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
545 drawinglayer::Primitive2dXmlDump dumper
;
546 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
548 CPPUNIT_ASSERT (pDocument
);
550 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]", "color", "#ffa500");
552 // Without the fix in place, this test would have failed with
553 // - Expected: #ffa500
554 // - Actual : #ff0000
555 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]", "color", "#ffa500");
556 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]", "color", "#ffa500");
559 CPPUNIT_TEST_FIXTURE(Test
, testTdf155932
)
561 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf155932.svg");
562 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
564 drawinglayer::Primitive2dXmlDump dumper
;
565 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
567 CPPUNIT_ASSERT (pDocument
);
569 assertXPath(pDocument
, "/primitive2D/transform/mask/mask/unifiedtransparence", "transparence", "50");
570 assertXPath(pDocument
, "/primitive2D/transform/mask/mask/unifiedtransparence[1]/polypolygoncolor", "color", "#0000ff");
573 CPPUNIT_TEST_FIXTURE(Test
, testTdf97717
)
575 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97717.svg");
576 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
578 drawinglayer::Primitive2dXmlDump dumper
;
579 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
581 CPPUNIT_ASSERT (pDocument
);
583 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence[1]", "transparence", "50");
584 // Without the fix in place, this test would have failed here since the patch
585 // would have contained two unifiedtransparence
586 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence[1]/polypolygoncolor", "color", "#ccccff");
587 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence[2]", "transparence", "50");
588 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence[2]/polypolygoncolor", "color", "#ccccff");
591 CPPUNIT_TEST_FIXTURE(Test
, testMarkerOrient
)
593 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/MarkerOrient.svg");
594 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
596 drawinglayer::Primitive2dXmlDump dumper
;
597 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
599 CPPUNIT_ASSERT (pDocument
);
601 assertXPath(pDocument
, "/primitive2D/transform/transform[1]", "xy11", "0");
602 assertXPath(pDocument
, "/primitive2D/transform/transform[1]", "xy12", "0");
603 assertXPath(pDocument
, "/primitive2D/transform/transform[1]", "xy13", "7");
604 assertXPath(pDocument
, "/primitive2D/transform/transform[1]", "xy21", "0");
605 assertXPath(pDocument
, "/primitive2D/transform/transform[1]", "xy22", "0");
606 assertXPath(pDocument
, "/primitive2D/transform/transform[1]", "xy23", "13");
607 assertXPath(pDocument
, "/primitive2D/transform/transform[1]", "xy31", "0");
608 assertXPath(pDocument
, "/primitive2D/transform/transform[1]", "xy32", "0");
609 assertXPath(pDocument
, "/primitive2D/transform/transform[1]", "xy33", "1");
611 assertXPath(pDocument
, "/primitive2D/transform/transform[2]", "xy11", "0");
612 assertXPath(pDocument
, "/primitive2D/transform/transform[2]", "xy12", "0");
613 assertXPath(pDocument
, "/primitive2D/transform/transform[2]", "xy13", "87");
614 assertXPath(pDocument
, "/primitive2D/transform/transform[2]", "xy21", "0");
615 assertXPath(pDocument
, "/primitive2D/transform/transform[2]", "xy22", "0");
616 assertXPath(pDocument
, "/primitive2D/transform/transform[2]", "xy23", "87");
617 assertXPath(pDocument
, "/primitive2D/transform/transform[2]", "xy31", "0");
618 assertXPath(pDocument
, "/primitive2D/transform/transform[2]", "xy32", "0");
619 assertXPath(pDocument
, "/primitive2D/transform/transform[2]", "xy33", "1");
622 CPPUNIT_TEST_FIXTURE(Test
, testMarkerInPresentation
)
624 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/markerInPresentation.svg");
625 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
627 drawinglayer::Primitive2dXmlDump dumper
;
628 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
630 CPPUNIT_ASSERT (pDocument
);
632 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line", 1);
633 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/polypolygon/polygon", 1);
634 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/polypolygon/polygon", 1);
636 // Without the fix in place, this test would have failed with
639 assertXPath(pDocument
, "/primitive2D/transform/transform/transform", 0);
642 CPPUNIT_TEST_FIXTURE(Test
, testMarkerInCssStyle
)
644 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/markerInCssStyle.svg");
645 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
647 drawinglayer::Primitive2dXmlDump dumper
;
648 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
650 CPPUNIT_ASSERT (pDocument
);
652 // Without the fix in place, this test would have failed with
655 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line", 20);
657 assertXPath(pDocument
, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "color", "#008000");
658 assertXPath(pDocument
, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "width", "1");
659 assertXPath(pDocument
, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "linejoin", "Miter");
660 assertXPath(pDocument
, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "miterangle", "28");
661 assertXPath(pDocument
, "/primitive2D/transform/transform[1]/polypolygonstroke/line", "linecap", "BUTT");
664 CPPUNIT_TEST_FIXTURE(Test
, testTextXmlSpace
)
666 //Check tspan fontsize when using relative units
667 Primitive2DSequence aSequenceTdf97941
= parseSvg(u
"/svgio/qa/cppunit/data/textXmlSpace.svg");
668 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97941
.getLength()));
670 drawinglayer::Primitive2dXmlDump dumper
;
671 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf97941
);
673 CPPUNIT_ASSERT (pDocument
);
675 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]", "text", "a b");
676 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]", "text", "a b");
677 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]", "text", "a b");
678 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]", "text", "ab");
679 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[5]", "text", " a b ");
680 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[6]", "text", "a b");
681 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[7]", "text", "a b");
682 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[8]", "text", "a b");
685 CPPUNIT_TEST_FIXTURE(Test
, testTdf45771
)
687 //Check text fontsize when using relative units
688 Primitive2DSequence aSequenceTdf45771
= parseSvg(u
"/svgio/qa/cppunit/data/tdf45771.svg");
689 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf45771
.getLength()));
691 drawinglayer::Primitive2dXmlDump dumper
;
692 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf45771
);
694 CPPUNIT_ASSERT (pDocument
);
696 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#000000");
697 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "Sample");
698 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "32");
699 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Times New Roman");
702 CPPUNIT_TEST_FIXTURE(Test
, testTdf155833
)
704 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf155833.svg");
705 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
707 drawinglayer::Primitive2dXmlDump dumper
;
708 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
710 CPPUNIT_ASSERT (pDocument
);
712 assertXPath(pDocument
, "/primitive2D/transform/mask/transform/transform/transform/transform/transform/bitmap", 1);
715 CPPUNIT_TEST_FIXTURE(Test
, testTdf97941
)
717 //Check tspan fontsize when using relative units
718 Primitive2DSequence aSequenceTdf97941
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97941.svg");
719 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97941
.getLength()));
721 drawinglayer::Primitive2dXmlDump dumper
;
722 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf97941
);
724 CPPUNIT_ASSERT (pDocument
);
726 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#000000");
727 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "Sample");
728 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "48");
729 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Times New Roman");
732 CPPUNIT_TEST_FIXTURE(Test
, testTdf156777
)
734 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156777.svg");
735 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
737 drawinglayer::Primitive2dXmlDump dumper
;
738 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
740 CPPUNIT_ASSERT (pDocument
);
742 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion", 23);
743 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "Quick brown fox jumps over the lazy dog.");
745 // Without the fix in place, this test would have failed with
746 // - Expected: #008000
747 // - Actual : #000000
748 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#008000");
749 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "x", "84");
750 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "y", "23");
753 CPPUNIT_TEST_FIXTURE(Test
, testTdf156834
)
755 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156834.svg");
756 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
758 drawinglayer::Primitive2dXmlDump dumper
;
759 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
761 CPPUNIT_ASSERT (pDocument
);
763 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion", 3);
764 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "Auto");
765 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "x", "30");
766 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "y", "20");
768 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", "Middle");
769 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "x", "30");
770 //assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[2]", "y", "57");
772 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "text", "Hanging");
773 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "x", "30");
774 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "y", "94");
777 CPPUNIT_TEST_FIXTURE(Test
, testTdf104339
)
779 Primitive2DSequence aSequenceTdf104339
= parseSvg(u
"/svgio/qa/cppunit/data/tdf104339.svg");
780 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf104339
.getLength()));
782 drawinglayer::Primitive2dXmlDump dumper
;
783 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf104339
);
785 CPPUNIT_ASSERT (pDocument
);
786 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/transform/transform/polypolygoncolor", "color", "#000000");
789 CPPUNIT_TEST_FIXTURE(Test
, testTdf85770
)
791 Primitive2DSequence aSequenceTdf85770
= parseSvg(u
"/svgio/qa/cppunit/data/tdf85770.svg");
792 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf85770
.getLength()));
794 drawinglayer::Primitive2dXmlDump dumper
;
795 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf85770
));
797 CPPUNIT_ASSERT (pDocument
);
799 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#000000");
800 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "Start Middle End");
801 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "11");
802 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Times New Roman");
803 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", "#000000");
804 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", "Start");
805 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "height", "11");
806 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "familyname", "Times New Roman");
807 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "fontcolor", "#000000");
808 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "text", " End");
809 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "height", "11");
810 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "familyname", "Times New Roman");
813 CPPUNIT_TEST_FIXTURE(Test
, testTdf86938
)
815 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf86938.svg");
816 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
818 drawinglayer::Primitive2dXmlDump dumper
;
819 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
821 CPPUNIT_ASSERT (pDocument
);
823 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "line");
824 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "x", "290");
825 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "y", "183");
826 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", "above");
827 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "x", "290");
829 // Without the fix in place, this test would have failed with
832 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "y", "159");
833 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "text", "below");
834 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "x", "290");
835 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "y", "207");
838 CPPUNIT_TEST_FIXTURE(Test
, testTdf93583
)
840 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf93583.svg");
841 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
843 drawinglayer::Primitive2dXmlDump dumper
;
844 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
846 CPPUNIT_ASSERT (pDocument
);
848 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "This is the");
849 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "x", "62");
850 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "y", "303");
851 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "width", "16");
852 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "16");
853 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", " first");
854 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "x", "127");
855 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "y", "303");
856 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "width", "32");
857 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "height", "32");
858 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "text", " line");
859 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "x", "187");
860 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "y", "303");
861 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "width", "16");
862 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "height", "16");
865 CPPUNIT_TEST_FIXTURE(Test
, testTdf156616
)
867 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156616.svg");
868 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
870 drawinglayer::Primitive2dXmlDump dumper
;
871 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
873 CPPUNIT_ASSERT (pDocument
);
875 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "First");
876 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "x", "114");
877 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "y", "103");
878 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", " line");
879 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "x", "142");
880 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "y", "103");
881 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "text", "Second line");
882 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "x", "114");
883 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "y", "122");
884 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "text", "First");
885 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "x", "86");
886 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "y", "153");
887 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "text", " line");
888 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "x", "114");
889 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "y", "153");
890 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "text", "Second line");
891 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "x", "77");
892 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "y", "172");
893 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "text", "First");
894 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "x", "59");
895 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "y", "203");
896 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "text", " line");
897 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "x", "87");
898 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "y", "203");
899 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "text", "Second line");
900 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "x", "40");
901 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "y", "222");
904 CPPUNIT_TEST_FIXTURE(Test
, testTdf79163
)
907 Primitive2DSequence aSequenceTdf79163
= parseSvg(u
"/svgio/qa/cppunit/data/tdf79163.svg");
908 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf79163
.getLength()));
910 drawinglayer::Primitive2dXmlDump dumper
;
911 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf79163
));
913 CPPUNIT_ASSERT (pDocument
);
915 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence", "transparence", "50");
918 CPPUNIT_TEST_FIXTURE(Test
, testTdf97542_1
)
920 Primitive2DSequence aSequenceTdf97542_1
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97542_1.svg");
921 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_1
.getLength()));
923 drawinglayer::Primitive2dXmlDump dumper
;
924 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf97542_1
));
926 CPPUNIT_ASSERT (pDocument
);
928 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/textsimpleportion", "fontcolor", "#ffff00");
929 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/textsimpleportion", "text", "Text");
930 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/textsimpleportion", "height", "48");
931 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/textsimpleportion", "familyname", "serif");
934 CPPUNIT_TEST_FIXTURE(Test
, testTdf97542_2
)
936 Primitive2DSequence aSequenceTdf97542_2
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97542_2.svg");
937 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_2
.getLength()));
939 drawinglayer::Primitive2dXmlDump dumper
;
940 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf97542_2
));
942 CPPUNIT_ASSERT (pDocument
);
944 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient", "startx", "1");
945 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient", "starty", "1");
946 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient/focalx", 0);
947 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient/focaly", 0);
948 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient", "radius", "3");
949 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient", "spreadmethod", "pad");
950 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient", "opacity", "1");
953 CPPUNIT_TEST_FIXTURE(Test
, testTdf97543
)
955 // check visibility="inherit"
956 Primitive2DSequence aSequenceTdf97543
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97543.svg");
957 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97543
.getLength()));
959 drawinglayer::Primitive2dXmlDump dumper
;
960 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf97543
));
962 CPPUNIT_ASSERT (pDocument
);
964 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor", "color", "#00cc00");
965 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", "100");
966 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", "100");
967 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", "10");
968 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", "10");
969 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", "110");
970 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", "110");
973 CPPUNIT_TEST_FIXTURE(Test
, testRGBColor
)
975 Primitive2DSequence aSequenceRGBColor
= parseSvg(u
"/svgio/qa/cppunit/data/RGBColor.svg");
976 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBColor
.getLength()));
978 drawinglayer::Primitive2dXmlDump dumper
;
979 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceRGBColor
));
981 CPPUNIT_ASSERT (pDocument
);
983 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor", "color", "#646464");
984 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "height", "100");
985 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "width", "100");
986 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "minx", "10");
987 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "miny", "10");
988 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxx", "110");
989 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon", "maxy", "110");
992 CPPUNIT_TEST_FIXTURE(Test
, testTdf149673
)
994 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf149673.svg");
995 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
997 drawinglayer::Primitive2dXmlDump dumper
;
998 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1000 CPPUNIT_ASSERT (pDocument
);
1002 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence", "transparence", "90");
1003 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[1]", "color", "#ff0000");
1004 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[2]", "color", "#00ff00");
1005 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[3]", "color", "#0000ff");
1008 CPPUNIT_TEST_FIXTURE(Test
, testRGBAColor
)
1010 Primitive2DSequence aSequenceRGBAColor
= parseSvg(u
"/svgio/qa/cppunit/data/RGBAColor.svg");
1011 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBAColor
.getLength()));
1013 drawinglayer::Primitive2dXmlDump dumper
;
1014 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceRGBAColor
));
1016 CPPUNIT_ASSERT (pDocument
);
1018 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence", "transparence", "50");
1021 CPPUNIT_TEST_FIXTURE(Test
, testNoneColor
)
1023 Primitive2DSequence aSequenceRGBAColor
= parseSvg(u
"/svgio/qa/cppunit/data/noneColor.svg");
1024 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBAColor
.getLength()));
1026 drawinglayer::Primitive2dXmlDump dumper
;
1027 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceRGBAColor
));
1029 CPPUNIT_ASSERT (pDocument
);
1031 //No polypolygoncolor exists
1032 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor", 0);
1033 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygonstroke/line", "color", "#000000");
1034 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygonstroke/line", "width", "3");
1037 CPPUNIT_TEST_FIXTURE(Test
, testTdf117920
)
1039 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf117920.svg");
1040 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1042 drawinglayer::Primitive2dXmlDump dumper
;
1043 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1045 CPPUNIT_ASSERT (pDocument
);
1047 assertXPath(pDocument
, "/primitive2D/transform/transform", "xy11", "1");
1048 assertXPath(pDocument
, "/primitive2D/transform/transform", "xy12", "0");
1049 assertXPath(pDocument
, "/primitive2D/transform/transform", "xy13", "-18");
1050 assertXPath(pDocument
, "/primitive2D/transform/transform", "xy21", "0");
1051 assertXPath(pDocument
, "/primitive2D/transform/transform", "xy22", "1");
1052 assertXPath(pDocument
, "/primitive2D/transform/transform", "xy23", "-6");
1053 assertXPath(pDocument
, "/primitive2D/transform/transform", "xy31", "0");
1054 assertXPath(pDocument
, "/primitive2D/transform/transform", "xy32", "0");
1055 assertXPath(pDocument
, "/primitive2D/transform/transform", "xy33", "1");
1058 CPPUNIT_TEST_FIXTURE(Test
, testTdf97936
)
1060 // check that both rectangles are rendered in the viewBox
1061 Primitive2DSequence aSequenceTdf97936
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97936.svg");
1062 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97936
.getLength()));
1064 drawinglayer::Primitive2dXmlDump dumper
;
1065 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf97936
));
1067 CPPUNIT_ASSERT (pDocument
);
1069 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]");
1070 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "height", "50");
1071 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "width", "50");
1072 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "minx", "70");
1073 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "miny", "50");
1074 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "maxx", "120");
1075 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "maxy", "100");
1076 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]");
1077 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "height", "50");
1078 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "width", "50");
1079 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "minx", "10");
1080 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "miny", "50");
1081 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "maxx", "60");
1082 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "maxy", "100");
1085 CPPUNIT_TEST_FIXTURE(Test
, testTdf149893
)
1087 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf149893.svg");
1088 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1090 drawinglayer::Primitive2dXmlDump dumper
;
1091 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1093 CPPUNIT_ASSERT (pDocument
);
1095 // Without the fix in place, this test would have failed with
1096 // - Expected: #008000
1097 // - Actual : #000000
1098 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor", "color", "#008000");
1101 CPPUNIT_TEST_FIXTURE(Test
, testShapeWithClipPathAndCssStyle
)
1103 // tdf#97539: Check there is a mask and 3 polygons
1104 Primitive2DSequence aSequenceClipPathAndStyle
= parseSvg(u
"/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg");
1105 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle
.getLength()));
1107 drawinglayer::Primitive2dXmlDump dumper
;
1108 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle
));
1110 CPPUNIT_ASSERT (pDocument
);
1112 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygon/polygon", 2);
1113 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor/polypolygon/polygon", 1);
1116 CPPUNIT_TEST_FIXTURE(Test
, testClipPathAndParentStyle
)
1118 //Check that fill color, stroke color and stroke-width are inherited from use element
1119 //when the element is within a clipPath element
1120 Primitive2DSequence aSequenceClipPathAndParentStyle
= parseSvg(u
"/svgio/qa/cppunit/data/ClipPathAndParentStyle.svg");
1121 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndParentStyle
.getLength()));
1123 drawinglayer::Primitive2dXmlDump dumper
;
1124 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndParentStyle
));
1126 CPPUNIT_ASSERT (pDocument
);
1128 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygoncolor", "color", "#ff0000");
1129 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line", "color", "#000000");
1130 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line", "width", "5");
1134 CPPUNIT_TEST_FIXTURE(Test
, testTdf155814
)
1136 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf155814.svg");
1137 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1139 drawinglayer::Primitive2dXmlDump dumper
;
1140 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1142 CPPUNIT_ASSERT (pDocument
);
1144 assertXPath(pDocument
, "/primitive2D/transform/mask/mask/transform/unifiedtransparence", "transparence", "50");
1145 assertXPath(pDocument
, "/primitive2D/transform/mask/mask/transform/unifiedtransparence/polypolygoncolor", "color", "#0000ff");
1148 CPPUNIT_TEST_FIXTURE(Test
, testClipPathAndStyle
)
1150 //Check that fill color, stroke color and stroke-width are inherited from use element
1151 //when the element is within a clipPath element
1152 Primitive2DSequence aSequenceClipPathAndStyle
= parseSvg(u
"/svgio/qa/cppunit/data/ClipPathAndStyle.svg");
1153 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle
.getLength()));
1155 drawinglayer::Primitive2dXmlDump dumper
;
1156 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle
));
1158 CPPUNIT_ASSERT (pDocument
);
1160 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygoncolor", "color", "#ccccff");
1161 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line", "color", "#0000cc");
1162 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line", "width", "2");
1166 CPPUNIT_TEST_FIXTURE(Test
, testShapeWithClipPath
)
1168 // Check there is a mask and 3 polygons
1169 Primitive2DSequence aSequenceClipPathAndStyle
= parseSvg(u
"/svgio/qa/cppunit/data/ShapeWithClipPath.svg");
1170 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle
.getLength()));
1172 drawinglayer::Primitive2dXmlDump dumper
;
1173 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle
));
1175 CPPUNIT_ASSERT (pDocument
);
1177 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygon/polygon", 2);
1178 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor/polypolygon/polygon", 1);
1181 CPPUNIT_TEST_FIXTURE(Test
, testClipPathUsingClipPath
)
1183 Primitive2DSequence aSequenceClipPathAndStyle
= parseSvg(u
"/svgio/qa/cppunit/data/ClipPathUsingClipPath.svg");
1184 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle
.getLength()));
1186 drawinglayer::Primitive2dXmlDump dumper
;
1187 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle
));
1189 CPPUNIT_ASSERT (pDocument
);
1191 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygon/polygon/point", 20);
1192 assertXPath(pDocument
, "/primitive2D/transform/mask/mask/polypolygon/polygon/point", 13);
1195 CPPUNIT_TEST_FIXTURE(Test
, testFillRule
)
1197 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/FillRule.svg");
1198 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1200 drawinglayer::Primitive2dXmlDump dumper
;
1201 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1203 CPPUNIT_ASSERT (pDocument
);
1205 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor", "color", "#000000");
1206 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon/polygon", 2);
1207 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line", "color", "#ff0000");
1208 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/polypolygon/polygon", 2);
1211 CPPUNIT_TEST_FIXTURE(Test
, testClipRule
)
1213 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/ClipRule.svg");
1214 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1216 drawinglayer::Primitive2dXmlDump dumper
;
1217 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1219 CPPUNIT_ASSERT (pDocument
);
1221 // Without the place in place, this test would have failed with
1224 assertXPath(pDocument
, "/primitive2D/transform/mask[1]/polypolygon/polygon/point", 5);
1225 assertXPath(pDocument
, "/primitive2D/transform/mask[1]/polypolygoncolor", "color", "#0000ff");
1226 assertXPath(pDocument
, "/primitive2D/transform/mask[1]/polypolygoncolor/polypolygon/polygon/point", 4);
1228 assertXPath(pDocument
, "/primitive2D/transform/mask[2]/polypolygon/polygon/point", 5);
1229 assertXPath(pDocument
, "/primitive2D/transform/mask[2]/polypolygoncolor", "color", "#ff0000");
1230 assertXPath(pDocument
, "/primitive2D/transform/mask[2]/polypolygoncolor/polypolygon/polygon/point", 4);
1233 CPPUNIT_TEST_FIXTURE(Test
, testi125329
)
1235 //Check style inherit from * css element
1236 Primitive2DSequence aSequencei125329
= parseSvg(u
"/svgio/qa/cppunit/data/i125329.svg");
1237 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequencei125329
.getLength()));
1239 drawinglayer::Primitive2dXmlDump dumper
;
1240 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequencei125329
));
1242 CPPUNIT_ASSERT (pDocument
);
1244 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor", "color", "#c0c0c0"); // rect background color
1245 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "height", "30"); // rect background height
1246 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "width", "50"); // rect background width
1247 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "minx", "15");
1248 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "miny", "15");
1249 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "maxx", "65");
1250 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon", "maxy", "45");
1251 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygonstroke/line", "color", "#008000"); // rect stroke color
1252 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygonstroke/line", "width", "1"); // rect stroke width
1255 CPPUNIT_TEST_FIXTURE(Test
, testMaskingPath07b
)
1257 //For the time being, check that masking-path-07-b.svg can be imported and it doesn't hang on loading
1258 //it used to hang after d5649ae7b76278cb3155f951d6327157c7c92b65
1259 Primitive2DSequence aSequenceMaskingPath07b
= parseSvg(u
"/svgio/qa/cppunit/data/masking-path-07-b.svg");
1260 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskingPath07b
.getLength()));
1262 drawinglayer::Primitive2dXmlDump dumper
;
1263 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceMaskingPath07b
));
1265 CPPUNIT_ASSERT (pDocument
);
1269 CPPUNIT_TEST_FIXTURE(Test
, test123926
)
1271 Primitive2DSequence aSequence123926
= parseSvg(u
"/svgio/qa/cppunit/data/tdf123926.svg");
1272 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence123926
.getLength()));
1274 drawinglayer::Primitive2dXmlDump dumper
;
1275 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence123926
));
1277 CPPUNIT_ASSERT (pDocument
);
1279 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/unifiedtransparence/polypolygoncolor", "color", "#7cb5ec");
1282 CPPUNIT_TEST_FIXTURE(Test
, test47446
)
1284 //Check that marker's fill attribute is black is not set
1285 Primitive2DSequence aSequence47446
= parseSvg(u
"/svgio/qa/cppunit/data/47446.svg");
1286 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446
.getLength()));
1288 drawinglayer::Primitive2dXmlDump dumper
;
1289 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence47446
));
1291 CPPUNIT_ASSERT (pDocument
);
1293 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/polypolygoncolor", "color", "#000000");
1297 CPPUNIT_TEST_FIXTURE(Test
, test47446b
)
1299 //Check that marker's fill attribute is inherit from def
1300 Primitive2DSequence aSequence47446b
= parseSvg(u
"/svgio/qa/cppunit/data/47446b.svg");
1301 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446b
.getLength()));
1303 drawinglayer::Primitive2dXmlDump dumper
;
1304 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence47446b
));
1306 CPPUNIT_ASSERT (pDocument
);
1308 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/polypolygoncolor", "color", "#ffff00");
1312 CPPUNIT_TEST_FIXTURE(Test
, testTdf103888
)
1314 Primitive2DSequence aSequenceMaskText
= parseSvg(u
"/svgio/qa/cppunit/data/tdf103888.svg");
1315 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskText
.getLength()));
1317 drawinglayer::Primitive2dXmlDump dumper
;
1318 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceMaskText
));
1320 CPPUNIT_ASSERT (pDocument
);
1322 // Without the fix in place, this test would have failed here with number of nodes is incorrect
1323 assertXPath(pDocument
, "/primitive2D/transform/transform/textsimpleportion[1]", "text", "Her");
1324 assertXPath(pDocument
, "/primitive2D/transform/transform/textsimpleportion[2]", "text", "vor");
1325 assertXPath(pDocument
, "/primitive2D/transform/transform/textsimpleportion[3]", "text", "hebung");
1328 CPPUNIT_TEST_FIXTURE(Test
, testTdf156251
)
1330 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156251.svg");
1331 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1333 drawinglayer::Primitive2dXmlDump dumper
;
1334 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1336 CPPUNIT_ASSERT (pDocument
);
1338 // Without the fix in place, this test would have failed with
1339 // - Expected: 'You are '
1340 // - Actual : 'You are'
1341 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "You are");
1342 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", " not");
1343 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "text", " a banana!");
1344 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "text", "You are");
1345 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "text", " not");
1346 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "text", " a banana!");
1349 CPPUNIT_TEST_FIXTURE(Test
, testMaskText
)
1351 //Check that mask is applied on text
1352 Primitive2DSequence aSequenceMaskText
= parseSvg(u
"/svgio/qa/cppunit/data/maskText.svg");
1353 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskText
.getLength()));
1355 drawinglayer::Primitive2dXmlDump dumper
;
1356 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceMaskText
));
1358 CPPUNIT_ASSERT (pDocument
);
1360 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygoncolor", "color", "#000000");
1361 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/textsimpleportion", "fontcolor", "#ffffff");
1362 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/textsimpleportion", "text", "Black White");
1363 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/textsimpleportion", "height", "26");
1364 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/textsimpleportion", "familyname", "Times New Roman");
1367 CPPUNIT_TEST_FIXTURE(Test
, testTdf99994
)
1369 //Check text fontsize when using relative units
1370 Primitive2DSequence aSequenceTdf99994
= parseSvg(u
"/svgio/qa/cppunit/data/tdf99994.svg");
1371 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99994
.getLength()));
1373 drawinglayer::Primitive2dXmlDump dumper
;
1374 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf99994
));
1376 CPPUNIT_ASSERT (pDocument
);
1378 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#0000ff");
1379 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "16");
1380 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "test");
1381 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Sans");
1384 CPPUNIT_TEST_FIXTURE(Test
, testTdf99115
)
1386 //Check that styles are resolved correctly where there is a * css selector
1387 Primitive2DSequence aSequenceTdf99115
= parseSvg(u
"/svgio/qa/cppunit/data/tdf99115.svg");
1388 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99115
.getLength()));
1390 drawinglayer::Primitive2dXmlDump dumper
;
1391 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf99115
) );
1393 CPPUNIT_ASSERT (pDocument
);
1395 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "red 1");
1396 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#ff0000");
1397 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "18");
1399 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", "red 2");
1400 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "fontcolor", "#ff0000");
1401 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "height", "18");
1403 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "text", "red 3");
1404 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "fontcolor", "#ff0000");
1405 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "height", "18");
1407 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "text", "blue 4");
1408 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "fontcolor", "#0000ff");
1409 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "height", "18");
1411 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "text", "blue 5");
1412 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "fontcolor", "#0000ff");
1413 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "height", "18");
1415 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "text", "blue 6");
1416 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "fontcolor", "#0000ff");
1417 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "height", "18");
1419 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "text", "green 7");
1420 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "fontcolor", "#008000");
1421 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "height", "18");
1423 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "text", "green 8");
1424 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "fontcolor", "#008000");
1425 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "height", "18");
1427 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "text", "green 9");
1428 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "fontcolor", "#008000");
1429 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "height", "18");
1432 CPPUNIT_TEST_FIXTURE(Test
, testTdf101237
)
1434 //Check that fill color, stroke color and stroke-width are inherited from use element
1435 //when the element is within a clipPath element
1436 Primitive2DSequence aSequenceTdf101237
= parseSvg(u
"/svgio/qa/cppunit/data/tdf101237.svg");
1437 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf101237
.getLength()));
1439 drawinglayer::Primitive2dXmlDump dumper
;
1440 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf101237
));
1442 CPPUNIT_ASSERT (pDocument
);
1444 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor", "color", "#ff0000");
1445 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line", "color", "#000000");
1446 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line", "width", "5");
1449 CPPUNIT_TEST_FIXTURE(Test
, testTdf97710
)
1451 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97710.svg");
1452 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1454 drawinglayer::Primitive2dXmlDump dumper
;
1455 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1457 CPPUNIT_ASSERT (pDocument
);
1459 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[1]", "color", "#000000");
1461 // Without the fix in place, this test would have failed with
1464 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon", "width", "100");
1465 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon", "height", "100");
1466 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[2]", "color", "#008000");
1467 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon", "width", "100");
1468 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon", "height", "100");
1469 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygonstroke/line", "color", "#000000");
1470 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygonstroke/line", "width", "1");
1473 CPPUNIT_TEST_FIXTURE(Test
, testTdf94765
)
1475 Primitive2DSequence aSequenceTdf94765
= parseSvg(u
"/svgio/qa/cppunit/data/tdf94765.svg");
1476 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf94765
.getLength()));
1478 drawinglayer::Primitive2dXmlDump dumper
;
1479 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf94765
));
1481 CPPUNIT_ASSERT (pDocument
);
1483 //Check that both rectangles use the gradient as fill
1484 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[1]", "startx", "1");
1485 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[1]", "starty", "1");
1486 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[1]", "endx", "2");
1487 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[1]", "endy", "1");
1488 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[2]", "startx", "0");
1489 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[2]", "starty", "0");
1490 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[2]", "endx", "0");
1491 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[2]", "endy", "0");
1494 CPPUNIT_TEST_FIXTURE(Test
, testTdf156236
)
1496 Primitive2DSequence aSequenceTdf94765
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156236.svg");
1497 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf94765
.getLength()));
1499 drawinglayer::Primitive2dXmlDump dumper
;
1500 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf94765
));
1502 CPPUNIT_ASSERT (pDocument
);
1504 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "path", "m50 180h-30v-60h60v60z");
1505 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "path", "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");
1506 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]/polypolygon", "path", "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");
1507 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[4]/polypolygon", "path", "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");
1510 CPPUNIT_TEST_FIXTURE(Test
, testBehaviourWhenWidthAndHeightIsOrIsNotSet
)
1512 // This test checks the behaviour when width and height attributes
1513 // are and are not set. In both cases the result must be the same,
1514 // however if the width / height are set, then the size of the image
1515 // is enforced, but this isn't really possible in LibreOffice (or
1516 // maybe we could lock the size in this case).
1517 // The behaviour in browsers is that when a SVG image has width / height
1518 // attributes set, then the image is shown with that size, but if it
1519 // isn't set then it is shown as scalable image which is the size of
1523 const Primitive2DSequence aSequence
= parseSvg(u
"svgio/qa/cppunit/data/Drawing_WithWidthHeight.svg");
1524 CPPUNIT_ASSERT(aSequence
.hasElements());
1526 geometry::RealRectangle2D aRealRect
;
1527 basegfx::B2DRange aRange
;
1528 uno::Sequence
<beans::PropertyValue
> aViewParameters
;
1530 for (css::uno::Reference
<css::graphic::XPrimitive2D
> const & xReference
: aSequence
)
1532 if (xReference
.is())
1534 aRealRect
= xReference
->getRange(aViewParameters
);
1535 aRange
.expand(basegfx::B2DRange(aRealRect
.X1
, aRealRect
.Y1
, aRealRect
.X2
, aRealRect
.Y2
));
1539 double fWidth
= (aRange
.getWidth() / 2540.0) * 96.0;
1540 double fHeight
= (aRange
.getHeight() / 2540.0) * 96.0;
1542 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fWidth
, 1E-12);
1543 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fHeight
, 1E-12);
1547 const Primitive2DSequence aSequence
= parseSvg(u
"svgio/qa/cppunit/data/Drawing_NoWidthHeight.svg");
1548 CPPUNIT_ASSERT(aSequence
.hasElements());
1551 geometry::RealRectangle2D aRealRect
;
1552 basegfx::B2DRange aRange
;
1553 uno::Sequence
<beans::PropertyValue
> aViewParameters
;
1555 for (css::uno::Reference
<css::graphic::XPrimitive2D
> const & xReference
: aSequence
)
1557 if (xReference
.is())
1559 aRealRect
= xReference
->getRange(aViewParameters
);
1560 aRange
.expand(basegfx::B2DRange(aRealRect
.X1
, aRealRect
.Y1
, aRealRect
.X2
, aRealRect
.Y2
));
1564 double fWidth
= (aRange
.getWidth() / 2540.0) * 96.0;
1565 double fHeight
= (aRange
.getHeight() / 2540.0) * 96.0;
1567 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fWidth
, 1E-12);
1568 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fHeight
, 1E-12);
1572 CPPUNIT_TEST_FIXTURE(Test
, testTdf155733
)
1574 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf155733.svg");
1575 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1577 drawinglayer::Primitive2dXmlDump dumper
;
1578 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1580 CPPUNIT_ASSERT (pDocument
);
1582 assertXPath(pDocument
, "/primitive2D/transform/softedge", "radius", "5");
1584 // Without the fix in place, the softedge would have been applied to the second element
1587 assertXPath(pDocument
, "/primitive2D/transform/transform/unifiedtransparence", "transparence", "50");
1590 CPPUNIT_TEST_FIXTURE(Test
, testTdf97663
)
1592 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/em_units.svg");
1593 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1595 drawinglayer::Primitive2dXmlDump dumper
;
1596 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1598 CPPUNIT_ASSERT (pDocument
);
1600 // tdf#97663: Without the fix in place, this test would have failed with
1603 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "y", "236");
1606 CPPUNIT_TEST_FIXTURE(Test
, testTdf156269
)
1608 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156269.svg");
1609 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1611 drawinglayer::Primitive2dXmlDump dumper
;
1612 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1614 CPPUNIT_ASSERT (pDocument
);
1616 assertXPath(pDocument
, "//textsimpleportion[@text='one']", "width", "16");
1617 assertXPath(pDocument
, "//textsimpleportion[@text='one']", "height", "16");
1618 assertXPath(pDocument
, "//textsimpleportion[@text='one']", "x", "10");
1619 assertXPath(pDocument
, "//textsimpleportion[@text='one']", "y", "50");
1620 assertXPath(pDocument
, "//textsimpleportion[@text='one']", "fontcolor", "#808080");
1622 assertXPath(pDocument
, "//textsimpleportion[@text='two']", "width", "16");
1623 assertXPath(pDocument
, "//textsimpleportion[@text='two']", "height", "16");
1625 // Without the fix in place, this test would have failed with
1628 assertXPath(pDocument
, "//textsimpleportion[@text='two']", "x", "60");
1629 assertXPath(pDocument
, "//textsimpleportion[@text='two']", "y", "100");
1630 assertXPath(pDocument
, "//textsimpleportion[@text='two']", "fontcolor", "#000000");
1633 CPPUNIT_TEST_FIXTURE(Test
, testTdf95400
)
1635 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf95400.svg");
1636 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1638 drawinglayer::Primitive2dXmlDump dumper
;
1639 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1641 CPPUNIT_ASSERT (pDocument
);
1643 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "width", "16");
1644 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "16");
1645 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "x", "30");
1646 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "y", "20");
1647 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "ABC");
1648 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "dx0", "36");
1649 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "dx1", "69");
1650 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "dx2", "102");
1652 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "width", "48");
1653 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "height", "16");
1654 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "x", "30");
1655 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "y", "30");
1656 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", "ABC");
1657 assertXPathNoAttribute(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "dx0");
1660 CPPUNIT_TEST_FIXTURE(Test
, testTextAnchor
)
1662 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf151103.svg");
1663 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1665 drawinglayer::Primitive2dXmlDump dumper
;
1666 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1668 CPPUNIT_ASSERT (pDocument
);
1670 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "x", "60");
1671 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "y", "40");
1672 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "ABC");
1674 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "x", "43");
1675 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "y", "50");
1676 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", "ABC");
1678 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "x", "26");
1679 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "y", "60");
1680 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]", "text", "ABC");
1682 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "x", "60");
1683 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "y", "40");
1684 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]", "text", "ABC");
1686 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "x", "43");
1687 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "y", "50");
1688 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]", "text", "ABC");
1690 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "x", "26");
1691 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "y", "60");
1692 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]", "text", "ABC");
1694 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "x", "60");
1695 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "y", "40");
1696 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]", "text", "ABC");
1698 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "x", "43");
1699 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "y", "50");
1700 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]", "text", "ABC");
1702 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "x", "26");
1703 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "y", "60");
1704 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]", "text", "ABC");
1706 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]", "x", "60");
1707 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]", "y", "40");
1708 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]", "text", "A");
1710 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[11]", "x", "72");
1711 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[11]", "y", "40");
1712 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[11]", "text", "B");
1714 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[12]", "x", "83");
1715 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[12]", "y", "40");
1716 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[12]", "text", "C");
1718 // Without the fix in place, this test would have failed with
1721 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[13]", "x", "43");
1722 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[13]", "y", "50");
1723 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[13]", "text", "A");
1725 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[14]", "x", "55");
1726 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[14]", "y", "50");
1727 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[14]", "text", "B");
1729 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[15]", "x", "66");
1730 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[15]", "y", "50");
1731 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[15]", "text", "C");
1733 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[16]", "x", "26");
1734 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[16]", "y", "60");
1735 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[16]", "text", "A");
1737 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[17]", "x", "38");
1738 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[17]", "y", "60");
1739 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[17]", "text", "B");
1741 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[18]", "x", "49");
1742 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[18]", "y", "60");
1743 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[18]", "text", "C");
1746 CPPUNIT_TEST_FIXTURE(Test
, testTdf156577
)
1748 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156577.svg");
1749 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1751 drawinglayer::Primitive2dXmlDump dumper
;
1752 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1754 CPPUNIT_ASSERT (pDocument
);
1756 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "width", "16");
1757 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "16");
1758 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "x", "30");
1759 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "y", "20");
1760 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "ABC");
1761 assertXPathNoAttribute(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "dx0");
1763 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "width", "16");
1764 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "height", "16");
1765 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "x", "30");
1766 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "y", "30");
1767 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", "ABC");
1769 // Without the fix in place, this test would have failed with
1772 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "dx0", "22");
1773 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "dx1", "53");
1774 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "dx2", "94");
1777 CPPUNIT_TEST_FIXTURE(Test
, testTdf156283
)
1779 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156283.svg");
1780 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1782 drawinglayer::Primitive2dXmlDump dumper
;
1783 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1785 CPPUNIT_ASSERT (pDocument
);
1787 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "width", "16");
1788 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "16");
1789 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "x", "30");
1790 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "y", "20");
1791 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "ABC");
1792 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "dx0", "41");
1793 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "dx1", "52");
1794 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "dx2", "63");
1796 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "width", "16");
1797 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "height", "16");
1798 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "x", "30");
1799 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "y", "30");
1800 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", "ABC");
1802 // Without the fix in place, this test would have failed with
1805 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "dx0", "41");
1806 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "dx1", "52");
1807 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "dx2", "63");
1810 #if !defined(_WIN32)
1811 CPPUNIT_TEST_FIXTURE(Test
, testTdf156569
)
1813 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156569.svg");
1814 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1816 drawinglayer::Primitive2dXmlDump dumper
;
1817 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1819 CPPUNIT_ASSERT (pDocument
);
1821 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "width", "16");
1822 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "16");
1823 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "x", "0");
1824 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "y", "20");
1825 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "ABC");
1826 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "dx0", "40");
1827 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "dx1", "80");
1828 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "dx2", "91");
1830 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "width", "16");
1831 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "height", "16");
1832 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "x", "0");
1833 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "y", "30");
1834 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", "ABC");
1835 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "dx0", "40");
1837 // Without the fix in place, this test would have failed with
1840 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "dx1", "80");
1841 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "dx2", "91");
1845 CPPUNIT_TEST_FIXTURE(Test
, testTdf156837
)
1847 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156837.svg");
1848 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1850 drawinglayer::Primitive2dXmlDump dumper
;
1851 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1853 CPPUNIT_ASSERT (pDocument
);
1855 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion", 2);
1856 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "x", "114");
1857 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "y", "103");
1858 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "height", "16");
1859 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "x");
1860 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "x", "122");
1862 // Without the fix in place, this test would have failed with
1865 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "y", "94");
1866 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "height", "10");
1867 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]", "text", " 3");
1870 CPPUNIT_TEST_FIXTURE(Test
, testTdf156271
)
1872 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156271.svg");
1873 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1875 drawinglayer::Primitive2dXmlDump dumper
;
1876 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1878 CPPUNIT_ASSERT (pDocument
);
1880 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]", "width", "16");
1881 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]", "height", "16");
1882 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]", "x", "40");
1883 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]", "y", "10");
1884 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]", "text", "AB");
1885 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]", "dx0", "-30");
1886 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]", "dx1", "-19");
1888 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]", "width", "16");
1889 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]", "height", "16");
1890 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]", "x", "40");
1891 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]", "y", "20");
1892 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]", "text", "AB");
1894 // Without the fix in place, this test would have failed with
1897 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]", "dx0", "-30");
1898 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]", "dx1", "-19");
1900 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]", "width", "16");
1901 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]", "height", "16");
1902 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]", "x", "40");
1903 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]", "y", "30");
1904 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]", "text", "AB");
1905 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]", "dx0", "-30");
1906 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]", "dx1", "-19");
1908 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]", "width", "16");
1909 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]", "height", "16");
1910 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]", "x", "40");
1911 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]", "y", "40");
1912 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]", "text", "AB");
1913 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]", "dx0", "12");
1914 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]", "dx1", "23");
1917 CPPUNIT_TEST_FIXTURE(Test
, testTdf149880
)
1919 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf149880.svg");
1920 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1922 drawinglayer::Primitive2dXmlDump dumper
;
1923 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1925 CPPUNIT_ASSERT (pDocument
);
1927 // Without the fix in place, this test would have failed with
1930 // - In <>, XPath '/primitive2D/transform/mask/unhandled' number of nodes is incorrect
1931 assertXPath(pDocument
,
1932 "/primitive2D/transform/mask/unhandled", "id", "PATTERNFILL");
1933 assertXPath(pDocument
,
1934 "/primitive2D/transform/mask/unhandled/mask/transform/transform/bitmap", 28);
1937 CPPUNIT_TEST_FIXTURE(Test
, testCssClassRedefinition
)
1939 // Tests for svg css class redefinition behavior
1941 // .c1 {fill:#00ff00}
1942 // .c1 {font-family:Sans}
1943 // .c1 {fill:#ff0000}
1944 // Expected result is .c1 {font-family:Sans; fill:#ff0000} because
1945 // the second redefinition appends attributes to the class and the
1946 // third redefinition replaces the already existing
1947 // attribute in the original definition
1948 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/CssClassRedefinition.svg");
1949 drawinglayer::Primitive2dXmlDump dumper
;
1950 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1951 CPPUNIT_ASSERT (pDocument
);
1952 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "text", "test");
1953 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]", "fontcolor", "#ff0000");
1955 pDocument
, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Open Symbol");
1958 CPPUNIT_TEST_FIXTURE(Test
, testTspanFillOpacity
)
1960 // Given an SVG file with <tspan fill-opacity="0.30">:
1961 std::u16string_view aPath
= u
"/svgio/qa/cppunit/data/tspan-fill-opacity.svg";
1963 // When rendering that SVG:
1964 Primitive2DSequence aSequence
= parseSvg(aPath
);
1966 // Then make sure that the text portion is wrapped in a transparency primitive with the correct
1967 // transparency value:
1968 drawinglayer::Primitive2dXmlDump aDumper
;
1969 xmlDocUniquePtr pDocument
= aDumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1970 sal_Int32 nTransparence
= getXPath(pDocument
, "//textsimpleportion[@text='hello']/parent::unifiedtransparence", "transparence").toInt32();
1971 // Without the accompanying fix in place, this test would have failed with:
1974 // - XPath '//textsimpleportion[@text='hello']/parent::unifiedtransparence' number of nodes is incorrect
1975 // i.e. the relevant <textsimpleportion> had no <unifiedtransparence> parent, the text was not
1976 // semi-transparent.
1977 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(70), nTransparence
);
1980 CPPUNIT_PLUGIN_IMPLEMENT();
1982 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */