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>
11 #include <sal/log.hxx>
13 #include <test/bootstrapfixture.hxx>
14 #include <test/xmltesttools.hxx>
16 #include <comphelper/seqstream.hxx>
18 #include <com/sun/star/graphic/SvgTools.hpp>
19 #include <com/sun/star/graphic/XPrimitive2D.hpp>
21 #include <drawinglayer/primitive2d/Tools.hxx>
22 #include <drawinglayer/tools/primitive2dxmldump.hxx>
23 #include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
26 #include <string_view>
29 using namespace css::uno
;
30 using namespace css::io
;
31 using namespace css::graphic
;
32 using drawinglayer::primitive2d::Primitive2DSequence
;
33 using drawinglayer::primitive2d::Primitive2DContainer
;
34 using drawinglayer::primitive2d::Primitive2DReference
;
36 class Test
: public test::BootstrapFixture
, public XmlTestTools
39 void checkRectPrimitive(Primitive2DSequence
const & rPrimitive
);
41 Primitive2DSequence
parseSvg(std::u16string_view aSource
);
44 Primitive2DSequence
Test::parseSvg(std::u16string_view aSource
)
46 const Reference
<XSvgParser
> xSvgParser
= SvgTools::create(m_xContext
);
48 OUString aUrl
= m_directories
.getURLFromSrc(aSource
);
49 OUString aPath
= m_directories
.getPathFromSrc(aSource
);
51 SvFileStream
aFileStream(aUrl
, StreamMode::READ
);
52 std::size_t nSize
= aFileStream
.remainingSize();
53 std::unique_ptr
<sal_Int8
[]> pBuffer(new sal_Int8
[nSize
+ 1]);
54 aFileStream
.ReadBytes(pBuffer
.get(), nSize
);
57 Sequence
<sal_Int8
> aData(pBuffer
.get(), nSize
+ 1);
58 Reference
<XInputStream
> aInputStream(new comphelper::SequenceInputStream(aData
));
60 return xSvgParser
->getDecomposition(aInputStream
, aPath
);
63 void Test::checkRectPrimitive(Primitive2DSequence
const & rPrimitive
)
65 drawinglayer::Primitive2dXmlDump dumper
;
66 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(rPrimitive
));
68 CPPUNIT_ASSERT (pDocument
);
70 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#00cc00"); // rect background color
71 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "height"_ostr
, "100"); // rect background height
72 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "width"_ostr
, "100"); // rect background width
73 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "minx"_ostr
, "10");
74 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "miny"_ostr
, "10");
75 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "maxx"_ostr
, "110");
76 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "maxy"_ostr
, "110");
77 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line"_ostr
, "color"_ostr
, "#ff0000"); // rect stroke color
78 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line"_ostr
, "width"_ostr
, "3"); // rect stroke width
85 bool arePrimitive2DSequencesEqual(const Primitive2DSequence
& rA
, const Primitive2DSequence
& rB
)
87 auto rv
= std::mismatch(rA
.begin(), rA
.end(), rB
.begin(), rB
.end(),
88 [](const css::uno::Reference
<css::graphic::XPrimitive2D
>& a
,
89 const css::uno::Reference
<css::graphic::XPrimitive2D
>& b
)
91 return drawinglayer::primitive2d::arePrimitive2DReferencesEqual(a
, b
);
93 if (rv
.first
== rA
.end() && rv
.second
== rB
.end())
95 if (rv
.first
== rA
.end() || rv
.second
== rB
.end())
98 "first seq length == " << rA
.size() <<
99 "second seq length == " << rB
.size());
102 auto idx
= std::distance(rA
.begin(), rv
.first
);
104 "first difference at index " << idx
<<
105 " expected element " << typeid(*rA
[idx
]).name() <<
106 " but got element " << typeid(*rB
[idx
]).name());
111 // Attributes for an object (like rect as in this case) can be defined
112 // in different ways (directly with xml attributes, or with CSS styles),
113 // however the end result should be the same.
114 CPPUNIT_TEST_FIXTURE(Test
, testStyles
)
116 Primitive2DSequence aSequenceRect
= parseSvg(u
"/svgio/qa/cppunit/data/Rect.svg");
117 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRect
.getLength()));
118 checkRectPrimitive(aSequenceRect
);
120 Primitive2DSequence aSequenceRectWithStyle
= parseSvg(u
"/svgio/qa/cppunit/data/RectWithStyles.svg");
121 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithStyle
.getLength()));
122 checkRectPrimitive(aSequenceRectWithStyle
);
124 Primitive2DSequence aSequenceRectWithParentStyle
= parseSvg(u
"/svgio/qa/cppunit/data/RectWithParentStyles.svg");
125 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithParentStyle
.getLength()));
126 checkRectPrimitive(aSequenceRectWithParentStyle
);
128 Primitive2DSequence aSequenceRectWithStylesByGroup
= parseSvg(u
"/svgio/qa/cppunit/data/RectWithStylesByGroup.svg");
129 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRectWithStylesByGroup
.getLength()));
130 checkRectPrimitive(aSequenceRectWithStylesByGroup
);
132 CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect
, aSequenceRectWithStyle
));
133 CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect
, aSequenceRectWithParentStyle
));
134 CPPUNIT_ASSERT(arePrimitive2DSequencesEqual(aSequenceRect
, aSequenceRectWithStylesByGroup
));
137 CPPUNIT_TEST_FIXTURE(Test
, testSymbol
)
139 Primitive2DSequence aSequenceTdf87309
= parseSvg(u
"/svgio/qa/cppunit/data/symbol.svg");
140 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf87309
.getLength()));
142 drawinglayer::Primitive2dXmlDump dumper
;
143 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf87309
);
145 CPPUNIT_ASSERT (pDocument
);
147 // tdf#126330: Without the fix in place, this test would have failed with
150 // number of nodes is incorrect
151 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#00d000");
154 CPPUNIT_TEST_FIXTURE(Test
, testTdf150124
)
156 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf150124.svg");
157 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
159 drawinglayer::Primitive2dXmlDump dumper
;
160 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
162 CPPUNIT_ASSERT (pDocument
);
164 assertXPathChildren(pDocument
, "/primitive2D"_ostr
, 1);
165 assertXPath(pDocument
, "/primitive2D/hiddengeometry"_ostr
, 1);
168 CPPUNIT_TEST_FIXTURE(Test
, testTdf155819
)
170 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf155819.svg");
171 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
173 drawinglayer::Primitive2dXmlDump dumper
;
174 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
176 CPPUNIT_ASSERT (pDocument
);
178 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line"_ostr
, 1);
179 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/polypolygon"_ostr
, 1);
180 // Without the fix in place, this test would have failed with
183 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, 4);
186 CPPUNIT_TEST_FIXTURE(Test
, testFeColorMatrix
)
188 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeColorMatrix.svg");
189 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
191 drawinglayer::Primitive2dXmlDump dumper
;
192 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
194 CPPUNIT_ASSERT (pDocument
);
196 assertXPath(pDocument
, "/primitive2D/transform/mask/modifiedColor[1]"_ostr
, "modifier"_ostr
, "matrix");
197 assertXPath(pDocument
, "/primitive2D/transform/mask/modifiedColor[2]"_ostr
, "modifier"_ostr
, "saturate");
198 assertXPath(pDocument
, "/primitive2D/transform/mask/modifiedColor[3]"_ostr
, "modifier"_ostr
, "hueRotate");
199 assertXPath(pDocument
, "/primitive2D/transform/mask/modifiedColor[4]"_ostr
, "modifier"_ostr
, "luminance_to_alpha");
202 CPPUNIT_TEST_FIXTURE(Test
, testFilterFeGaussianBlur
)
204 Primitive2DSequence aSequenceTdf132246
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeGaussianBlur.svg");
205 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246
.getLength()));
207 drawinglayer::Primitive2dXmlDump dumper
;
208 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf132246
);
210 CPPUNIT_ASSERT (pDocument
);
212 assertXPath(pDocument
, "/primitive2D/transform/softedge"_ostr
, "radius"_ostr
, "5");
215 CPPUNIT_TEST_FIXTURE(Test
, testInFilterAttribute
)
217 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/inFilterAttribute.svg");
218 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
220 drawinglayer::Primitive2dXmlDump dumper
;
221 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
223 CPPUNIT_ASSERT (pDocument
);
225 // Without the fix in place, the feGaussianBlur and feColorMatrix filter would have been applied
226 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy11"_ostr
, "1");
227 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy12"_ostr
, "0");
228 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy13"_ostr
, "40");
229 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy21"_ostr
, "0");
230 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy22"_ostr
, "1");
231 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy23"_ostr
, "40");
232 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy31"_ostr
, "0");
233 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy32"_ostr
, "0");
234 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy33"_ostr
, "1");
235 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#ffffff");
238 CPPUNIT_TEST_FIXTURE(Test
, testResultFilterAttribute
)
240 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/resultFilterAttribute.svg");
241 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
243 drawinglayer::Primitive2dXmlDump dumper
;
244 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
246 CPPUNIT_ASSERT (pDocument
);
248 // Without the fix in place, the feColorMatrix filter would have been applied
249 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy11"_ostr
, "1");
250 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy12"_ostr
, "0");
251 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy13"_ostr
, "40");
252 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy21"_ostr
, "0");
253 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy22"_ostr
, "1");
254 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy23"_ostr
, "40");
255 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy31"_ostr
, "0");
256 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy32"_ostr
, "0");
257 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy33"_ostr
, "1");
258 assertXPath(pDocument
, "/primitive2D/transform/transform/softedge"_ostr
, "radius"_ostr
, "2");
259 assertXPath(pDocument
, "/primitive2D/transform/transform/softedge/polypolygoncolor"_ostr
, "color"_ostr
, "#ffffff");
262 CPPUNIT_TEST_FIXTURE(Test
, testFilterFeMerge
)
264 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeMerge.svg");
265 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
267 drawinglayer::Primitive2dXmlDump dumper
;
268 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
270 CPPUNIT_ASSERT (pDocument
);
272 assertXPath(pDocument
, "/primitive2D/transform/mask/softedge"_ostr
, 2);
273 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygon"_ostr
, 1);
274 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor"_ostr
, 1);
275 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygonstroke"_ostr
, 1);
278 CPPUNIT_TEST_FIXTURE(Test
, testFilterFeOffset
)
280 Primitive2DSequence aSequenceTdf132246
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeOffset.svg");
281 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246
.getLength()));
283 drawinglayer::Primitive2dXmlDump dumper
;
284 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf132246
);
286 CPPUNIT_ASSERT (pDocument
);
288 assertXPath(pDocument
, "/primitive2D/transform/mask/transform"_ostr
, "xy11"_ostr
, "1");
289 assertXPath(pDocument
, "/primitive2D/transform/mask/transform"_ostr
, "xy12"_ostr
, "0");
290 assertXPath(pDocument
, "/primitive2D/transform/mask/transform"_ostr
, "xy13"_ostr
, "44");
291 assertXPath(pDocument
, "/primitive2D/transform/mask/transform"_ostr
, "xy21"_ostr
, "0");
292 assertXPath(pDocument
, "/primitive2D/transform/mask/transform"_ostr
, "xy22"_ostr
, "1");
293 assertXPath(pDocument
, "/primitive2D/transform/mask/transform"_ostr
, "xy23"_ostr
, "66");
294 assertXPath(pDocument
, "/primitive2D/transform/mask/transform"_ostr
, "xy31"_ostr
, "0");
295 assertXPath(pDocument
, "/primitive2D/transform/mask/transform"_ostr
, "xy32"_ostr
, "0");
296 assertXPath(pDocument
, "/primitive2D/transform/mask/transform"_ostr
, "xy33"_ostr
, "1");
299 CPPUNIT_TEST_FIXTURE(Test
, testFilterFeFlood
)
301 Primitive2DSequence aSequenceTdf132246
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeFlood.svg");
302 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246
.getLength()));
304 drawinglayer::Primitive2dXmlDump dumper
;
305 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf132246
);
307 CPPUNIT_ASSERT (pDocument
);
309 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence"_ostr
, "transparence"_ostr
, "50");
310 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor"_ostr
, "color"_ostr
, "#008000");
311 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon"_ostr
, "height"_ostr
, "100");
312 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon"_ostr
, "width"_ostr
, "100");
313 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon"_ostr
, "minx"_ostr
, "50");
314 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor/polypolygon"_ostr
, "miny"_ostr
, "50");
317 CPPUNIT_TEST_FIXTURE(Test
, testFilterFeDropShadow
)
319 Primitive2DSequence aSequenceTdf132246
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeDropShadow.svg");
320 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246
.getLength()));
322 drawinglayer::Primitive2dXmlDump dumper
;
323 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf132246
);
325 CPPUNIT_ASSERT (pDocument
);
327 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence"_ostr
, "transparence"_ostr
, "50");
328 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/shadow"_ostr
, "color"_ostr
, "#0000ff");
329 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/shadow"_ostr
, "blur"_ostr
, "0.2");
330 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/shadow"_ostr
, "blur"_ostr
, "0.2");
331 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#ffc0cb");
334 CPPUNIT_TEST_FIXTURE(Test
, testFilterFeImage
)
336 Primitive2DSequence aSequenceTdf132246
= parseSvg(u
"/svgio/qa/cppunit/data/filterFeImage.svg");
337 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf132246
.getLength()));
339 drawinglayer::Primitive2dXmlDump dumper
;
340 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf132246
);
342 CPPUNIT_ASSERT (pDocument
);
344 assertXPath(pDocument
, "/primitive2D/transform/transform/bitmap"_ostr
);
347 CPPUNIT_TEST_FIXTURE(Test
, testTdf87309
)
349 Primitive2DSequence aSequenceTdf87309
= parseSvg(u
"/svgio/qa/cppunit/data/tdf87309.svg");
350 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf87309
.getLength()));
352 drawinglayer::Primitive2dXmlDump dumper
;
353 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf87309
);
355 CPPUNIT_ASSERT (pDocument
);
357 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#000000");
358 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "height"_ostr
, "100");
359 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "width"_ostr
, "100");
360 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "minx"_ostr
, "10");
361 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "miny"_ostr
, "10");
362 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "maxx"_ostr
, "110");
363 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "maxy"_ostr
, "110");
366 CPPUNIT_TEST_FIXTURE(Test
, testFontsizeKeywords
)
368 Primitive2DSequence aSequenceFontsizeKeywords
= parseSvg(u
"/svgio/qa/cppunit/data/FontsizeKeywords.svg");
369 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeKeywords
.getLength()));
371 drawinglayer::Primitive2dXmlDump dumper
;
372 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceFontsizeKeywords
);
374 CPPUNIT_ASSERT (pDocument
);
376 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "fontcolor"_ostr
, "#000000");
377 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "Sample");
378 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "9");
379 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "familyname"_ostr
, "Times New Roman");
381 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "fontcolor"_ostr
, "#ffffff");
382 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "Sample");
383 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "height"_ostr
, "11");
384 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "familyname"_ostr
, "Times New Roman");
386 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "fontcolor"_ostr
, "#ffd700");
387 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "text"_ostr
, "Sample");
388 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "height"_ostr
, "13");
389 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "familyname"_ostr
, "Times New Roman");
391 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "fontcolor"_ostr
, "#ff0000");
392 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "text"_ostr
, "Sample");
393 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "height"_ostr
, "16");
394 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "familyname"_ostr
, "Times New Roman");
396 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "fontcolor"_ostr
, "#ffff00");
397 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "text"_ostr
, "Sample");
398 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "height"_ostr
, "19");
399 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "familyname"_ostr
, "Times New Roman");
401 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "fontcolor"_ostr
, "#0000ff");
402 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "text"_ostr
, "Sample");
403 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "height"_ostr
, "23");
404 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "familyname"_ostr
, "Times New Roman");
406 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "fontcolor"_ostr
, "#008000");
407 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "text"_ostr
, "Sample");
408 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "height"_ostr
, "27");
409 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "familyname"_ostr
, "Times New Roman");
411 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "fontcolor"_ostr
, "#ff7f50");
412 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "text"_ostr
, "Sample");
413 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "height"_ostr
, "13");
414 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "familyname"_ostr
, "Times New Roman");
416 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "fontcolor"_ostr
, "#ffc0cb");
417 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "text"_ostr
, "Sample");
418 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "height"_ostr
, "19");
419 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "familyname"_ostr
, "Times New Roman");
421 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]"_ostr
, "fontcolor"_ostr
, "#fffff0");
422 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]"_ostr
, "text"_ostr
, "Sample");
423 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]"_ostr
, "height"_ostr
, "16");
424 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "familyname"_ostr
, "Times New Roman");
428 CPPUNIT_TEST_FIXTURE(Test
, testFontsizePercentage
)
430 //Check when font-size uses percentage and defined globally
431 Primitive2DSequence aSequenceFontsizePercentage
= parseSvg(u
"/svgio/qa/cppunit/data/FontsizePercentage.svg");
432 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizePercentage
.getLength()));
434 drawinglayer::Primitive2dXmlDump dumper
;
435 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceFontsizePercentage
);
437 CPPUNIT_ASSERT (pDocument
);
439 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "fontcolor"_ostr
, "#000000");
440 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "Sample");
441 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "16");
442 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "familyname"_ostr
, "Times New Roman");
445 CPPUNIT_TEST_FIXTURE(Test
, testFontsizeRelative
)
447 //Check when font-size uses relative units (em,ex) and it's based on its parent's font-size
448 Primitive2DSequence aSequenceFontsizeRelative
= parseSvg(u
"/svgio/qa/cppunit/data/FontsizeRelative.svg");
449 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceFontsizeRelative
.getLength()));
451 drawinglayer::Primitive2dXmlDump dumper
;
452 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceFontsizeRelative
);
454 CPPUNIT_ASSERT (pDocument
);
456 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "fontcolor"_ostr
, "#000000");
457 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "Sample");
458 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "50");
459 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "familyname"_ostr
, "DejaVu Serif");
461 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "fontcolor"_ostr
, "#000000");
462 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "Sample");
463 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "height"_ostr
, "50");
464 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "familyname"_ostr
, "DejaVu Serif");
467 CPPUNIT_TEST_FIXTURE(Test
, testTdf145896
)
469 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf145896.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: #ffff00
479 // - Actual : #000000
480 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]"_ostr
, "color"_ostr
, "#ffff00");
481 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]"_ostr
, "color"_ostr
, "#008000");
482 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]"_ostr
, "color"_ostr
, "#0000ff");
485 CPPUNIT_TEST_FIXTURE(Test
, testTdf156168
)
487 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156168.svg");
488 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
490 drawinglayer::Primitive2dXmlDump dumper
;
491 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
493 CPPUNIT_ASSERT (pDocument
);
495 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor"_ostr
, 8);
496 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]"_ostr
, "color"_ostr
, "#0000ff");
497 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]"_ostr
, "color"_ostr
, "#0000ff");
498 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]"_ostr
, "color"_ostr
, "#ff0000");
499 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[4]"_ostr
, "color"_ostr
, "#ff0000");
500 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[5]"_ostr
, "color"_ostr
, "#000000");
501 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[6]"_ostr
, "color"_ostr
, "#000000");
502 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[7]"_ostr
, "color"_ostr
, "#ff0000");
503 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[8]"_ostr
, "color"_ostr
, "#ff0000");
505 // Without the fix in place, this test would have failed with
508 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke"_ostr
, 4);
509 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[1]/line"_ostr
, "width"_ostr
, "5");
511 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[1]/line"_ostr
, "color"_ostr
, "#00ff00");
512 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[2]/line"_ostr
, "width"_ostr
, "5");
514 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[2]/line"_ostr
, "color"_ostr
, "#00ff00");
515 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[3]/line"_ostr
, "width"_ostr
, "5");
517 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[3]/line"_ostr
, "color"_ostr
, "#00ff00");
518 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[4]/line"_ostr
, "width"_ostr
, "5");
520 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke[4]/line"_ostr
, "color"_ostr
, "#00ff00");
523 CPPUNIT_TEST_FIXTURE(Test
, testTdf129356
)
525 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf129356.svg");
526 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
528 drawinglayer::Primitive2dXmlDump dumper
;
529 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
531 CPPUNIT_ASSERT (pDocument
);
533 // Without the fix in place, this test would have failed with
534 // - Expected: #008000
535 // - Actual : #0000ff
536 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]"_ostr
, "color"_ostr
, "#008000");
537 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]"_ostr
, "color"_ostr
, "#008000");
538 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]"_ostr
, "color"_ostr
, "#008000");
539 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[4]"_ostr
, "color"_ostr
, "#008000");
540 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[5]"_ostr
, "color"_ostr
, "#008000");
541 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[6]"_ostr
, "color"_ostr
, "#008000");
542 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[7]"_ostr
, "color"_ostr
, "#008000");
543 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[8]"_ostr
, "color"_ostr
, "#008000");
546 CPPUNIT_TEST_FIXTURE(Test
, testTdf156034
)
548 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156034.svg");
549 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
551 drawinglayer::Primitive2dXmlDump dumper
;
552 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
554 CPPUNIT_ASSERT (pDocument
);
556 // Without the fix in place, this test would have failed with
557 // - Expected: #008000
558 // - Actual : #0000ff
559 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]"_ostr
, "color"_ostr
, "#008000");
560 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]"_ostr
, "color"_ostr
, "#008000");
561 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]"_ostr
, "color"_ostr
, "#008000");
562 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[4]"_ostr
, "color"_ostr
, "#008000");
563 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[5]"_ostr
, "color"_ostr
, "#008000");
564 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[6]"_ostr
, "color"_ostr
, "#008000");
565 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[7]"_ostr
, "color"_ostr
, "#008000");
566 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[8]"_ostr
, "color"_ostr
, "#008000");
569 CPPUNIT_TEST_FIXTURE(Test
, testTdf156038
)
571 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156038.svg");
572 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
574 drawinglayer::Primitive2dXmlDump dumper
;
575 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
577 CPPUNIT_ASSERT (pDocument
);
579 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]"_ostr
, "color"_ostr
, "#0000ff");
581 // Without the fix in place, this test would have failed with
582 // - Expected: #008000
583 // - Actual : #0000ff
584 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]"_ostr
, "color"_ostr
, "#008000");
585 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]"_ostr
, "color"_ostr
, "#0000ff");
586 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[4]"_ostr
, "color"_ostr
, "#008000");
587 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[5]"_ostr
, "color"_ostr
, "#0000ff");
588 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[6]"_ostr
, "color"_ostr
, "#008000");
589 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[7]"_ostr
, "color"_ostr
, "#0000ff");
590 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[8]"_ostr
, "color"_ostr
, "#008000");
593 CPPUNIT_TEST_FIXTURE(Test
, testTdf156018
)
595 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156018.svg");
596 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
598 drawinglayer::Primitive2dXmlDump dumper
;
599 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
601 CPPUNIT_ASSERT (pDocument
);
603 // Without the fix in place, this test would have failed with
604 // - Expected: #008000
605 // - Actual : #0000ff
606 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]"_ostr
, "color"_ostr
, "#008000");
607 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]"_ostr
, "color"_ostr
, "#0000ff");
610 CPPUNIT_TEST_FIXTURE(Test
, testTdf156201
)
612 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156201.svg");
613 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
615 drawinglayer::Primitive2dXmlDump dumper
;
616 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
618 CPPUNIT_ASSERT (pDocument
);
620 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#2f3ba1");
623 CPPUNIT_TEST_FIXTURE(Test
, testTdf156167
)
625 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156167.svg");
626 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
628 drawinglayer::Primitive2dXmlDump dumper
;
629 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
631 CPPUNIT_ASSERT (pDocument
);
633 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]"_ostr
, "color"_ostr
, "#ffa500");
635 // Without the fix in place, this test would have failed with
636 // - Expected: #ffa500
637 // - Actual : #ff0000
638 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]"_ostr
, "color"_ostr
, "#ffa500");
639 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]"_ostr
, "color"_ostr
, "#ffa500");
642 CPPUNIT_TEST_FIXTURE(Test
, testTdf155932
)
644 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf155932.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 assertXPath(pDocument
, "/primitive2D/transform/mask/mask/unifiedtransparence"_ostr
, "transparence"_ostr
, "50");
653 assertXPath(pDocument
, "/primitive2D/transform/mask/mask/unifiedtransparence[1]/polypolygoncolor"_ostr
, "color"_ostr
, "#0000ff");
656 CPPUNIT_TEST_FIXTURE(Test
, testTdf97717
)
658 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97717.svg");
659 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
661 drawinglayer::Primitive2dXmlDump dumper
;
662 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
664 CPPUNIT_ASSERT (pDocument
);
666 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence[1]"_ostr
, "transparence"_ostr
, "50");
667 // Without the fix in place, this test would have failed here since the patch
668 // would have contained two unifiedtransparence
669 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence[1]/polypolygoncolor"_ostr
, "color"_ostr
, "#ccccff");
670 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence[2]"_ostr
, "transparence"_ostr
, "50");
671 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence[2]/polypolygoncolor"_ostr
, "color"_ostr
, "#ccccff");
674 CPPUNIT_TEST_FIXTURE(Test
, testMarkerOrient
)
676 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/MarkerOrient.svg");
677 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
679 drawinglayer::Primitive2dXmlDump dumper
;
680 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
682 CPPUNIT_ASSERT (pDocument
);
684 assertXPath(pDocument
, "/primitive2D/transform/transform[1]"_ostr
, "xy11"_ostr
, "0");
685 assertXPath(pDocument
, "/primitive2D/transform/transform[1]"_ostr
, "xy12"_ostr
, "0");
686 assertXPath(pDocument
, "/primitive2D/transform/transform[1]"_ostr
, "xy13"_ostr
, "7");
687 assertXPath(pDocument
, "/primitive2D/transform/transform[1]"_ostr
, "xy21"_ostr
, "0");
688 assertXPath(pDocument
, "/primitive2D/transform/transform[1]"_ostr
, "xy22"_ostr
, "0");
689 assertXPath(pDocument
, "/primitive2D/transform/transform[1]"_ostr
, "xy23"_ostr
, "13");
690 assertXPath(pDocument
, "/primitive2D/transform/transform[1]"_ostr
, "xy31"_ostr
, "0");
691 assertXPath(pDocument
, "/primitive2D/transform/transform[1]"_ostr
, "xy32"_ostr
, "0");
692 assertXPath(pDocument
, "/primitive2D/transform/transform[1]"_ostr
, "xy33"_ostr
, "1");
694 assertXPath(pDocument
, "/primitive2D/transform/transform[2]"_ostr
, "xy11"_ostr
, "0");
695 assertXPath(pDocument
, "/primitive2D/transform/transform[2]"_ostr
, "xy12"_ostr
, "0");
696 assertXPath(pDocument
, "/primitive2D/transform/transform[2]"_ostr
, "xy13"_ostr
, "87");
697 assertXPath(pDocument
, "/primitive2D/transform/transform[2]"_ostr
, "xy21"_ostr
, "0");
698 assertXPath(pDocument
, "/primitive2D/transform/transform[2]"_ostr
, "xy22"_ostr
, "0");
699 assertXPath(pDocument
, "/primitive2D/transform/transform[2]"_ostr
, "xy23"_ostr
, "87");
700 assertXPath(pDocument
, "/primitive2D/transform/transform[2]"_ostr
, "xy31"_ostr
, "0");
701 assertXPath(pDocument
, "/primitive2D/transform/transform[2]"_ostr
, "xy32"_ostr
, "0");
702 assertXPath(pDocument
, "/primitive2D/transform/transform[2]"_ostr
, "xy33"_ostr
, "1");
705 CPPUNIT_TEST_FIXTURE(Test
, testMarkerInPresentation
)
707 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/markerInPresentation.svg");
708 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
710 drawinglayer::Primitive2dXmlDump dumper
;
711 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
713 CPPUNIT_ASSERT (pDocument
);
715 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr
, 1);
716 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/polypolygon/polygon"_ostr
, 1);
717 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/polypolygon/polygon"_ostr
, 1);
719 // Without the fix in place, this test would have failed with
722 assertXPath(pDocument
, "/primitive2D/transform/transform/transform"_ostr
, 0);
725 CPPUNIT_TEST_FIXTURE(Test
, testMarkerInCssStyle
)
727 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/markerInCssStyle.svg");
728 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
730 drawinglayer::Primitive2dXmlDump dumper
;
731 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
733 CPPUNIT_ASSERT (pDocument
);
735 // Without the fix in place, this test would have failed with
738 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr
, 20);
740 assertXPath(pDocument
, "/primitive2D/transform/transform[1]/polypolygonstroke/line"_ostr
, "color"_ostr
, "#008000");
741 assertXPath(pDocument
, "/primitive2D/transform/transform[1]/polypolygonstroke/line"_ostr
, "width"_ostr
, "1");
742 assertXPath(pDocument
, "/primitive2D/transform/transform[1]/polypolygonstroke/line"_ostr
, "linejoin"_ostr
, "Miter");
743 assertXPath(pDocument
, "/primitive2D/transform/transform[1]/polypolygonstroke/line"_ostr
, "miterangle"_ostr
, "28");
744 assertXPath(pDocument
, "/primitive2D/transform/transform[1]/polypolygonstroke/line"_ostr
, "linecap"_ostr
, "BUTT");
747 CPPUNIT_TEST_FIXTURE(Test
, testTextXmlSpace
)
749 //Check tspan fontsize when using relative units
750 Primitive2DSequence aSequenceTdf97941
= parseSvg(u
"/svgio/qa/cppunit/data/textXmlSpace.svg");
751 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97941
.getLength()));
753 drawinglayer::Primitive2dXmlDump dumper
;
754 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf97941
);
756 CPPUNIT_ASSERT (pDocument
);
758 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr
, "text"_ostr
, "a b");
759 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr
, "text"_ostr
, "a b");
760 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr
, "text"_ostr
, "a b");
761 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr
, "text"_ostr
, "ab");
762 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[5]"_ostr
, "text"_ostr
, " a b ");
763 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[6]"_ostr
, "text"_ostr
, "a b");
764 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[7]"_ostr
, "text"_ostr
, "a b");
765 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[8]"_ostr
, "text"_ostr
, "a b");
768 CPPUNIT_TEST_FIXTURE(Test
, testTdf45771
)
770 //Check text fontsize when using relative units
771 Primitive2DSequence aSequenceTdf45771
= parseSvg(u
"/svgio/qa/cppunit/data/tdf45771.svg");
772 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf45771
.getLength()));
774 drawinglayer::Primitive2dXmlDump dumper
;
775 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf45771
);
777 CPPUNIT_ASSERT (pDocument
);
779 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "fontcolor"_ostr
, "#000000");
780 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "Sample");
781 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "32");
782 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "familyname"_ostr
, "Times New Roman");
785 CPPUNIT_TEST_FIXTURE(Test
, testTdf155833
)
787 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf155833.svg");
788 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
790 drawinglayer::Primitive2dXmlDump dumper
;
791 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequence
);
793 CPPUNIT_ASSERT (pDocument
);
795 assertXPath(pDocument
, "/primitive2D/transform/mask/transform/transform/transform/transform/transform/bitmap"_ostr
, 1);
798 CPPUNIT_TEST_FIXTURE(Test
, testTdf97941
)
800 //Check tspan fontsize when using relative units
801 Primitive2DSequence aSequenceTdf97941
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97941.svg");
802 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97941
.getLength()));
804 drawinglayer::Primitive2dXmlDump dumper
;
805 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf97941
);
807 CPPUNIT_ASSERT (pDocument
);
809 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "fontcolor"_ostr
, "#000000");
810 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "Sample");
811 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "48");
812 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "familyname"_ostr
, "Times New Roman");
815 CPPUNIT_TEST_FIXTURE(Test
, testTdf156777
)
817 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156777.svg");
818 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
820 drawinglayer::Primitive2dXmlDump dumper
;
821 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
823 CPPUNIT_ASSERT (pDocument
);
825 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion"_ostr
, 23);
826 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "Quick brown fox jumps over the lazy dog.");
828 // Without the fix in place, this test would have failed with
829 // - Expected: #008000
830 // - Actual : #000000
831 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "fontcolor"_ostr
, "#008000");
832 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "x"_ostr
, "84");
833 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "y"_ostr
, "23");
836 CPPUNIT_TEST_FIXTURE(Test
, testTdf156834
)
838 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156834.svg");
839 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
841 drawinglayer::Primitive2dXmlDump dumper
;
842 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
844 CPPUNIT_ASSERT (pDocument
);
846 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion"_ostr
, 4);
847 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "Auto");
848 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "x"_ostr
, "30");
849 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "y"_ostr
, "20");
851 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "Middle");
852 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "x"_ostr
, "30");
853 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "y"_ostr
, "56");
855 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "text"_ostr
, "Hanging");
856 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "x"_ostr
, "30");
857 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "y"_ostr
, "94");
859 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "text"_ostr
, "Central");
860 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "x"_ostr
, "30");
861 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "y"_ostr
, "116");
864 CPPUNIT_TEST_FIXTURE(Test
, testTdf104339
)
866 Primitive2DSequence aSequenceTdf104339
= parseSvg(u
"/svgio/qa/cppunit/data/tdf104339.svg");
867 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf104339
.getLength()));
869 drawinglayer::Primitive2dXmlDump dumper
;
870 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(aSequenceTdf104339
);
872 CPPUNIT_ASSERT (pDocument
);
873 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/transform/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#000000");
876 CPPUNIT_TEST_FIXTURE(Test
, testTdf85770
)
878 Primitive2DSequence aSequenceTdf85770
= parseSvg(u
"/svgio/qa/cppunit/data/tdf85770.svg");
879 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf85770
.getLength()));
881 drawinglayer::Primitive2dXmlDump dumper
;
882 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf85770
));
884 CPPUNIT_ASSERT (pDocument
);
886 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "fontcolor"_ostr
, "#000000");
887 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "Start Middle End");
888 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "11");
889 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "familyname"_ostr
, "Times New Roman");
890 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "fontcolor"_ostr
, "#000000");
891 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "Start");
892 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "height"_ostr
, "11");
893 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "familyname"_ostr
, "Times New Roman");
894 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "fontcolor"_ostr
, "#000000");
895 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "text"_ostr
, " End");
896 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "height"_ostr
, "11");
897 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "familyname"_ostr
, "Times New Roman");
900 CPPUNIT_TEST_FIXTURE(Test
, testTdf86938
)
902 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf86938.svg");
903 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
905 drawinglayer::Primitive2dXmlDump dumper
;
906 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
908 CPPUNIT_ASSERT (pDocument
);
910 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "line");
911 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "x"_ostr
, "290");
912 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "y"_ostr
, "183");
913 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "above");
914 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "x"_ostr
, "290");
916 // Without the fix in place, this test would have failed with
919 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "y"_ostr
, "159");
920 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "text"_ostr
, "below");
921 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "x"_ostr
, "290");
922 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "y"_ostr
, "207");
925 CPPUNIT_TEST_FIXTURE(Test
, testTdf93583
)
927 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf93583.svg");
928 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
930 drawinglayer::Primitive2dXmlDump dumper
;
931 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
933 CPPUNIT_ASSERT (pDocument
);
935 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "This is the");
936 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "x"_ostr
, "62");
937 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "y"_ostr
, "303");
938 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "width"_ostr
, "16");
939 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "16");
940 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, " first");
941 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "x"_ostr
, "127");
942 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "y"_ostr
, "303");
943 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "width"_ostr
, "32");
944 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "height"_ostr
, "32");
945 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "text"_ostr
, " line");
946 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "x"_ostr
, "187");
947 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "y"_ostr
, "303");
948 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "width"_ostr
, "16");
949 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "height"_ostr
, "16");
952 CPPUNIT_TEST_FIXTURE(Test
, testTdf156616
)
954 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156616.svg");
955 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
957 drawinglayer::Primitive2dXmlDump dumper
;
958 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
960 CPPUNIT_ASSERT (pDocument
);
962 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "First");
963 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "x"_ostr
, "114");
964 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "y"_ostr
, "103");
965 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, " line");
966 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "x"_ostr
, "142");
967 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "y"_ostr
, "103");
968 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "text"_ostr
, "Second line");
969 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "x"_ostr
, "114");
970 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "y"_ostr
, "122");
971 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "text"_ostr
, "First");
972 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "x"_ostr
, "86");
973 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "y"_ostr
, "153");
974 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "text"_ostr
, " line");
975 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "x"_ostr
, "114");
976 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "y"_ostr
, "153");
977 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "text"_ostr
, "Second line");
978 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "x"_ostr
, "77");
979 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "y"_ostr
, "172");
980 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "text"_ostr
, "First");
981 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "x"_ostr
, "59");
982 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "y"_ostr
, "203");
983 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "text"_ostr
, " line");
984 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "x"_ostr
, "87");
985 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "y"_ostr
, "203");
986 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "text"_ostr
, "Second line");
987 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "x"_ostr
, "40");
988 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "y"_ostr
, "222");
991 CPPUNIT_TEST_FIXTURE(Test
, testTdf79163
)
994 Primitive2DSequence aSequenceTdf79163
= parseSvg(u
"/svgio/qa/cppunit/data/tdf79163.svg");
995 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf79163
.getLength()));
997 drawinglayer::Primitive2dXmlDump dumper
;
998 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf79163
));
1000 CPPUNIT_ASSERT (pDocument
);
1002 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence"_ostr
, "transparence"_ostr
, "50");
1005 CPPUNIT_TEST_FIXTURE(Test
, testTdf97542_1
)
1007 Primitive2DSequence aSequenceTdf97542_1
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97542_1.svg");
1008 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_1
.getLength()));
1010 drawinglayer::Primitive2dXmlDump dumper
;
1011 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf97542_1
));
1013 CPPUNIT_ASSERT (pDocument
);
1015 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/textsimpleportion"_ostr
, "fontcolor"_ostr
, "#ffff00");
1016 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/textsimpleportion"_ostr
, "text"_ostr
, "Text");
1017 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/textsimpleportion"_ostr
, "height"_ostr
, "48");
1018 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/textsimpleportion"_ostr
, "familyname"_ostr
, "DejaVu Serif");
1021 CPPUNIT_TEST_FIXTURE(Test
, testTdf97542_2
)
1023 Primitive2DSequence aSequenceTdf97542_2
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97542_2.svg");
1024 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97542_2
.getLength()));
1026 drawinglayer::Primitive2dXmlDump dumper
;
1027 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf97542_2
));
1029 CPPUNIT_ASSERT (pDocument
);
1031 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient"_ostr
, "startx"_ostr
, "1");
1032 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient"_ostr
, "starty"_ostr
, "1");
1033 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient/focalx"_ostr
, 0);
1034 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient/focaly"_ostr
, 0);
1035 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient"_ostr
, "radius"_ostr
, "3");
1036 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient"_ostr
, "spreadmethod"_ostr
, "pad");
1037 assertXPath(pDocument
, "/primitive2D/transform/objectinfo/svgradialgradient"_ostr
, "opacity"_ostr
, "1");
1040 CPPUNIT_TEST_FIXTURE(Test
, testTdf97543
)
1042 // check visibility="inherit"
1043 Primitive2DSequence aSequenceTdf97543
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97543.svg");
1044 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97543
.getLength()));
1046 drawinglayer::Primitive2dXmlDump dumper
;
1047 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf97543
));
1049 CPPUNIT_ASSERT (pDocument
);
1051 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#00cc00");
1052 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "height"_ostr
, "100");
1053 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "width"_ostr
, "100");
1054 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "minx"_ostr
, "10");
1055 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "miny"_ostr
, "10");
1056 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "maxx"_ostr
, "110");
1057 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "maxy"_ostr
, "110");
1060 CPPUNIT_TEST_FIXTURE(Test
, testRGBColor
)
1062 Primitive2DSequence aSequenceRGBColor
= parseSvg(u
"/svgio/qa/cppunit/data/RGBColor.svg");
1063 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBColor
.getLength()));
1065 drawinglayer::Primitive2dXmlDump dumper
;
1066 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceRGBColor
));
1068 CPPUNIT_ASSERT (pDocument
);
1070 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#646464");
1071 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "height"_ostr
, "100");
1072 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "width"_ostr
, "100");
1073 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "minx"_ostr
, "10");
1074 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "miny"_ostr
, "10");
1075 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "maxx"_ostr
, "110");
1076 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon"_ostr
, "maxy"_ostr
, "110");
1079 CPPUNIT_TEST_FIXTURE(Test
, testTdf149673
)
1081 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf149673.svg");
1082 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1084 drawinglayer::Primitive2dXmlDump dumper
;
1085 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1087 CPPUNIT_ASSERT (pDocument
);
1089 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence"_ostr
, "transparence"_ostr
, "90");
1090 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[1]"_ostr
, "color"_ostr
, "#ff0000");
1091 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[2]"_ostr
, "color"_ostr
, "#00ff00");
1092 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence/polypolygoncolor[3]"_ostr
, "color"_ostr
, "#0000ff");
1095 CPPUNIT_TEST_FIXTURE(Test
, testRGBAColor
)
1097 Primitive2DSequence aSequenceRGBAColor
= parseSvg(u
"/svgio/qa/cppunit/data/RGBAColor.svg");
1098 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBAColor
.getLength()));
1100 drawinglayer::Primitive2dXmlDump dumper
;
1101 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceRGBAColor
));
1103 CPPUNIT_ASSERT (pDocument
);
1105 assertXPath(pDocument
, "/primitive2D/transform/unifiedtransparence"_ostr
, "transparence"_ostr
, "50");
1108 CPPUNIT_TEST_FIXTURE(Test
, testNoneColor
)
1110 Primitive2DSequence aSequenceRGBAColor
= parseSvg(u
"/svgio/qa/cppunit/data/noneColor.svg");
1111 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceRGBAColor
.getLength()));
1113 drawinglayer::Primitive2dXmlDump dumper
;
1114 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceRGBAColor
));
1116 CPPUNIT_ASSERT (pDocument
);
1118 //No polypolygoncolor exists
1119 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor"_ostr
, 0);
1120 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygonstroke/line"_ostr
, "color"_ostr
, "#000000");
1121 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygonstroke/line"_ostr
, "width"_ostr
, "3");
1124 CPPUNIT_TEST_FIXTURE(Test
, testTdf117920
)
1126 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf117920.svg");
1127 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1129 drawinglayer::Primitive2dXmlDump dumper
;
1130 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1132 CPPUNIT_ASSERT (pDocument
);
1134 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy11"_ostr
, "1");
1135 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy12"_ostr
, "0");
1136 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy13"_ostr
, "-18");
1137 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy21"_ostr
, "0");
1138 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy22"_ostr
, "1");
1139 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy23"_ostr
, "-6");
1140 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy31"_ostr
, "0");
1141 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy32"_ostr
, "0");
1142 assertXPath(pDocument
, "/primitive2D/transform/transform"_ostr
, "xy33"_ostr
, "1");
1145 CPPUNIT_TEST_FIXTURE(Test
, testTdf97936
)
1147 // check that both rectangles are rendered in the viewBox
1148 Primitive2DSequence aSequenceTdf97936
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97936.svg");
1149 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf97936
.getLength()));
1151 drawinglayer::Primitive2dXmlDump dumper
;
1152 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf97936
));
1154 CPPUNIT_ASSERT (pDocument
);
1156 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]"_ostr
);
1157 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr
, "height"_ostr
, "50");
1158 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr
, "width"_ostr
, "50");
1159 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr
, "minx"_ostr
, "70");
1160 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr
, "miny"_ostr
, "50");
1161 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr
, "maxx"_ostr
, "120");
1162 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr
, "maxy"_ostr
, "100");
1163 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]"_ostr
);
1164 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr
, "height"_ostr
, "50");
1165 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr
, "width"_ostr
, "50");
1166 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr
, "minx"_ostr
, "10");
1167 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr
, "miny"_ostr
, "50");
1168 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr
, "maxx"_ostr
, "60");
1169 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr
, "maxy"_ostr
, "100");
1172 CPPUNIT_TEST_FIXTURE(Test
, testTdf149893
)
1174 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf149893.svg");
1175 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1177 drawinglayer::Primitive2dXmlDump dumper
;
1178 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1180 CPPUNIT_ASSERT (pDocument
);
1182 // Without the fix in place, this test would have failed with
1183 // - Expected: #008000
1184 // - Actual : #000000
1185 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#008000");
1188 CPPUNIT_TEST_FIXTURE(Test
, testShapeWithClipPathAndCssStyle
)
1190 // tdf#97539: Check there is a mask and 3 polygons
1191 Primitive2DSequence aSequenceClipPathAndStyle
= parseSvg(u
"/svgio/qa/cppunit/data/ShapeWithClipPathAndCssStyle.svg");
1192 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle
.getLength()));
1194 drawinglayer::Primitive2dXmlDump dumper
;
1195 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle
));
1197 CPPUNIT_ASSERT (pDocument
);
1199 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygon/polygon"_ostr
, 2);
1200 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor/polypolygon/polygon"_ostr
, 1);
1203 CPPUNIT_TEST_FIXTURE(Test
, testClipPathAndParentStyle
)
1205 //Check that fill color, stroke color and stroke-width are inherited from use element
1206 //when the element is within a clipPath element
1207 Primitive2DSequence aSequenceClipPathAndParentStyle
= parseSvg(u
"/svgio/qa/cppunit/data/ClipPathAndParentStyle.svg");
1208 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndParentStyle
.getLength()));
1210 drawinglayer::Primitive2dXmlDump dumper
;
1211 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndParentStyle
));
1213 CPPUNIT_ASSERT (pDocument
);
1215 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#ff0000");
1216 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr
, "color"_ostr
, "#000000");
1217 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr
, "width"_ostr
, "5");
1221 CPPUNIT_TEST_FIXTURE(Test
, testTdf155814
)
1223 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf155814.svg");
1224 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1226 drawinglayer::Primitive2dXmlDump dumper
;
1227 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1229 CPPUNIT_ASSERT (pDocument
);
1231 assertXPath(pDocument
, "/primitive2D/transform/mask/mask/transform/unifiedtransparence"_ostr
, "transparence"_ostr
, "50");
1232 assertXPath(pDocument
, "/primitive2D/transform/mask/mask/transform/unifiedtransparence/polypolygoncolor"_ostr
, "color"_ostr
, "#0000ff");
1235 CPPUNIT_TEST_FIXTURE(Test
, testClipPathAndStyle
)
1237 //Check that fill color, stroke color and stroke-width are inherited from use element
1238 //when the element is within a clipPath element
1239 Primitive2DSequence aSequenceClipPathAndStyle
= parseSvg(u
"/svgio/qa/cppunit/data/ClipPathAndStyle.svg");
1240 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle
.getLength()));
1242 drawinglayer::Primitive2dXmlDump dumper
;
1243 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle
));
1245 CPPUNIT_ASSERT (pDocument
);
1247 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#ccccff");
1248 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr
, "color"_ostr
, "#0000cc");
1249 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygonstroke/line"_ostr
, "width"_ostr
, "2");
1253 CPPUNIT_TEST_FIXTURE(Test
, testShapeWithClipPath
)
1255 // Check there is a mask and 3 polygons
1256 Primitive2DSequence aSequenceClipPathAndStyle
= parseSvg(u
"/svgio/qa/cppunit/data/ShapeWithClipPath.svg");
1257 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle
.getLength()));
1259 drawinglayer::Primitive2dXmlDump dumper
;
1260 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle
));
1262 CPPUNIT_ASSERT (pDocument
);
1264 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygon/polygon"_ostr
, 2);
1265 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor/polypolygon/polygon"_ostr
, 1);
1268 CPPUNIT_TEST_FIXTURE(Test
, testClipPathUsingClipPath
)
1270 Primitive2DSequence aSequenceClipPathAndStyle
= parseSvg(u
"/svgio/qa/cppunit/data/ClipPathUsingClipPath.svg");
1271 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceClipPathAndStyle
.getLength()));
1273 drawinglayer::Primitive2dXmlDump dumper
;
1274 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceClipPathAndStyle
));
1276 CPPUNIT_ASSERT (pDocument
);
1278 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygon/polygon/point"_ostr
, 20);
1279 assertXPath(pDocument
, "/primitive2D/transform/mask/mask/polypolygon/polygon/point"_ostr
, 13);
1282 CPPUNIT_TEST_FIXTURE(Test
, testFillRule
)
1284 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/FillRule.svg");
1285 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1287 drawinglayer::Primitive2dXmlDump dumper
;
1288 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1290 CPPUNIT_ASSERT (pDocument
);
1292 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#000000");
1293 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor/polypolygon/polygon"_ostr
, 2);
1294 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line"_ostr
, "color"_ostr
, "#ff0000");
1295 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/polypolygon/polygon"_ostr
, 2);
1298 CPPUNIT_TEST_FIXTURE(Test
, testClipRule
)
1300 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/ClipRule.svg");
1301 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1303 drawinglayer::Primitive2dXmlDump dumper
;
1304 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1306 CPPUNIT_ASSERT (pDocument
);
1308 // Without the place in place, this test would have failed with
1311 assertXPath(pDocument
, "/primitive2D/transform/mask[1]/polypolygon/polygon/point"_ostr
, 5);
1312 assertXPath(pDocument
, "/primitive2D/transform/mask[1]/polypolygoncolor"_ostr
, "color"_ostr
, "#0000ff");
1313 assertXPath(pDocument
, "/primitive2D/transform/mask[1]/polypolygoncolor/polypolygon/polygon/point"_ostr
, 4);
1315 assertXPath(pDocument
, "/primitive2D/transform/mask[2]/polypolygon/polygon/point"_ostr
, 5);
1316 assertXPath(pDocument
, "/primitive2D/transform/mask[2]/polypolygoncolor"_ostr
, "color"_ostr
, "#ff0000");
1317 assertXPath(pDocument
, "/primitive2D/transform/mask[2]/polypolygoncolor/polypolygon/polygon/point"_ostr
, 4);
1320 CPPUNIT_TEST_FIXTURE(Test
, testi125329
)
1322 //Check style inherit from * css element
1323 Primitive2DSequence aSequencei125329
= parseSvg(u
"/svgio/qa/cppunit/data/i125329.svg");
1324 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequencei125329
.getLength()));
1326 drawinglayer::Primitive2dXmlDump dumper
;
1327 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequencei125329
));
1329 CPPUNIT_ASSERT (pDocument
);
1331 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor"_ostr
, "color"_ostr
, "#c0c0c0"); // rect background color
1332 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr
, "height"_ostr
, "30"); // rect background height
1333 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr
, "width"_ostr
, "50"); // rect background width
1334 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr
, "minx"_ostr
, "15");
1335 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr
, "miny"_ostr
, "15");
1336 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr
, "maxx"_ostr
, "65");
1337 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygoncolor/polypolygon"_ostr
, "maxy"_ostr
, "45");
1338 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygonstroke/line"_ostr
, "color"_ostr
, "#008000"); // rect stroke color
1339 assertXPath(pDocument
, "/primitive2D/transform/transform/objectinfo/polypolygonstroke/line"_ostr
, "width"_ostr
, "1"); // rect stroke width
1342 CPPUNIT_TEST_FIXTURE(Test
, testMaskingPath07b
)
1344 //For the time being, check that masking-path-07-b.svg can be imported and it doesn't hang on loading
1345 //it used to hang after d5649ae7b76278cb3155f951d6327157c7c92b65
1346 Primitive2DSequence aSequenceMaskingPath07b
= parseSvg(u
"/svgio/qa/cppunit/data/masking-path-07-b.svg");
1347 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskingPath07b
.getLength()));
1349 drawinglayer::Primitive2dXmlDump dumper
;
1350 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceMaskingPath07b
));
1352 CPPUNIT_ASSERT (pDocument
);
1356 CPPUNIT_TEST_FIXTURE(Test
, test123926
)
1358 Primitive2DSequence aSequence123926
= parseSvg(u
"/svgio/qa/cppunit/data/tdf123926.svg");
1359 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence123926
.getLength()));
1361 drawinglayer::Primitive2dXmlDump dumper
;
1362 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence123926
));
1364 CPPUNIT_ASSERT (pDocument
);
1366 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/unifiedtransparence/polypolygoncolor"_ostr
, "color"_ostr
, "#7cb5ec");
1369 CPPUNIT_TEST_FIXTURE(Test
, test47446
)
1371 //Check that marker's fill attribute is black is not set
1372 Primitive2DSequence aSequence47446
= parseSvg(u
"/svgio/qa/cppunit/data/47446.svg");
1373 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446
.getLength()));
1375 drawinglayer::Primitive2dXmlDump dumper
;
1376 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence47446
));
1378 CPPUNIT_ASSERT (pDocument
);
1380 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#000000");
1384 CPPUNIT_TEST_FIXTURE(Test
, test47446b
)
1386 //Check that marker's fill attribute is inherit from def
1387 Primitive2DSequence aSequence47446b
= parseSvg(u
"/svgio/qa/cppunit/data/47446b.svg");
1388 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence47446b
.getLength()));
1390 drawinglayer::Primitive2dXmlDump dumper
;
1391 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence47446b
));
1393 CPPUNIT_ASSERT (pDocument
);
1395 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#ffff00");
1399 CPPUNIT_TEST_FIXTURE(Test
, testTdf103888
)
1401 Primitive2DSequence aSequenceMaskText
= parseSvg(u
"/svgio/qa/cppunit/data/tdf103888.svg");
1402 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskText
.getLength()));
1404 drawinglayer::Primitive2dXmlDump dumper
;
1405 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceMaskText
));
1407 CPPUNIT_ASSERT (pDocument
);
1409 // Without the fix in place, this test would have failed here with number of nodes is incorrect
1410 assertXPath(pDocument
, "/primitive2D/transform/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "Her");
1411 assertXPath(pDocument
, "/primitive2D/transform/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "vor");
1412 assertXPath(pDocument
, "/primitive2D/transform/transform/textsimpleportion[3]"_ostr
, "text"_ostr
, "hebung");
1415 CPPUNIT_TEST_FIXTURE(Test
, testTdf156251
)
1417 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156251.svg");
1418 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1420 drawinglayer::Primitive2dXmlDump dumper
;
1421 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1423 CPPUNIT_ASSERT (pDocument
);
1425 // Without the fix in place, this test would have failed with
1426 // - Expected: 'You are '
1427 // - Actual : 'You are'
1428 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "You are");
1429 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, " not");
1430 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "text"_ostr
, " a banana!");
1431 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "text"_ostr
, "You are");
1432 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "text"_ostr
, " not");
1433 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "text"_ostr
, " a banana!");
1436 CPPUNIT_TEST_FIXTURE(Test
, testMaskText
)
1438 //Check that mask is applied on text
1439 Primitive2DSequence aSequenceMaskText
= parseSvg(u
"/svgio/qa/cppunit/data/maskText.svg");
1440 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceMaskText
.getLength()));
1442 drawinglayer::Primitive2dXmlDump dumper
;
1443 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceMaskText
));
1445 CPPUNIT_ASSERT (pDocument
);
1447 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#000000");
1448 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/textsimpleportion"_ostr
, "fontcolor"_ostr
, "#ffffff");
1449 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/textsimpleportion"_ostr
, "text"_ostr
, "Black White");
1450 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/textsimpleportion"_ostr
, "height"_ostr
, "26");
1451 assertXPath(pDocument
, "/primitive2D/transform/transform/transform/textsimpleportion"_ostr
, "familyname"_ostr
, "Times New Roman");
1454 CPPUNIT_TEST_FIXTURE(Test
, testTdf99994
)
1456 //Check text fontsize when using relative units
1457 Primitive2DSequence aSequenceTdf99994
= parseSvg(u
"/svgio/qa/cppunit/data/tdf99994.svg");
1458 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99994
.getLength()));
1460 drawinglayer::Primitive2dXmlDump dumper
;
1461 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf99994
));
1463 CPPUNIT_ASSERT (pDocument
);
1465 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "fontcolor"_ostr
, "#0000ff");
1466 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "16");
1467 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "test");
1468 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "familyname"_ostr
, "DejaVu Sans");
1471 CPPUNIT_TEST_FIXTURE(Test
, testTdf99115
)
1473 //Check that styles are resolved correctly where there is a * css selector
1474 Primitive2DSequence aSequenceTdf99115
= parseSvg(u
"/svgio/qa/cppunit/data/tdf99115.svg");
1475 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf99115
.getLength()));
1477 drawinglayer::Primitive2dXmlDump dumper
;
1478 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf99115
) );
1480 CPPUNIT_ASSERT (pDocument
);
1482 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "red 1");
1483 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "fontcolor"_ostr
, "#ff0000");
1484 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "18");
1486 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "red 2");
1487 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "fontcolor"_ostr
, "#ff0000");
1488 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "height"_ostr
, "18");
1490 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "text"_ostr
, "red 3");
1491 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "fontcolor"_ostr
, "#ff0000");
1492 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "height"_ostr
, "18");
1494 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "text"_ostr
, "blue 4");
1495 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "fontcolor"_ostr
, "#0000ff");
1496 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "height"_ostr
, "18");
1498 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "text"_ostr
, "blue 5");
1499 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "fontcolor"_ostr
, "#0000ff");
1500 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "height"_ostr
, "18");
1502 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "text"_ostr
, "blue 6");
1503 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "fontcolor"_ostr
, "#0000ff");
1504 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "height"_ostr
, "18");
1506 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "text"_ostr
, "green 7");
1507 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "fontcolor"_ostr
, "#008000");
1508 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "height"_ostr
, "18");
1510 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "text"_ostr
, "green 8");
1511 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "fontcolor"_ostr
, "#008000");
1512 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "height"_ostr
, "18");
1514 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "text"_ostr
, "green 9");
1515 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "fontcolor"_ostr
, "#008000");
1516 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "height"_ostr
, "18");
1519 CPPUNIT_TEST_FIXTURE(Test
, testTdf101237
)
1521 //Check that fill color, stroke color and stroke-width are inherited from use element
1522 //when the element is within a clipPath element
1523 Primitive2DSequence aSequenceTdf101237
= parseSvg(u
"/svgio/qa/cppunit/data/tdf101237.svg");
1524 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf101237
.getLength()));
1526 drawinglayer::Primitive2dXmlDump dumper
;
1527 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf101237
));
1529 CPPUNIT_ASSERT (pDocument
);
1531 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#ff0000");
1532 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line"_ostr
, "color"_ostr
, "#000000");
1533 assertXPath(pDocument
, "/primitive2D/transform/polypolygonstroke/line"_ostr
, "width"_ostr
, "5");
1536 CPPUNIT_TEST_FIXTURE(Test
, testTdf97710
)
1538 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf97710.svg");
1539 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1541 drawinglayer::Primitive2dXmlDump dumper
;
1542 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1544 CPPUNIT_ASSERT (pDocument
);
1546 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[1]"_ostr
, "color"_ostr
, "#000000");
1548 // Without the fix in place, this test would have failed with
1551 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon"_ostr
, "width"_ostr
, "100");
1552 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[1]/polypolygon"_ostr
, "height"_ostr
, "100");
1553 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[2]"_ostr
, "color"_ostr
, "#008000");
1554 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon"_ostr
, "width"_ostr
, "100");
1555 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygoncolor[2]/polypolygon"_ostr
, "height"_ostr
, "100");
1556 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygonstroke/line"_ostr
, "color"_ostr
, "#000000");
1557 assertXPath(pDocument
, "/primitive2D/transform/mask/polypolygonstroke/line"_ostr
, "width"_ostr
, "1");
1560 CPPUNIT_TEST_FIXTURE(Test
, testTdf94765
)
1562 Primitive2DSequence aSequenceTdf94765
= parseSvg(u
"/svgio/qa/cppunit/data/tdf94765.svg");
1563 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf94765
.getLength()));
1565 drawinglayer::Primitive2dXmlDump dumper
;
1566 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf94765
));
1568 CPPUNIT_ASSERT (pDocument
);
1570 //Check that both rectangles use the gradient as fill
1571 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[1]"_ostr
, "startx"_ostr
, "1");
1572 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[1]"_ostr
, "starty"_ostr
, "1");
1573 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[1]"_ostr
, "endx"_ostr
, "2");
1574 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[1]"_ostr
, "endy"_ostr
, "1");
1575 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[2]"_ostr
, "startx"_ostr
, "0");
1576 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[2]"_ostr
, "starty"_ostr
, "0");
1577 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[2]"_ostr
, "endx"_ostr
, "0");
1578 assertXPath(pDocument
, "/primitive2D/transform/transform/svglineargradient[2]"_ostr
, "endy"_ostr
, "0");
1581 CPPUNIT_TEST_FIXTURE(Test
, testTdf156236
)
1583 Primitive2DSequence aSequenceTdf94765
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156236.svg");
1584 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf94765
.getLength()));
1586 drawinglayer::Primitive2dXmlDump dumper
;
1587 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequenceTdf94765
));
1589 CPPUNIT_ASSERT (pDocument
);
1591 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[1]/polypolygon"_ostr
, "path"_ostr
, "m50 180h-30v-60h60v60z");
1592 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[2]/polypolygon"_ostr
, "path"_ostr
, "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");
1593 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[3]/polypolygon"_ostr
, "path"_ostr
, "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");
1594 assertXPath(pDocument
, "/primitive2D/transform/polypolygoncolor[4]/polypolygon"_ostr
, "path"_ostr
, "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");
1597 CPPUNIT_TEST_FIXTURE(Test
, testBehaviourWhenWidthAndHeightIsOrIsNotSet
)
1599 // This test checks the behaviour when width and height attributes
1600 // are and are not set. In both cases the result must be the same,
1601 // however if the width / height are set, then the size of the image
1602 // is enforced, but this isn't really possible in LibreOffice (or
1603 // maybe we could lock the size in this case).
1604 // The behaviour in browsers is that when a SVG image has width / height
1605 // attributes set, then the image is shown with that size, but if it
1606 // isn't set then it is shown as scalable image which is the size of
1610 const Primitive2DSequence aSequence
= parseSvg(u
"svgio/qa/cppunit/data/Drawing_WithWidthHeight.svg");
1611 CPPUNIT_ASSERT(aSequence
.hasElements());
1613 geometry::RealRectangle2D aRealRect
;
1614 basegfx::B2DRange aRange
;
1615 uno::Sequence
<beans::PropertyValue
> aViewParameters
;
1617 for (css::uno::Reference
<css::graphic::XPrimitive2D
> const & xReference
: aSequence
)
1619 if (xReference
.is())
1621 aRealRect
= xReference
->getRange(aViewParameters
);
1622 aRange
.expand(basegfx::B2DRange(aRealRect
.X1
, aRealRect
.Y1
, aRealRect
.X2
, aRealRect
.Y2
));
1626 double fWidth
= (aRange
.getWidth() / 2540.0) * 96.0;
1627 double fHeight
= (aRange
.getHeight() / 2540.0) * 96.0;
1629 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fWidth
, 1E-12);
1630 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fHeight
, 1E-12);
1634 const Primitive2DSequence aSequence
= parseSvg(u
"svgio/qa/cppunit/data/Drawing_NoWidthHeight.svg");
1635 CPPUNIT_ASSERT(aSequence
.hasElements());
1638 geometry::RealRectangle2D aRealRect
;
1639 basegfx::B2DRange aRange
;
1640 uno::Sequence
<beans::PropertyValue
> aViewParameters
;
1642 for (css::uno::Reference
<css::graphic::XPrimitive2D
> const & xReference
: aSequence
)
1644 if (xReference
.is())
1646 aRealRect
= xReference
->getRange(aViewParameters
);
1647 aRange
.expand(basegfx::B2DRange(aRealRect
.X1
, aRealRect
.Y1
, aRealRect
.X2
, aRealRect
.Y2
));
1651 double fWidth
= (aRange
.getWidth() / 2540.0) * 96.0;
1652 double fHeight
= (aRange
.getHeight() / 2540.0) * 96.0;
1654 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fWidth
, 1E-12);
1655 CPPUNIT_ASSERT_DOUBLES_EQUAL(11.0, fHeight
, 1E-12);
1659 CPPUNIT_TEST_FIXTURE(Test
, testTdf155733
)
1661 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf155733.svg");
1662 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1664 drawinglayer::Primitive2dXmlDump dumper
;
1665 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1667 CPPUNIT_ASSERT (pDocument
);
1669 assertXPath(pDocument
, "/primitive2D/transform/softedge"_ostr
, "radius"_ostr
, "5");
1671 // Without the fix in place, the softedge would have been applied to the second element
1674 assertXPath(pDocument
, "/primitive2D/transform/transform/unifiedtransparence"_ostr
, "transparence"_ostr
, "50");
1677 CPPUNIT_TEST_FIXTURE(Test
, testTdf158445
)
1679 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf158445.svg");
1680 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1682 drawinglayer::Primitive2dXmlDump dumper
;
1683 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1685 CPPUNIT_ASSERT (pDocument
);
1687 assertXPath(pDocument
, "/primitive2D/transform/mask/transform/transform/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#000000");
1688 assertXPath(pDocument
, "/primitive2D/transform/mask/transform/transform/transform/polypolygoncolor/polypolygon"_ostr
, "height"_ostr
, "8.052");
1689 assertXPath(pDocument
, "/primitive2D/transform/mask/transform/transform/transform/polypolygoncolor/polypolygon"_ostr
, "width"_ostr
, "5.328");
1692 CPPUNIT_TEST_FIXTURE(Test
, testTdf159594
)
1694 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf159594.svg");
1695 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1697 drawinglayer::Primitive2dXmlDump dumper
;
1698 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1700 CPPUNIT_ASSERT (pDocument
);
1702 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#000000");
1703 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygoncolor/polypolygon"_ostr
, "height"_ostr
, "11.671875");
1704 assertXPath(pDocument
, "/primitive2D/transform/transform/polypolygoncolor/polypolygon"_ostr
, "width"_ostr
, "7.5");
1707 CPPUNIT_TEST_FIXTURE(Test
, testTdf97663
)
1709 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/em_units.svg");
1710 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1712 drawinglayer::Primitive2dXmlDump dumper
;
1713 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1715 CPPUNIT_ASSERT (pDocument
);
1717 // tdf#97663: Without the fix in place, this test would have failed with
1720 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "y"_ostr
, "236");
1723 CPPUNIT_TEST_FIXTURE(Test
, testTdf156269
)
1725 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156269.svg");
1726 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1728 drawinglayer::Primitive2dXmlDump dumper
;
1729 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1731 CPPUNIT_ASSERT (pDocument
);
1733 assertXPath(pDocument
, "//textsimpleportion[@text='one']"_ostr
, "width"_ostr
, "16");
1734 assertXPath(pDocument
, "//textsimpleportion[@text='one']"_ostr
, "height"_ostr
, "16");
1735 assertXPath(pDocument
, "//textsimpleportion[@text='one']"_ostr
, "x"_ostr
, "10");
1736 assertXPath(pDocument
, "//textsimpleportion[@text='one']"_ostr
, "y"_ostr
, "50");
1737 assertXPath(pDocument
, "//textsimpleportion[@text='one']"_ostr
, "fontcolor"_ostr
, "#808080");
1739 assertXPath(pDocument
, "//textsimpleportion[@text='two']"_ostr
, "width"_ostr
, "16");
1740 assertXPath(pDocument
, "//textsimpleportion[@text='two']"_ostr
, "height"_ostr
, "16");
1742 // Without the fix in place, this test would have failed with
1745 assertXPath(pDocument
, "//textsimpleportion[@text='two']"_ostr
, "x"_ostr
, "60");
1746 assertXPath(pDocument
, "//textsimpleportion[@text='two']"_ostr
, "y"_ostr
, "100");
1747 assertXPath(pDocument
, "//textsimpleportion[@text='two']"_ostr
, "fontcolor"_ostr
, "#000000");
1750 CPPUNIT_TEST_FIXTURE(Test
, testTdf95400
)
1752 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf95400.svg");
1753 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1755 drawinglayer::Primitive2dXmlDump dumper
;
1756 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1758 CPPUNIT_ASSERT (pDocument
);
1760 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "width"_ostr
, "16");
1761 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "16");
1762 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "x"_ostr
, "30");
1763 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "y"_ostr
, "20");
1764 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "ABC");
1765 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "dx0"_ostr
, "36");
1766 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "dx1"_ostr
, "69");
1767 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "dx2"_ostr
, "102");
1769 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "width"_ostr
, "48");
1770 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "height"_ostr
, "16");
1771 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "x"_ostr
, "30");
1772 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "y"_ostr
, "30");
1773 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "ABC");
1774 assertXPathNoAttribute(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "dx0"_ostr
);
1777 CPPUNIT_TEST_FIXTURE(Test
, testTextAnchor
)
1779 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf151103.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]"_ostr
, "x"_ostr
, "60");
1788 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "y"_ostr
, "40");
1789 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "ABC");
1791 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "x"_ostr
, "43");
1792 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "y"_ostr
, "50");
1793 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "ABC");
1795 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "x"_ostr
, "26");
1796 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "y"_ostr
, "60");
1797 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[3]"_ostr
, "text"_ostr
, "ABC");
1799 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "x"_ostr
, "60");
1800 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "y"_ostr
, "40");
1801 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[4]"_ostr
, "text"_ostr
, "ABC");
1803 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "x"_ostr
, "43");
1804 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "y"_ostr
, "50");
1805 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[5]"_ostr
, "text"_ostr
, "ABC");
1807 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "x"_ostr
, "26");
1808 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "y"_ostr
, "60");
1809 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[6]"_ostr
, "text"_ostr
, "ABC");
1811 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "x"_ostr
, "60");
1812 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "y"_ostr
, "40");
1813 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[7]"_ostr
, "text"_ostr
, "ABC");
1815 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "x"_ostr
, "43");
1816 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "y"_ostr
, "50");
1817 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[8]"_ostr
, "text"_ostr
, "ABC");
1819 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "x"_ostr
, "26");
1820 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "y"_ostr
, "60");
1821 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[9]"_ostr
, "text"_ostr
, "ABC");
1823 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]"_ostr
, "x"_ostr
, "60");
1824 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]"_ostr
, "y"_ostr
, "40");
1825 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[10]"_ostr
, "text"_ostr
, "A");
1827 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[11]"_ostr
, "x"_ostr
, "72");
1828 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[11]"_ostr
, "y"_ostr
, "40");
1829 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[11]"_ostr
, "text"_ostr
, "B");
1831 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[12]"_ostr
, "x"_ostr
, "83");
1832 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[12]"_ostr
, "y"_ostr
, "40");
1833 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[12]"_ostr
, "text"_ostr
, "C");
1835 // Without the fix in place, this test would have failed with
1838 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[13]"_ostr
, "x"_ostr
, "43");
1839 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[13]"_ostr
, "y"_ostr
, "50");
1840 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[13]"_ostr
, "text"_ostr
, "A");
1842 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[14]"_ostr
, "x"_ostr
, "55");
1843 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[14]"_ostr
, "y"_ostr
, "50");
1844 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[14]"_ostr
, "text"_ostr
, "B");
1846 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[15]"_ostr
, "x"_ostr
, "66");
1847 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[15]"_ostr
, "y"_ostr
, "50");
1848 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[15]"_ostr
, "text"_ostr
, "C");
1850 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[16]"_ostr
, "x"_ostr
, "26");
1851 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[16]"_ostr
, "y"_ostr
, "60");
1852 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[16]"_ostr
, "text"_ostr
, "A");
1854 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[17]"_ostr
, "x"_ostr
, "38");
1855 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[17]"_ostr
, "y"_ostr
, "60");
1856 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[17]"_ostr
, "text"_ostr
, "B");
1858 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[18]"_ostr
, "x"_ostr
, "49");
1859 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[18]"_ostr
, "y"_ostr
, "60");
1860 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[18]"_ostr
, "text"_ostr
, "C");
1863 CPPUNIT_TEST_FIXTURE(Test
, testTdf156577
)
1865 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156577.svg");
1866 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1868 drawinglayer::Primitive2dXmlDump dumper
;
1869 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1871 CPPUNIT_ASSERT (pDocument
);
1873 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "width"_ostr
, "16");
1874 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "16");
1875 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "x"_ostr
, "30");
1876 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "y"_ostr
, "20");
1877 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "ABC");
1878 assertXPathNoAttribute(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "dx0"_ostr
);
1880 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "width"_ostr
, "16");
1881 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "height"_ostr
, "16");
1882 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "x"_ostr
, "30");
1883 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "y"_ostr
, "30");
1884 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "ABC");
1886 // Without the fix in place, this test would have failed with
1889 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "dx0"_ostr
, "22");
1890 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "dx1"_ostr
, "53");
1891 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "dx2"_ostr
, "94");
1894 CPPUNIT_TEST_FIXTURE(Test
, testTdf156283
)
1896 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156283.svg");
1897 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1899 drawinglayer::Primitive2dXmlDump dumper
;
1900 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1902 CPPUNIT_ASSERT (pDocument
);
1904 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "width"_ostr
, "16");
1905 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "16");
1906 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "x"_ostr
, "30");
1907 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "y"_ostr
, "20");
1908 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "ABC");
1909 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "dx0"_ostr
, "41");
1910 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "dx1"_ostr
, "52");
1911 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "dx2"_ostr
, "63");
1913 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "width"_ostr
, "16");
1914 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "height"_ostr
, "16");
1915 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "x"_ostr
, "30");
1916 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "y"_ostr
, "30");
1917 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "ABC");
1919 // Without the fix in place, this test would have failed with
1922 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "dx0"_ostr
, "41");
1923 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "dx1"_ostr
, "52");
1924 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "dx2"_ostr
, "63");
1927 CPPUNIT_TEST_FIXTURE(Test
, testTdf156569
)
1929 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156569.svg");
1930 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1932 drawinglayer::Primitive2dXmlDump dumper
;
1933 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1935 CPPUNIT_ASSERT (pDocument
);
1937 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "width"_ostr
, "16");
1938 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "16");
1939 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "x"_ostr
, "0");
1940 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "y"_ostr
, "20");
1941 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "ABC");
1942 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "dx0"_ostr
, "40");
1943 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "dx1"_ostr
, "80");
1944 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "dx2"_ostr
, "91");
1946 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "width"_ostr
, "16");
1947 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "height"_ostr
, "16");
1948 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "x"_ostr
, "0");
1949 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "y"_ostr
, "30");
1950 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, "ABC");
1951 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "dx0"_ostr
, "40");
1953 // Without the fix in place, this test would have failed with
1956 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "dx1"_ostr
, "80");
1957 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "dx2"_ostr
, "91");
1960 CPPUNIT_TEST_FIXTURE(Test
, testTdf156837
)
1962 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156837.svg");
1963 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1965 drawinglayer::Primitive2dXmlDump dumper
;
1966 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1968 CPPUNIT_ASSERT (pDocument
);
1970 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion"_ostr
, 2);
1971 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "x"_ostr
, "114");
1972 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "y"_ostr
, "103");
1973 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "height"_ostr
, "16");
1974 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "x");
1975 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "x"_ostr
, "122");
1977 // Without the fix in place, this test would have failed with
1980 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "y"_ostr
, "94");
1981 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "height"_ostr
, "10");
1982 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[2]"_ostr
, "text"_ostr
, " 3");
1985 CPPUNIT_TEST_FIXTURE(Test
, testTdf156271
)
1987 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf156271.svg");
1988 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1990 drawinglayer::Primitive2dXmlDump dumper
;
1991 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1993 CPPUNIT_ASSERT (pDocument
);
1995 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr
, "width"_ostr
, "16");
1996 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr
, "height"_ostr
, "16");
1997 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr
, "x"_ostr
, "40");
1998 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr
, "y"_ostr
, "10");
1999 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr
, "text"_ostr
, "AB");
2000 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr
, "dx0"_ostr
, "-30");
2001 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[1]"_ostr
, "dx1"_ostr
, "-19");
2003 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr
, "width"_ostr
, "16");
2004 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr
, "height"_ostr
, "16");
2005 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr
, "x"_ostr
, "40");
2006 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr
, "y"_ostr
, "20");
2007 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr
, "text"_ostr
, "AB");
2009 // Without the fix in place, this test would have failed with
2012 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr
, "dx0"_ostr
, "-30");
2013 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[2]"_ostr
, "dx1"_ostr
, "-19");
2015 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr
, "width"_ostr
, "16");
2016 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr
, "height"_ostr
, "16");
2017 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr
, "x"_ostr
, "40");
2018 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr
, "y"_ostr
, "30");
2019 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr
, "text"_ostr
, "AB");
2020 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr
, "dx0"_ostr
, "-30");
2021 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[3]"_ostr
, "dx1"_ostr
, "-19");
2023 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr
, "width"_ostr
, "16");
2024 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr
, "height"_ostr
, "16");
2025 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr
, "x"_ostr
, "40");
2026 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr
, "y"_ostr
, "40");
2027 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr
, "text"_ostr
, "AB");
2028 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr
, "dx0"_ostr
, "12");
2029 assertXPath(pDocument
, "/primitive2D/transform/mask/textsimpleportion[4]"_ostr
, "dx1"_ostr
, "23");
2032 CPPUNIT_TEST_FIXTURE(Test
, testTdf159968
)
2034 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf159968.svg");
2035 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
2037 drawinglayer::Primitive2dXmlDump dumper
;
2038 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
2040 CPPUNIT_ASSERT (pDocument
);
2042 // Check no mask is applied to the marker
2043 assertXPath(pDocument
,
2044 "/primitive2D/transform/transform/transform/transform/polypolygoncolor"_ostr
, "color"_ostr
, "#000000");
2045 assertXPath(pDocument
,
2046 "/primitive2D/transform/transform/transform/transform/polypolygoncolor/polypolygon/polygon/point"_ostr
, 5);
2049 CPPUNIT_TEST_FIXTURE(Test
, testTdf149880
)
2051 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/tdf149880.svg");
2052 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
2054 drawinglayer::Primitive2dXmlDump dumper
;
2055 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
2057 CPPUNIT_ASSERT (pDocument
);
2059 // Without the fix in place, this test would have failed with
2062 // - In <>, XPath '/primitive2D/transform/mask/unhandled' number of nodes is incorrect
2063 assertXPath(pDocument
,
2064 "/primitive2D/transform/mask/unhandled"_ostr
, "id"_ostr
, "PATTERNFILL");
2065 assertXPath(pDocument
,
2066 "/primitive2D/transform/mask/unhandled/mask/transform/transform/bitmap"_ostr
, 28);
2069 CPPUNIT_TEST_FIXTURE(Test
, testCssClassRedefinition
)
2071 // Tests for svg css class redefinition behavior
2073 // .c1 {fill:#00ff00}
2074 // .c1 {font-family:Sans}
2075 // .c1 {fill:#ff0000}
2076 // Expected result is .c1 {font-family:Sans; fill:#ff0000} because
2077 // the second redefinition appends attributes to the class and the
2078 // third redefinition replaces the already existing
2079 // attribute in the original definition
2080 Primitive2DSequence aSequence
= parseSvg(u
"/svgio/qa/cppunit/data/CssClassRedefinition.svg");
2081 drawinglayer::Primitive2dXmlDump dumper
;
2082 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
2083 CPPUNIT_ASSERT (pDocument
);
2084 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "text"_ostr
, "012");
2085 assertXPath(pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "fontcolor"_ostr
, "#ff0000");
2087 pDocument
, "/primitive2D/transform/textsimpleportion[1]"_ostr
, "familyname"_ostr
, "Open Symbol");
2090 CPPUNIT_TEST_FIXTURE(Test
, testTspanFillOpacity
)
2092 // Given an SVG file with <tspan fill-opacity="0.30">:
2093 std::u16string_view aPath
= u
"/svgio/qa/cppunit/data/tspan-fill-opacity.svg";
2095 // When rendering that SVG:
2096 Primitive2DSequence aSequence
= parseSvg(aPath
);
2098 // Then make sure that the text portion is wrapped in a transparency primitive with the correct
2099 // transparency value:
2100 drawinglayer::Primitive2dXmlDump aDumper
;
2101 xmlDocUniquePtr pDocument
= aDumper
.dumpAndParse(Primitive2DContainer(aSequence
));
2102 sal_Int32 nTransparence
= getXPath(pDocument
, "//textsimpleportion[@text='hello']/parent::unifiedtransparence"_ostr
, "transparence"_ostr
).toInt32();
2103 // Without the accompanying fix in place, this test would have failed with:
2106 // - XPath '//textsimpleportion[@text='hello']/parent::unifiedtransparence' number of nodes is incorrect
2107 // i.e. the relevant <textsimpleportion> had no <unifiedtransparence> parent, the text was not
2108 // semi-transparent.
2109 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32
>(70), nTransparence
);
2112 CPPUNIT_PLUGIN_IMPLEMENT();
2114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */