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 <config_fonts.h>
13 #include <test/unoapixml_test.hxx>
15 #include <com/sun/star/frame/Desktop.hpp>
16 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
17 #include <com/sun/star/beans/XPropertySet.hpp>
18 #include <com/sun/star/graphic/XGraphic.hpp>
20 #include <comphelper/seqstream.hxx>
22 #include <com/sun/star/graphic/EmfTools.hpp>
24 #include <drawinglayer/primitive2d/Primitive2DContainer.hxx>
25 #include <drawinglayer/tools/primitive2dxmldump.hxx>
26 #include <vcl/filter/PDFiumLibrary.hxx>
29 #include <string_view>
32 using namespace css::uno
;
33 using namespace css::io
;
34 using namespace css::graphic
;
35 using drawinglayer::primitive2d::Primitive2DSequence
;
36 using drawinglayer::primitive2d::Primitive2DContainer
;
38 class Test
: public UnoApiXmlTest
42 : UnoApiXmlTest("/emfio/qa/cppunit/emf/data/")
46 const OString aXPathPrefix
= "/primitive2D/metafile/transform/"_ostr
;
48 Primitive2DSequence
parseEmf(std::u16string_view aSource
);
51 Primitive2DSequence
Test::parseEmf(std::u16string_view aSource
)
53 const Reference
<XEmfParser
> xEmfParser
= EmfTools::create(m_xContext
);
55 OUString aUrl
= m_directories
.getURLFromSrc(aSource
);
56 OUString aPath
= m_directories
.getPathFromSrc(aSource
);
58 SvFileStream
aFileStream(aUrl
, StreamMode::READ
);
59 std::size_t nSize
= aFileStream
.remainingSize();
60 CPPUNIT_ASSERT_MESSAGE("Unable to open file", nSize
);
61 std::unique_ptr
<sal_Int8
[]> pBuffer(new sal_Int8
[nSize
+ 1]);
62 aFileStream
.ReadBytes(pBuffer
.get(), nSize
);
65 Sequence
<sal_Int8
> aData(pBuffer
.get(), nSize
+ 1);
66 Reference
<XInputStream
> aInputStream(new comphelper::SequenceInputStream(aData
));
67 css::uno::Sequence
<css::beans::PropertyValue
> aEmptyValues
;
69 return xEmfParser
->getDecomposition(aInputStream
, aPath
, aEmptyValues
);
72 CPPUNIT_TEST_FIXTURE(Test
, testPolyPolygon
)
74 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/fdo79679-2.emf");
75 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
76 drawinglayer::Primitive2dXmlDump dumper
;
77 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
79 CPPUNIT_ASSERT(pDocument
);
82 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygon", "path"_ostr
,
83 "m0 0h19746v14817h-19746z");
84 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor", 2);
85 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]", "color"_ostr
, "#ffffff");
86 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]/polypolygon", "path"_ostr
,
87 "m0 0h19781v14852h-19781z");
88 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[2]/polypolygon", "path"_ostr
,
89 "m2574 13194v-12065h15303v12065z");
91 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke", 44);
92 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonstroke[1]/polygon",
93 "2574,13194 2574,1129");
94 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[1]/line", "color"_ostr
, "#000000");
95 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[1]/line", "width"_ostr
, "0");
96 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonstroke[2]/polygon",
97 "2574,1129 2574,1129");
98 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[2]/line", "color"_ostr
, "#000000");
99 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[2]/line", "width"_ostr
, "0");
100 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonstroke[10]/polygon",
101 "8674,1129 8674,1129");
102 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[10]/line", "color"_ostr
, "#000000");
103 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[10]/line", "width"_ostr
, "0");
105 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion", 28);
106 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[6]", "width"_ostr
, "459");
107 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[6]", "x"_ostr
, "9908");
108 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[6]", "text"_ostr
, "0.5");
109 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[6]", "fontcolor"_ostr
, "#000000");
110 assertXPath(pDocument
, aXPathPrefix
+ "mask/pointarray", 98);
111 assertXPath(pDocument
, aXPathPrefix
+ "mask/pointarray[1]", "color"_ostr
, "#000000");
112 assertXPath(pDocument
, aXPathPrefix
+ "mask/pointarray[1]/point", "x"_ostr
, "2574");
113 assertXPath(pDocument
, aXPathPrefix
+ "mask/pointarray[1]/point", "y"_ostr
, "1129");
116 CPPUNIT_TEST_FIXTURE(Test
, testDrawImagePointsTypeBitmap
)
118 // tdf#142941 EMF+ file with ObjectTypeImage, FillRects, DrawImagePoints ,records
119 // The test is checking the position of displaying bitmap with too large SrcRect
121 Primitive2DSequence aSequence
122 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestDrawImagePointsTypeBitmap.emf");
123 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
124 drawinglayer::Primitive2dXmlDump dumper
;
125 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
126 CPPUNIT_ASSERT(pDocument
);
128 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", "color"_ostr
, "#0080ff");
129 assertXPath(pDocument
, aXPathPrefix
+ "bitmap", "xy11"_ostr
, "5346");
130 assertXPath(pDocument
, aXPathPrefix
+ "bitmap", "xy12"_ostr
, "0");
131 assertXPath(pDocument
, aXPathPrefix
+ "bitmap", "xy13"_ostr
, "5558");
132 assertXPath(pDocument
, aXPathPrefix
+ "bitmap", "xy21"_ostr
, "0");
133 assertXPath(pDocument
, aXPathPrefix
+ "bitmap", "xy22"_ostr
, "4716");
134 assertXPath(pDocument
, aXPathPrefix
+ "bitmap", "xy23"_ostr
, "5564");
136 pDocument
, aXPathPrefix
+ "bitmap/data[2]", "row"_ostr
,
137 "020202,ffffff,ffffff,ffffff,fefefe,ffffff,ffffff,fefefe,ffffff,ffffff,f8f8f8,ffffff,"
138 "fdfdfd,ffffff,ffffff,fdfdfd,ffffff,ffffff,ffffff,fbfbfb,010101,ffffff,fefefe,ffffff,"
139 "ffffff,fbfbfb,ffffff,fdfdfd,fcfcfc,fdfdfd,ffffff,ffffff,ffffff,ffffff,ffffff,ffffff,"
140 "ffffff,ffffff,ffffff,ffffff,020202,fdfdfd,ffffff,ffffff,fefefe,ffffff,ffffff,ffffff,"
141 "ffffff,fbfbfb,fefefe,ffffff,fcfcfc,ffffff,fdfdfd,ffffff,ffffff,ffffff,ffffff,fbfbfb,"
142 "010101,ffffff,fefefe,ffffff,ffffff,ffffff,fcfcfc,ffffff,fafafa,ffffff,ffffff,fefefe,"
143 "ffffff,fdfdfd,fefefe,fefefe,ffffff,ffffff,fdfdfd,fffbfb,1e0000,8f4347,b13a3e,b82d32,"
144 "bb3438,b73237,b63338,b33035,b63338");
147 CPPUNIT_TEST_FIXTURE(Test
, testDrawString
)
150 // EMF+ file with only one DrawString Record
151 // Since the text is undecorated the optimal choice is a simpletextportion primitive
153 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestDrawString.emf");
154 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
155 drawinglayer::Primitive2dXmlDump dumper
;
156 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
157 CPPUNIT_ASSERT(pDocument
);
159 // check correct import of the DrawString: height, position, text, color and font
160 assertXPath(pDocument
, aXPathPrefix
+ "transform/textsimpleportion", "height"_ostr
, "120");
161 assertXPath(pDocument
, aXPathPrefix
+ "transform/textsimpleportion", "x"_ostr
, "817");
162 assertXPath(pDocument
, aXPathPrefix
+ "transform/textsimpleportion", "y"_ostr
, "1137");
163 assertXPath(pDocument
, aXPathPrefix
+ "transform/textsimpleportion", "text"_ostr
, "TEST");
164 assertXPath(pDocument
, aXPathPrefix
+ "transform/textsimpleportion", "fontcolor"_ostr
,
166 assertXPath(pDocument
, aXPathPrefix
+ "transform/textsimpleportion", "familyname"_ostr
,
171 CPPUNIT_TEST_FIXTURE(Test
, testDrawStringAlign
)
174 // EMF+ DrawString with alignment (StringAlignmentNear, StringAlignmentFar, StringAlignmentCenter)
175 // It seems Arial font is replaced with Liberation Sans. These numbers are valid for Liberation Sans.
176 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestDrawStringAlign.emf");
177 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
178 drawinglayer::Primitive2dXmlDump dumper
;
179 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
180 CPPUNIT_ASSERT(pDocument
);
182 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform", 9);
183 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[1]/textsimpleportion", "width"_ostr
,
185 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[1]/textsimpleportion", "height"_ostr
,
187 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[1]/textsimpleportion", "x"_ostr
, "12");
188 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[1]/textsimpleportion", "y"_ostr
, "22");
189 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[1]/textsimpleportion", "text"_ostr
,
191 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[1]/textsimpleportion", "fontcolor"_ostr
,
193 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[1]/textsimpleportion", "familyname"_ostr
,
196 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[2]/textsimpleportion", "width"_ostr
,
198 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[2]/textsimpleportion", "height"_ostr
,
200 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[2]/textsimpleportion", "x"_ostr
, "143");
201 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[2]/textsimpleportion", "y"_ostr
, "22");
202 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[2]/textsimpleportion", "text"_ostr
,
205 // TODO Make the position of the text the same across the platforms (Arial vs Liberation Sans).
206 // This is usually 276, but can be 275 as well; depends on what fonts are installed?
208 = getXPath(pDocument
, aXPathPrefix
+ "mask/transform[3]/textsimpleportion", "x"_ostr
)
210 CPPUNIT_ASSERT(nX
>= 275);
211 CPPUNIT_ASSERT(nX
<= 276);
212 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[3]/textsimpleportion", "y"_ostr
, "22");
213 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[3]/textsimpleportion", "text"_ostr
,
216 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[4]/textsimpleportion", "x"_ostr
, "12");
217 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[4]/textsimpleportion", "y"_ostr
, "66");
218 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[4]/textsimpleportion", "text"_ostr
,
221 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[5]/textsimpleportion", "x"_ostr
, "142");
222 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[5]/textsimpleportion", "y"_ostr
, "66");
223 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[5]/textsimpleportion", "text"_ostr
,
226 // This is usually 274, but can be 273 as well; depends on what fonts are installed?
227 nX
= getXPath(pDocument
, aXPathPrefix
+ "mask/transform[6]/textsimpleportion", "x"_ostr
)
229 CPPUNIT_ASSERT(nX
>= 273);
230 CPPUNIT_ASSERT(nX
<= 274);
231 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[6]/textsimpleportion", "y"_ostr
, "66");
232 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[6]/textsimpleportion", "text"_ostr
,
235 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[7]/textsimpleportion", "x"_ostr
, "12");
236 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[7]/textsimpleportion", "y"_ostr
, "110");
237 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[7]/textsimpleportion", "text"_ostr
,
240 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[8]/textsimpleportion", "x"_ostr
, "143");
241 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[8]/textsimpleportion", "y"_ostr
, "110");
242 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[8]/textsimpleportion", "text"_ostr
,
245 // This is usually 275, but can be 274 as well; depends on what fonts are installed?
246 nX
= getXPath(pDocument
, aXPathPrefix
+ "mask/transform[9]/textsimpleportion", "x"_ostr
)
248 CPPUNIT_ASSERT(nX
>= 274);
249 CPPUNIT_ASSERT(nX
<= 275);
250 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[9]/textsimpleportion", "y"_ostr
, "110");
251 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform[9]/textsimpleportion", "text"_ostr
,
256 CPPUNIT_TEST_FIXTURE(Test
, testDrawStringTransparent
)
259 // EMF+ file with one DrawString Record with transparency
261 Primitive2DSequence aSequence
262 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestDrawStringTransparent.emf");
263 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
264 drawinglayer::Primitive2dXmlDump dumper
;
265 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
266 CPPUNIT_ASSERT(pDocument
);
268 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform/unifiedtransparence", "transparence"_ostr
,
270 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform/unifiedtransparence/textsimpleportion",
271 "height"_ostr
, "24");
272 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform/unifiedtransparence/textsimpleportion",
274 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform/unifiedtransparence/textsimpleportion",
276 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform/unifiedtransparence/textsimpleportion",
277 "text"_ostr
, "Transparent Text");
278 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform/unifiedtransparence/textsimpleportion",
279 "fontcolor"_ostr
, "#0000ff");
280 assertXPath(pDocument
, aXPathPrefix
+ "mask/transform/unifiedtransparence/textsimpleportion",
281 "familyname"_ostr
, "ARIAL");
285 CPPUNIT_TEST_FIXTURE(Test
, testDrawStringWithBrush
)
287 // tdf#142975 EMF+ with records: DrawString, Brush and Font
288 Primitive2DSequence aSequence
289 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestDrawStringWithBrush.emf");
290 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
291 drawinglayer::Primitive2dXmlDump dumper
;
292 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
293 CPPUNIT_ASSERT(pDocument
);
294 assertXPath(pDocument
, aXPathPrefix
+ "transform/textdecoratedportion", "xy11"_ostr
, "20");
295 assertXPath(pDocument
, aXPathPrefix
+ "transform/textdecoratedportion", "xy13"_ostr
, "16");
296 assertXPath(pDocument
, aXPathPrefix
+ "transform/textdecoratedportion", "xy22"_ostr
, "20");
297 assertXPath(pDocument
, aXPathPrefix
+ "transform/textdecoratedportion", "xy33"_ostr
, "1");
298 assertXPath(pDocument
, aXPathPrefix
+ "transform/textdecoratedportion", "text"_ostr
,
300 assertXPath(pDocument
, aXPathPrefix
+ "transform/textdecoratedportion", "fontcolor"_ostr
,
302 assertXPath(pDocument
, aXPathPrefix
+ "transform/textdecoratedportion", "familyname"_ostr
,
306 CPPUNIT_TEST_FIXTURE(Test
, testEmfPlusDrawBeziers
)
308 // tdf#107019 tdf#154789 EMF+ records: DrawBeziers
309 // Check if DrawBeziers is displayed correctly and text is rotated
310 Primitive2DSequence aSequence
311 = parseEmf(u
"emfio/qa/cppunit/emf/data/TestEmfPlusDrawBeziers.emf");
312 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
313 drawinglayer::Primitive2dXmlDump dumper
;
314 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
315 CPPUNIT_ASSERT(pDocument
);
317 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", 4);
318 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]", "color"_ostr
, "#000000");
320 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow", 9);
321 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[9]/line", "color"_ostr
, "#00ff00");
323 assertXPath(pDocument
, aXPathPrefix
+ "transform", 5);
324 assertXPath(pDocument
, aXPathPrefix
+ "transform[1]/textsimpleportion", "fontcolor"_ostr
,
326 assertXPath(pDocument
, aXPathPrefix
+ "transform[1]/textsimpleportion", "text"_ostr
,
328 assertXPath(pDocument
, aXPathPrefix
+ "transform[1]", "xy11"_ostr
, "0");
329 assertXPath(pDocument
, aXPathPrefix
+ "transform[1]", "xy12"_ostr
, "4");
330 assertXPath(pDocument
, aXPathPrefix
+ "transform[1]", "xy13"_ostr
, "800");
331 assertXPath(pDocument
, aXPathPrefix
+ "transform[1]", "xy21"_ostr
, "-4");
332 assertXPath(pDocument
, aXPathPrefix
+ "transform[1]", "xy22"_ostr
, "0");
333 assertXPath(pDocument
, aXPathPrefix
+ "transform[1]", "xy23"_ostr
, "3195");
336 CPPUNIT_TEST_FIXTURE(Test
, testDrawLine
)
338 // EMF+ with records: DrawLine
339 // The line is colored and has a specified width, therefore a polypolygonstroke primitive is the optimal choice
340 Primitive2DSequence aSequence
= parseEmf(u
"emfio/qa/cppunit/emf/data/TestDrawLine.emf");
341 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
342 drawinglayer::Primitive2dXmlDump dumper
;
343 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
344 CPPUNIT_ASSERT(pDocument
);
346 // check correct import of the DrawLine: color and width of the line
347 assertXPath(pDocument
, aXPathPrefix
+ "mask/unifiedtransparence", "transparence"_ostr
, "14");
348 assertXPath(pDocument
, aXPathPrefix
+ "mask/unifiedtransparence/polypolygonstroke/line",
349 "color"_ostr
, "#c01002");
350 assertXPath(pDocument
, aXPathPrefix
+ "mask/unifiedtransparence/polypolygonstroke/line",
351 "width"_ostr
, "115");
352 assertXPath(pDocument
, aXPathPrefix
+ "mask/unifiedtransparence/polypolygonstroke/line",
353 "linecap"_ostr
, "BUTT");
354 assertXPath(pDocument
, aXPathPrefix
+ "mask/unifiedtransparence/polypolygonstroke/polypolygon",
356 "m55.5192348773662 403.573503917507 874.352660545936-345.821325648415");
359 CPPUNIT_TEST_FIXTURE(Test
, testDrawLineWithCaps
)
361 // EMF+ with records: DrawLine
362 // Test lines with different caps styles and arrows
363 Primitive2DSequence aSequence
364 = parseEmf(u
"emfio/qa/cppunit/emf/data/TestEmfPlusDrawLineWithCaps.emf");
365 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
366 drawinglayer::Primitive2dXmlDump dumper
;
367 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
368 CPPUNIT_ASSERT(pDocument
);
369 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow", 3);
371 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[1]/line", "width"_ostr
, "211");
372 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[1]/stroke", 0);
373 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[1]/linestartattribute/polypolygon",
374 "path"_ostr
, "m0-1 1 2h-2z");
375 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[1]/lineendattribute", 0);
377 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[2]/line", "width"_ostr
, "211");
378 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[2]/stroke", 0);
379 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[2]/linestartattribute/polypolygon",
380 "path"_ostr
, "m0-1 1 2h-2z");
381 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[2]/lineendattribute", 0);
383 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[3]/line", "width"_ostr
, "423");
384 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[3]/stroke", 0);
385 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[3]/linestartattribute", 0);
386 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow[3]/lineendattribute/polypolygon",
387 "path"_ostr
, "m-1-1h2v2h-2z");
389 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence", 3);
390 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence[1]", "transparence"_ostr
, "39");
391 assertXPath(pDocument
,
393 + "unifiedtransparence[1]/polygonstrokearrow/linestartattribute/polypolygon",
395 "m-1 1h2v-1l-0.0764-0.3827-0.2165-0.3244-0.3244-0.2165-0.3827-0.0764-0.3827 "
396 "0.0764-0.3244 0.2165-0.2165 0.3244-0.0764 0.3827z");
397 assertXPath(pDocument
,
399 + "unifiedtransparence[1]/polygonstrokearrow/lineendattribute/polypolygon",
400 "path"_ostr
, "m-1 1h2v-1l-1-1-1 1z");
401 assertXPath(pDocument
,
402 aXPathPrefix
+ "unifiedtransparence[2]/polygonstrokearrow/linestartattribute", 0);
403 assertXPath(pDocument
,
405 + "unifiedtransparence[2]/polygonstrokearrow/lineendattribute/polypolygon",
406 "path"_ostr
, "m-1-1h2v2h-2z");
407 assertXPath(pDocument
,
409 + "unifiedtransparence[3]/polygonstrokearrow/lineendattribute/polypolygon",
410 "path"_ostr
, "m0-1 1 1-0.5 0.5v0.5h-1v-0.5l-0.5-0.5z");
413 CPPUNIT_TEST_FIXTURE(Test
, testDrawLineWithDash
)
415 // EMF+ with records: DrawLine, ScaleWorldTransform, RotateWorldTransform
416 // Test lines with different dash styles, different line arrows and different World Rotation
417 Primitive2DSequence aSequence
418 = parseEmf(u
"emfio/qa/cppunit/emf/data/TestEmfPlusDrawLineWithDash.emf");
419 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
420 drawinglayer::Primitive2dXmlDump dumper
;
421 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
422 CPPUNIT_ASSERT(pDocument
);
424 // check correct import of the DrawLine: color and width of the line
425 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke", 10);
426 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[1]/line", "color"_ostr
,
428 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[1]/line", "width"_ostr
, "185");
429 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[1]/stroke", 0);
431 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[2]/line", "width"_ostr
, "185");
432 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[2]/stroke", "dotDashArray"_ostr
,
434 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[3]/line", "width"_ostr
, "185");
435 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[3]/stroke", "dotDashArray"_ostr
,
437 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[4]/line", "width"_ostr
, "185");
438 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[4]/stroke", "dotDashArray"_ostr
,
440 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[5]/line", "width"_ostr
, "370");
441 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[5]/stroke", "dotDashArray"_ostr
,
442 "556 185 185 185 185 185 ");
444 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstrokearrow", 2);
445 //TODO polypolygonstroke[6-9]/stroke add support for PenDataDashedLineOffset
446 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstrokearrow[1]/line", "width"_ostr
, "370");
447 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstrokearrow[1]/stroke", "dotDashArray"_ostr
,
448 "1851 741 5554 1481 ");
449 // Arrows on both ends
450 assertXPath(pDocument
,
451 aXPathPrefix
+ "mask/polygonstrokearrow[1]/linestartattribute/polypolygon",
452 "path"_ostr
, "m0-1 1 2h-2z");
453 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstrokearrow[1]/lineendattribute/polypolygon",
454 "path"_ostr
, "m0-1 1 2h-2z");
456 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstrokearrow[2]/line", "width"_ostr
, "370");
457 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstrokearrow[2]/stroke", "dotDashArray"_ostr
,
458 "1852 741 5555 1481 ");
459 assertXPath(pDocument
,
460 aXPathPrefix
+ "mask/polygonstrokearrow[2]/linestartattribute/polypolygon",
462 "m-1 1h2v-1l-0.0764-0.3827-0.2165-0.3244-0.3244-0.2165-0.3827-0.0764-0.3827 "
463 "0.0764-0.3244 0.2165-0.2165 0.3244-0.0764 0.3827z");
464 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstrokearrow[2]/lineendattribute/polypolygon",
466 "m-1 1h2v-1l-0.0764-0.3827-0.2165-0.3244-0.3244-0.2165-0.3827-0.0764-0.3827 "
467 "0.0764-0.3244 0.2165-0.2165 0.3244-0.0764 0.3827z");
470 CPPUNIT_TEST_FIXTURE(Test
, testLinearGradient
)
472 // EMF+ file with LinearGradient brush
473 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestLinearGradient.emf");
474 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
475 drawinglayer::Primitive2dXmlDump dumper
;
476 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
477 CPPUNIT_ASSERT(pDocument
);
479 assertXPath(pDocument
, "/primitive2D/metafile/transform"_ostr
, "xy11"_ostr
, "1");
480 assertXPath(pDocument
, "/primitive2D/metafile/transform"_ostr
, "xy12"_ostr
, "0");
481 assertXPath(pDocument
, "/primitive2D/metafile/transform"_ostr
, "xy13"_ostr
, "0");
482 assertXPath(pDocument
, "/primitive2D/metafile/transform"_ostr
, "xy21"_ostr
, "0");
483 assertXPath(pDocument
, "/primitive2D/metafile/transform"_ostr
, "xy22"_ostr
, "1");
484 assertXPath(pDocument
, "/primitive2D/metafile/transform"_ostr
, "xy23"_ostr
, "0");
485 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygon", "height"_ostr
, "7610");
486 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygon", "width"_ostr
, "15232");
487 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygon", "path"_ostr
,
488 "m0 0h15232v7610h-15232z");
490 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[1]", "spreadmethod"_ostr
,
492 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[1]", "startx"_ostr
, "0");
493 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[1]", "starty"_ostr
, "-1");
494 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[1]", "endx"_ostr
, "0");
495 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[1]", "endy"_ostr
, "-1");
496 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[1]", "opacity"_ostr
,
497 "0.392156862745098");
498 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[1]/polypolygon", "path"_ostr
,
499 "m0 0.216110019646294h7615.75822989746v7610.21611001965h-7615.75822989746z");
501 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[2]", "spreadmethod"_ostr
,
503 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[2]", "startx"_ostr
, "-1");
504 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[2]", "starty"_ostr
, "-1");
505 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[2]", "endx"_ostr
, "0");
506 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[2]", "endy"_ostr
, "-1");
507 assertXPath(pDocument
, aXPathPrefix
+ "mask/svglineargradient[2]", "opacity"_ostr
, "1");
509 pDocument
, aXPathPrefix
+ "mask/svglineargradient[2]/polypolygon", "path"_ostr
,
510 "m7615.75822989746 0.216110019646294h7615.75822989746v7610.21611001965h-7615.75822989746z");
513 CPPUNIT_TEST_FIXTURE(Test
, testTextMapMode
)
515 // EMF with records: SETMAPMODE with MM_TEXT MapMode, POLYLINE16, EXTCREATEPEN, EXTTEXTOUTW
516 // MM_TEXT is mapped to one device pixel. Positive x is to the right; positive y is down.
517 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TextMapMode.emf");
518 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
519 drawinglayer::Primitive2dXmlDump dumper
;
520 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
521 CPPUNIT_ASSERT(pDocument
);
523 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", 2);
524 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]", "color"_ostr
, "#ffffff");
525 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]/polypolygon", "path"_ostr
,
526 "m0 0h3542v4647h-3542z");
528 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion", 20);
529 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion[1]", "text"_ostr
, "N");
530 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion[1]", "fontcolor"_ostr
, "#4a70e3");
531 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion[1]", "x"_ostr
, "2099");
532 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion[1]", "y"_ostr
, "1859");
534 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke", 138);
535 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonstroke[1]/polygon", "2142,1638 2142,1489");
536 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke[1]/line", "color"_ostr
, "#4a70e3");
537 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke[1]/line", "width"_ostr
, "11");
539 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonstroke[10]/polygon", "1967,1029 1869,952");
540 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke[10]/line", "color"_ostr
, "#4a70e3");
541 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke[10]/line", "width"_ostr
, "11");
543 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonstroke[20]/polygon",
544 "2710,1113 2873,1330");
545 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke[20]/line", "color"_ostr
, "#666666");
546 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke[20]/line", "width"_ostr
, "11");
549 CPPUNIT_TEST_FIXTURE(Test
, testEnglishMapMode
)
551 // EMF image with records: SETMAPMODE with MM_ENGLISH MapMode, STROKEANDFILLPATH, EXTTEXTOUTW, SETTEXTALIGN, STRETCHDIBITS
552 // MM_LOENGLISH is mapped to 0.01 inch. Positive x is to the right; positive y is up.M
553 Primitive2DSequence aSequence
554 = parseEmf(u
"/emfio/qa/cppunit/emf/data/test_mm_hienglish_ref.emf");
555 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
556 drawinglayer::Primitive2dXmlDump dumper
;
557 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
558 CPPUNIT_ASSERT(pDocument
);
560 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygon", 1);
561 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygon[1]", "path"_ostr
,
562 "m0 0h29699v20999h-29699z");
564 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor", 3);
565 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]", "color"_ostr
, "#ffffad");
566 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]/polypolygon", "path"_ostr
,
567 "m-1-1h29700v21001h-29700z");
568 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[2]/polypolygon", "path"_ostr
,
569 "m1058 7937v5293h3175v-1059h-2118v-4234z");
570 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[3]/polypolygon", "path"_ostr
,
571 "m12699 1058h4234v1060h-1587v4231h-1059v-4231h-1588z");
573 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion", 4);
574 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[1]", "text"_ostr
, "UL");
575 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[1]", "fontcolor"_ostr
, "#000000");
576 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[1]", "x"_ostr
, "106");
577 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[1]", "y"_ostr
, "459");
578 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[1]", "width"_ostr
, "424");
579 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[1]", "height"_ostr
, "424");
581 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonhairline", 3);
582 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonhairline[1]/polygon",
583 "-1,-1 29699,-1 29699,21000 -1,21000");
584 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonhairline[2]/polygon",
585 "1058,7937 1058,13230 4233,13230 4233,12171 2115,12171 2115,7937");
587 pDocument
, aXPathPrefix
+ "mask/polygonhairline[3]/polygon",
588 "12699,1058 16933,1058 16933,2118 15346,2118 15346,6349 14287,6349 14287,2118 12699,2118");
591 CPPUNIT_TEST_FIXTURE(Test
, testRectangleWithModifyWorldTransform
)
593 // EMF image with records: EXTCREATEPEN, SELECTOBJECT, MODIFYWORLDTRANSFORM, RECTANGLE
595 Primitive2DSequence aSequence
596 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestRectangleWithModifyWorldTransform.emf");
597 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
598 drawinglayer::Primitive2dXmlDump dumper
;
599 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
600 CPPUNIT_ASSERT(pDocument
);
602 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", 1);
603 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]", "color"_ostr
, "#ffffff");
604 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]/polypolygon", "path"_ostr
,
605 "m1042 417 918 529 353 610-918-528z");
607 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke", 1);
608 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonstroke[1]/polygon",
609 "1042,417 1960,946 2313,1556 1395,1028");
612 CPPUNIT_TEST_FIXTURE(Test
, testChordWithModifyWorldTransform
)
614 // EMF import test with records: CHORD, MODIFYWORLDTRANSFORM, EXTCREATEPEN, SELECTOBJECT
615 Primitive2DSequence aSequence
616 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestChordWithModifyWorldTransform.emf");
617 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
618 drawinglayer::Primitive2dXmlDump dumper
;
619 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
620 CPPUNIT_ASSERT(pDocument
);
622 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", "color"_ostr
, "#ffffff");
623 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor/polypolygon", "path"_ostr
,
624 "m590 448-21 45-66 24-34 12-33 12-21 45-33 12 12 33-33 12 12 33 12 34 33-12 12 33 "
625 "34-12 33-12 45 21 33-12 33-12 46 21 66-25 33-12 66-24 34-12 66-24z");
626 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonstroke/polygon",
627 "590,448 569,493 503,517 469,529 436,541 415,586 382,598 394,631 361,643 "
628 "361,643 373,676 373,676 385,710 418,698 430,731 464,719 497,707 542,728 "
629 "575,716 608,704 654,725 720,700 753,688 819,664 853,652 919,628");
632 CPPUNIT_TEST_FIXTURE(Test
, testArcStartPointEqualEndPoint
)
634 // i73608 EMF import test where StartPoint == EndPoint. It should draw full circle
635 // Records: SETMAPMODE, SETWINDOWEXTEX, SETWINDOWORGEX, EXTSELECTCLIPRGN, INTERSECTCLIPRECT, MOVETOEX, ARC
636 Primitive2DSequence aSequence
637 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestArcStartPointEqualEndPoint.emf");
638 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
639 drawinglayer::Primitive2dXmlDump dumper
;
640 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
641 CPPUNIT_ASSERT(pDocument
);
643 assertXPath(pDocument
, aXPathPrefix
+ "mask/group/mask/polygonhairline", "color"_ostr
,
646 pDocument
, aXPathPrefix
+ "mask/group/mask/polygonhairline/polygon",
647 "11886,23133 11970,23223 12051,23316 12131,23410 12208,23506 12282,23604 12354,23704 "
648 "12424,23805 12491,23909 12556,24014 12618,24120 12677,24228 12734,24337 12788,24448 "
649 "12839,24560 12888,24673 12933,24788 12976,24903 13016,25020 13053,25137 13087,25256 "
650 "13119,25375 13147,25495 13172,25615 13195,25736 13214,25858 13230,25980 13244,26103 "
651 "13254,26225 13261,26348 13266,26472 13267,26595 13265,26718 13260,26841 13253,26964 "
652 "13242,27087 13228,27209 13211,27331 13191,27453 13168,27574 13142,27694 13113,27814 "
653 "13082,27933 13047,28051 13009,28169 12969,28285 12926,28400 12879,28514 12830,28628 "
654 "12779,28739 12724,28850 12667,28959 12607,29067 12545,29173 12480,29277 12412,29380 "
655 "12342,29482 12269,29581 12194,29679 12117,29775 12037,29869 11955,29960 11871,30050 "
656 "11784,30138 11696,30224 11605,30307 11512,30388 11418,30467 11321,30543 11223,30617 "
657 "11122,30689 11020,30758 10917,30825 10811,30888 10705,30950 10596,31009 10487,31065 "
658 "10376,31118 10263,31168 10150,31216 10035,31261 9919,31303 9803,31343 9685,31379 "
659 "9566,31412 9447,31443 9327,31471 9206,31495 9085,31517 8963,31535 8841,31551 8719,31564 "
660 "8596,31573 8473,31580 8350,31583 8226,31584 8103,31581 7980,31576 7857,31567 7735,31555 "
661 "7612,31541 7491,31523 7369,31503 7248,31479 7128,31452 7008,31423 6890,31390 6772,31355 "
662 "6655,31316 6538,31275 6423,31231 6310,31184 6197,31135 6085,31082 5975,31027 5866,30969 "
663 "5759,30909 5653,30846 5549,30780 5447,30712 5346,30641 5247,30568 5150,30492 5054,30414 "
664 "4961,30334 4870,30251 4780,30166 4693,30079 4608,29990 4525,29899 4445,29805 4367,29710 "
665 "4291,29613 4217,29514 4146,29414 4078,29311 4012,29207 3949,29101 3888,28994 3830,28885 "
666 "3775,28775 3722,28664 3672,28551 3625,28438 3581,28323 3540,28207 3501,28090 3465,27972 "
667 "3433,27853 3403,27733 3376,27613 3352,27492 3331,27371 3313,27249 3299,27127 3287,27004 "
668 "3278,26881 3272,26758 3269,26635 3270,26512 3273,26388 3279,26265 3289,26143 3301,26020 "
669 "3316,25898 3335,25776 3356,25655 3380,25534 3408,25414 3438,25294 3471,25176 3508,25058 "
670 "3547,24941 3588,24825 3633,24711 3681,24597 3731,24484 3784,24373 3840,24263 3899,24155 "
671 "3960,24048 4023,23943 4090,23839 4159,23737 4230,23636 4304,23538 4380,23441 4459,23346 "
672 "4540,23253 4623,23162 4708,23074 4796,22987 4885,22902 4977,22820 5071,22740 5166,22663 "
673 "5264,22587 5363,22515 5465,22444 5567,22376 5672,22311 5778,22249 5885,22188 5994,22131 "
674 "6105,22076 6216,22024 6329,21975 6443,21929 6559,21885 6675,21845 6792,21807 6910,21772 "
675 "7029,21740 7149,21711 7269,21685 7390,21662 7512,21642 7634,21624 7756,21610 7879,21599 "
676 "8002,21591 8125,21586 8248,21584 8371,21585 8494,21589 8617,21596 8740,21606 8862,21619 "
677 "8985,21636 9106,21655 9227,21677 9348,21702 9468,21730 9587,21761 9705,21795 9823,21832 "
678 "9940,21872 10055,21914 10170,21960 10283,22008 10395,22059 10506,22113 10615,22169 "
679 "10723,22229 10830,22291 10935,22355 11038,22422 11140,22491 11240,22563 11338,22638 "
680 "11434,22715 11529,22794 11621,22875 11711,22959 11800,23045");
683 CPPUNIT_TEST_FIXTURE(Test
, testArcInsideWronglyDefinedRectangle
)
685 // tdf#142268 EMF import test with records: ARC
686 Primitive2DSequence aSequence
687 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestArcInsideWronglyDefinedRectangle.emf");
688 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
689 drawinglayer::Primitive2dXmlDump dumper
;
690 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
691 CPPUNIT_ASSERT(pDocument
);
693 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline", "color"_ostr
, "#000000");
695 pDocument
, aXPathPrefix
+ "polygonhairline/polygon",
696 "1630,1460 1650,1470 1670,1480 1700,1490 1720,1500 1750,1510 1770,1520 1800,1530 1820,1530 "
697 "1850,1540 1870,1540 1900,1540 1930,1540 1950,1540 1980,1540 2000,1530 2030,1530 2050,1520 "
698 "2080,1510 2100,1500 2130,1490 2150,1480 2170,1470 2200,1450 2220,1440 2240,1420 2260,1400 "
699 "2280,1390 2290,1370 2310,1350 2330,1330 2340,1300 2360,1280 2370,1260 2380,1240 2390,1210 "
700 "2400,1190 2410,1160 2420,1140 2420,1110 2420,1080 2430,1060 2430,1030 2430,1000 2430,980 "
701 "2430,950 2420,930 2420,900 2410,870 2410,850 2400,820 2390,800 2380,770 2360,750 2350,730 "
702 "2340,710 2320,680 2300,660 2290,640 2270,630 2250,610 2230,590 2210,580 2190,560 2160,550 "
703 "2140,540 2120,520 2090,510 2070,510 2040,500 2020,490 1990,490 1970,480 1940,480 1920,480 "
704 "1890,480 1860,480 1840,490 1810,490 1790,500 1760,500 1740,510 1710,520 1690,530 1670,540 "
705 "1640,560 1620,570 1600,580 1580,600 1560,620 1540,640 1520,660 1510,680 1490,700 1480,720 "
706 "1460,740 1450,760");
709 CPPUNIT_TEST_FIXTURE(Test
, testEllipseWithSelectClipPath
)
711 // EMF import test with records: RECTANGLE, BEGINPATH, ENDPATH, ELLIPSE
712 Primitive2DSequence aSequence
713 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestEllipseWithSelectClipPath.emf");
714 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
715 drawinglayer::Primitive2dXmlDump dumper
;
716 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
717 CPPUNIT_ASSERT(pDocument
);
719 assertXPath(pDocument
, aXPathPrefix
+ "group/mask/polypolygon", 1);
720 assertXPath(pDocument
, aXPathPrefix
+ "group/mask/polypolygon[1]", "path"_ostr
,
722 "776v-36-35h-36v-35l-35-35-35-36h-36l-35-35-35-35h-35-36l-35-35h-35-36l-35-36h-35-"
723 "36l-35-35h-35-71-35l-36-35h-70-35-36-70l-36-35h-35-71-35-71-35-71-35-35-71-35-71-"
724 "35-71-35l-35 35h-71-35-36-70l-35 35h-36-70-36l-35 35h-35-36l-35 36h-35-36l-35 "
725 "35h-35-36l-35 35-35 35h-35l-36 36-35 35v35h-35v35 36 35 35h35v35l35 36 36 "
726 "35h35l35 35 35 35h36 35l35 36h36 35l35 35h36 35l35 35h36 70 36l35 35h70 36 35 "
727 "71l35 36h35 71 35 71 35 71 35 35 71 35 71 35 71 35l36-36h70 36 35 70l36-35h35 71 "
728 "35l35-35h36 35l35-35h36 35l35-36h36 35l35-35 35-35h36l35-35 35-36v-35h36v-35z");
730 assertXPath(pDocument
, aXPathPrefix
+ "group/mask/polypolygoncolor", 1);
731 assertXPath(pDocument
, aXPathPrefix
+ "group/mask/polypolygoncolor[1]", "color"_ostr
,
733 assertXPath(pDocument
, aXPathPrefix
+ "group/mask/polypolygoncolor[1]/polypolygon[1]",
734 "path"_ostr
, "m353 353h2472v1057h-2472z");
736 assertXPath(pDocument
, aXPathPrefix
+ "group/mask/polygonstroke", 1);
737 assertXPathContent(pDocument
, aXPathPrefix
+ "group/mask/polygonstroke[1]/polygon",
738 "353,353 2825,353 2825,1410 353,1410");
741 CPPUNIT_TEST_FIXTURE(Test
, testEllipseXformIntersectClipRect
)
743 // EMF import test with records: EXTCREATEPEN, CREATEBRUSHINDIRECT, MODIFYWORLDTRANSFORM, INTERSECTCLIPRECT, ELLIPSE
744 Primitive2DSequence aSequence
745 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestEllipseXformIntersectClipRect.emf");
746 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
747 drawinglayer::Primitive2dXmlDump dumper
;
748 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
749 CPPUNIT_ASSERT(pDocument
);
751 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygon", "path"_ostr
, "m0 0h3000v2000h-3000z");
752 assertXPath(pDocument
, aXPathPrefix
+ "mask/group/mask/polypolygon", "path"_ostr
,
753 "m370 152 1128-409 592 1623-1128 410z");
755 pDocument
, aXPathPrefix
+ "mask/group/mask/polypolygoncolor/polypolygon", "path"_ostr
,
756 "m3613 287-12-33-12-33-12-33-12-33-33 12-12-34-13-33-45-21-12-33-33 "
757 "12-12-33-45-21-46-21-12-33-33 12-12-33-45-21-33 12-46-21-45-21-33 12-45-21-34 12-45-21-33 "
758 "12-45-21-34 12-45-21-33 12-45-21-33 12-34 12-45-21-33 12-33 12-45-21-34 12-66 24-45-21-33 "
759 "12-34 12-66 24-33 12-45-21-34 12-66 24-33 12-33 12-34 12-66 24-33 12-33 12-67 25-33 12-33 "
760 "12-33 12-67 24-33 12-21 45-33 12-66 24-34 12-33 12-21 46-66 24-33 12-22 45-33 12-33 12-21 "
761 "45-33 12-33 12-21 46-34 12-21 45-33 12-21 45-33 12-21 45-34 12-21 45-33 13-21 45-21 45-33 "
762 "12-21 45 12 33-33 12 12 33-21 46-22 45 13 33-34 12 12 33-21 45 12 33 12 34-33 12 12 33 12 "
763 "33 13 33 12 33 12 33 12 33 12 33 12 34 33-12 12 33 12 33 46 21 12 33 33-12 12 33 45 21 45 "
764 "21 12 33 34-12 12 33 45 21 33-12 45 21 46 22 33-13 45 22 33-13 46 22 33-13 45 22 33-13 45 "
765 "22 34-13 45 22 33-12 33-13 46 22 33-13 33-12 45 21 33-12 67-24 45 21 33-12 33-12 67-24 "
766 "33-12 45 21 33-12 67-24 33-12 33-12 33-12 67-24 33-12 33-12 66-25 34-12 33-12 33-12 66-24 "
767 "33-12 22-45 33-12 66-24 33-12 33-12 22-45 66-25 33-12 21-45 33-12 34-12 21-45 33-12 33-12 "
768 "21-45 33-12 21-46 34-12 21-45 33-12 21-45 33-12 21-45 33-12 22-46 21-45 33-12 21-45-12-33 "
769 "33-12-12-33 21-46 21-45-12-33 33-12-12-33 21-45-12-33-12-33 33-12-12-34-12-33-12-33z");
771 pDocument
, aXPathPrefix
+ "mask/group/mask/polygonstroke/polygon",
772 "3613,287 3601,254 3601,254 3589,221 3577,188 3565,155 3532,167 3520,133 3507,100 3507,100 "
773 "3462,79 3450,46 3417,58 3405,25 3360,4 3360,4 3314,-17 3302,-50 3269,-38 3257,-71 "
774 "3212,-92 3179,-80 3133,-101 3133,-101 3088,-122 3055,-110 3010,-131 2976,-119 2931,-140 "
775 "2898,-128 2853,-149 2819,-137 2774,-158 2741,-146 2696,-167 2663,-155 2629,-143 2584,-164 "
776 "2551,-152 2518,-140 2473,-161 2439,-149 2373,-125 2328,-146 2295,-134 2261,-122 2195,-98 "
777 "2162,-86 2117,-107 2083,-95 2017,-71 1984,-59 1951,-47 1917,-35 1851,-11 1818,1 1818,1 "
778 "1785,13 1718,38 1685,50 1652,62 1619,74 1552,98 1519,110 1498,155 1465,167 1399,191 "
779 "1365,203 1332,215 1311,261 1245,285 1212,297 1190,342 1157,354 1124,366 1103,411 1070,423 "
780 "1037,435 1016,481 982,493 961,538 928,550 907,595 874,607 853,652 819,664 798,709 765,722 "
781 "744,767 744,767 723,812 690,824 669,869 681,902 648,914 660,947 639,993 639,993 617,1038 "
782 "630,1071 596,1083 608,1116 587,1161 587,1161 599,1194 611,1228 578,1240 590,1273 602,1306 "
783 "615,1339 615,1339 627,1372 627,1372 639,1405 639,1405 651,1438 663,1471 675,1505 708,1493 "
784 "720,1526 732,1559 732,1559 778,1580 790,1613 823,1601 835,1634 880,1655 880,1655 925,1676 "
785 "937,1709 971,1697 983,1730 1028,1751 1061,1739 1106,1760 1106,1760 1152,1782 1185,1769 "
786 "1230,1791 1263,1778 1309,1800 1342,1787 1387,1809 1420,1796 1465,1818 1499,1805 1544,1827 "
787 "1577,1815 1610,1802 1656,1824 1689,1811 1722,1799 1767,1820 1800,1808 1867,1784 1912,1805 "
788 "1945,1793 1978,1781 2045,1757 2078,1745 2123,1766 2156,1754 2223,1730 2256,1718 2289,1706 "
789 "2322,1694 2389,1670 2422,1658 2422,1658 2455,1646 2521,1621 2555,1609 2588,1597 2621,1585 "
790 "2687,1561 2720,1549 2742,1504 2775,1492 2841,1468 2874,1456 2907,1444 2929,1399 2995,1374 "
791 "3028,1362 3049,1317 3082,1305 3116,1293 3137,1248 3170,1236 3203,1224 3224,1179 3257,1167 "
792 "3278,1121 3312,1109 3333,1064 3366,1052 3387,1007 3420,995 3441,950 3474,938 3496,892 "
793 "3496,892 3517,847 3550,835 3571,790 3559,757 3592,745 3580,712 3601,666 3601,666 3622,621 "
794 "3610,588 3643,576 3631,543 3652,498 3652,498 3640,465 3628,432 3661,420 3649,386 3637,353 "
795 "3625,320 3625,320");
798 CPPUNIT_TEST_FIXTURE(Test
, testSetArcDirection
)
800 // EMF import test with records: SETARCDIRECTION, ARC, PIE
801 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestSetArcDirection.emf");
802 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
803 drawinglayer::Primitive2dXmlDump dumper
;
804 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
805 CPPUNIT_ASSERT(pDocument
);
807 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", "color"_ostr
, "#ffffff");
809 pDocument
, aXPathPrefix
+ "polypolygoncolor/polypolygon", "path"_ostr
,
810 "m1640 1570-1000-950 50-50 50-50 50-50 50-40 60-40 50-40 60-30 60-40 60-20 60-30 70-20 "
811 "60-20 70-10 60-20h70l70-10h60 70l70 10 60 10 70 10 70 20 60 20 60 20 70 30 60 30 60 30 50 "
812 "40 60 40 50 40 50 40 50 50 50 50 50 50 40 60 40 60 40 60 30 60 30 60 30 60 20 70 30 70 10 "
813 "60 20 70 10 70 10 70 10 70v80 70l-10 70v70l-10 70-20 70-20 70z");
814 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline", 2);
815 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline[1]", "color"_ostr
, "#000000");
816 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline[2]", "color"_ostr
, "#000000");
817 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline", 2);
819 pDocument
, aXPathPrefix
+ "polygonhairline[1]/polygon",
820 "1070,1570 1110,1560 1160,1540 1200,1530 1250,1520 1300,1510 1350,1510 1400,1500 1440,1500 "
821 "1490,1500 1540,1500 1590,1500 1640,1510 1690,1510 1740,1520 1780,1530 1830,1540 1880,1560 "
822 "1920,1570 1960,1590 2010,1610 2050,1630 2090,1650 2130,1670 2160,1700 2200,1720 2230,1750 "
823 "2260,1780 2290,1810 2320,1840 2350,1870 2370,1900 2390,1930 2410,1970 2430,2000 2440,2030 "
824 "2450,2070 2460,2110 2470,2140 2480,2180 2480,2220 2480,2250 2480,2290 2470,2320 2470,2360 "
825 "2460,2400 2450,2430 2430,2470 2420,2500 2400,2540 2380,2570 2350,2600 2330,2630 2300,2660 "
826 "2270,2690 2240,2720 2210,2750 2170,2770 2140,2800 2100,2820 2060,2840 2020,2860 1980,2880 "
827 "1940,2900 1890,2920 1850,2930 1800,2940 1750,2950 1700,2960 1660,2970 1610,2970 1560,2980 "
828 "1510,2980 1460,2980 1410,2980 1360,2970 1320,2970 1270,2960 1220,2950 1170,2940 1130,2930 "
829 "1080,2910 1040,2900 1000,2880 950,2860 910,2840 870,2820 840,2800 800,2770 770,2740 "
830 "730,2720 700,2690 670,2660 650,2630 620,2600 600,2560 580,2530 560,2500 550,2460 530,2430 "
831 "520,2390 510,2360 510,2320 500,2280 500,2250 500,2210 500,2170 510,2140 520,2100 530,2070 "
832 "540,2030 560,1990 570,1960 590,1930 610,1890 640,1860 660,1830 690,1800 720,1770 750,1740 "
833 "790,1720 820,1690 860,1670 900,1650 940,1630 980,1610 1020,1590");
835 pDocument
, aXPathPrefix
+ "polygonhairline[2]/polygon",
836 "1640,1570 640,620 690,570 740,520 790,470 840,430 900,390 950,350 1010,320 1070,280 "
837 "1130,260 1190,230 1260,210 1320,190 1390,180 1450,160 1520,160 1590,150 1650,150 1720,150 "
838 "1790,160 1850,170 1920,180 1990,200 2050,220 2110,240 2180,270 2240,300 2300,330 2350,370 "
839 "2410,410 2460,450 2510,490 2560,540 2610,590 2660,640 2700,700 2740,760 2780,820 2810,880 "
840 "2840,940 2870,1000 2890,1070 2920,1140 2930,1200 2950,1270 2960,1340 2970,1410 2980,1480 "
841 "2980,1560 2980,1630 2970,1700 2970,1770 2960,1840 2940,1910 2920,1980");
844 CPPUNIT_TEST_FIXTURE(Test
, testDrawPolyLine16WithClip
)
846 // EMF image with records:
847 // CREATEBRUSHINDIRECT, FILLRGN, BEGINPATH, POLYGON16, SELECTCLIPPATH, MODIFYWORLDTRANSFORM, SELECTOBJECT
848 Primitive2DSequence aSequence
849 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestDrawPolyLine16WithClip.emf");
850 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
851 drawinglayer::Primitive2dXmlDump dumper
;
852 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
853 CPPUNIT_ASSERT(pDocument
);
855 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygon", "path"_ostr
, "m0 0h3943v3939h-3943z");
857 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor", 1);
858 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]/polypolygon", "path"_ostr
,
859 "m1323 0h1323v1322h1323v1322h-1323v1322h-1323v-1322h-1323v-1322h1323z");
860 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]", "color"_ostr
, "#b4ffff");
862 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonhairline", 1);
863 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonhairline[1]/polygon",
864 "1323,0 2646,0 2646,1322 3969,1322 3969,2644 2646,2644 2646,3966 1323,3966 "
865 "1323,2644 0,2644 0,1322 1323,1322");
866 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonhairline[1]", "color"_ostr
, "#000000");
868 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[1]/mask/polypolygon", "path"_ostr
,
869 "m2646 0v1322h1323v1322h-1323v1322h-1323v-1322h-1323v-1322h1323v-1322");
870 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/group[1]/mask/polygonstroke/polygon",
874 CPPUNIT_TEST_FIXTURE(Test
, testFillRegion
)
876 // EMF import with records: CREATEBRUSHINDIRECT, FILLRGN. The SETICMMODE is also used.
877 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestFillRegion.emf");
878 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
879 drawinglayer::Primitive2dXmlDump dumper
;
880 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
881 CPPUNIT_ASSERT(pDocument
);
883 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygon", "path"_ostr
, "m0 0h3943v3939h-3943z");
885 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor", 1);
886 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]/polypolygon", "path"_ostr
,
887 "m1323 0h1323v1322h1323v1322h-1323v1322h-1323v-1322h-1323v-1322h1323z");
888 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]", "color"_ostr
, "#ff0000");
890 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonhairline", 1);
891 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonhairline[1]/polygon",
892 "1323,0 2646,0 2646,1322 3969,1322 3969,2644 2646,2644 2646,3966 1323,3966 "
893 "1323,2644 0,2644 0,1322 1323,1322");
894 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonhairline[1]", "color"_ostr
, "#000000");
897 CPPUNIT_TEST_FIXTURE(Test
, testPolylinetoCloseStroke
)
899 // EMF import with records: BEGINPATH, ARC, ENDPATH, STROKEPATH, EXTCREATEPEN.
900 Primitive2DSequence aSequence
901 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestPolylinetoCloseStroke.emf");
902 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
903 drawinglayer::Primitive2dXmlDump dumper
;
904 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
905 CPPUNIT_ASSERT(pDocument
);
907 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline", 2);
909 pDocument
, aXPathPrefix
+ "polygonhairline[1]/polygon",
910 "1080,150 1010,170 940,190 870,210 810,230 750,260 690,280 630,310 570,340 520,380 470,410 "
911 "420,450 370,490 330,530 290,570 260,610 230,660 200,700 170,750 150,790 130,840 120,890 "
912 "110,930 100,980 100,1030 100,1080 110,1130 120,1180 130,1220 140,1270 160,1320 190,1360 "
913 "210,1410 250,1450 280,1490 320,1540 360,1580 400,1620 450,1650 500,1690");
914 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline[1]", "color"_ostr
, "#000000");
916 pDocument
, aXPathPrefix
+ "polygonhairline[2]/polygon",
917 "1760,1120 1710,1130 1670,1140 1620,1150 1580,1160 1540,1170 1500,1180 1460,1200 1420,1210 "
918 "1380,1230 1350,1240 1320,1260 1290,1280 1260,1300 1230,1310 1210,1330 1190,1360 1170,1380 "
919 "1150,1400 1140,1420 1120,1440 1110,1460 1110,1490 1100,1510 1100,1530 1100,1550 1100,1580 "
920 "1110,1600 1120,1620 1130,1650 1140,1670 1160,1690 1170,1710 1190,1730");
921 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline[2]", "color"_ostr
, "#000000");
924 CPPUNIT_TEST_FIXTURE(Test
, testEmfPolydraw
)
926 // tdf#142249 EMF import with records: POLYDRAW, CREATEPEN.
927 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestEmfPolydraw.emf");
928 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
929 drawinglayer::Primitive2dXmlDump dumper
;
930 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
931 CPPUNIT_ASSERT(pDocument
);
933 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline", 2);
934 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline[1]", "color"_ostr
, "#000000");
935 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonhairline[1]/polygon",
936 "2000,200 3000,200 3000,1000");
937 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline[2]", "color"_ostr
, "#000000");
938 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonhairline[2]/polygon",
939 "3000,2000 3000,2000 4000,2000 3000,3000");
941 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke", 1);
942 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonstroke[1]/polygon",
943 "50,50 50,50 1000,1000 1000,1000 2000,2500 2000,1000");
944 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke[1]/line", "color"_ostr
, "#ff0000");
945 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke[1]/stroke", "dotDashArray"_ostr
, "30 10 ");
948 CPPUNIT_TEST_FIXTURE(Test
, testEmfPlusBrushPathGradientWithBlendColors
)
950 // tdf#131506 EMF+ records: FillRects, Brush with PathGradient and BlendColor, FillRects
951 Primitive2DSequence aSequence
952 = parseEmf(u
"emfio/qa/cppunit/emf/data/TestEmfPlusBrushPathGradientWithBlendColors.emf");
953 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
954 drawinglayer::Primitive2dXmlDump dumper
;
955 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
956 CPPUNIT_ASSERT(pDocument
);
958 assertXPath(pDocument
, aXPathPrefix
+ "svgradialgradient", "radius"_ostr
, "0.7");
959 assertXPath(pDocument
, aXPathPrefix
+ "svgradialgradient/focalx", 0);
960 assertXPath(pDocument
, aXPathPrefix
+ "svgradialgradient/focaly", 0);
961 assertXPath(pDocument
, aXPathPrefix
+ "svgradialgradient", "startx"_ostr
, "0");
962 assertXPath(pDocument
, aXPathPrefix
+ "svgradialgradient", "starty"_ostr
, "0");
963 assertXPath(pDocument
, aXPathPrefix
+ "svgradialgradient", "spreadmethod"_ostr
, "pad");
966 CPPUNIT_TEST_FIXTURE(Test
, testEmfPlusDrawCurve
)
968 // tdf#143877 EMF+ records: DrawCurve, DrawClosedCurve
969 Primitive2DSequence aSequence
= parseEmf(u
"emfio/qa/cppunit/emf/data/TestEmfPlusDrawCurve.emf");
970 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
971 drawinglayer::Primitive2dXmlDump dumper
;
972 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
973 CPPUNIT_ASSERT(pDocument
);
975 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke", 26);
977 // Verify DrawCurve with tension=0.5, offset=0, segments=2
978 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[3]/line", "color"_ostr
,
981 pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[3]/polypolygon", "path"_ostr
,
982 "m4121.5678588927 597.698391624308 124.350808427242 119.857180790532 168.799608035277 "
983 "163.249184432137 191.024007839294 186.003527805174 191.024007839294 188.120210909643 "
984 "168.799608035277 169.599233745543 124.350808427242 130.440596312875 57.677609015188 "
985 "70.6442986116379 14.8162665360123 69.7182497534329 10.5830475257226 128.191620514377 "
986 "6.34982851543373 166.821087170928 2.11660950514397 185.606649723086-2.11660950514397 "
987 "184.548308170852-6.34982851543373 163.646062514225-10.5830475257226 "
988 "122.899912753206-14.8162665360123 62.3098588877929");
990 // Verify DrawCurve with tension=1.125, offset=0, segments=3
991 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[9]/line", "color"_ostr
,
994 pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[9]/polypolygon", "path"_ostr
,
995 "m6593.23860852523 4960.44685532205 129.113179813817 111.125862984599 154.512493875552 "
996 "132.292694029285 167.212150906418 147.109475760564 167.212150906418 155.576208178439 "
997 "154.512493875552 157.692891282907 129.113179813817 153.45952507397 91.0142087212153 "
998 "142.876109551627 59.2650661440466 139.171914118808 42.3321901028912 144.463621879979 "
999 "25.399314061734 146.580304984447 8.46643802057861 145.521963432213-8.46643802057861 "
1000 "141.288597223276-25.399314061734 133.880206357636-42.3321901028912 "
1001 "123.296790835293-59.2650661440466 109.538350656248-83.6060754532091 "
1002 "99.2195205219632-111.121999020089 93.3986419846751-132.288094071533 "
1003 "85.9902511190348-147.104360607545 76.9943479250442-155.570798628123 "
1004 "66.4109324027004-157.687408133268 54.2400045520071-153.454189122979 "
1005 "40.4815643729608-142.871141597256 25.135611865564");
1007 // Verify DrawCurve with tension=0.125, offset=0, segments=4
1008 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[13]/line", "color"_ostr
,
1011 pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[13]/polypolygon", "path"_ostr
,
1012 "m4121.5678588927 9267.6323875275 124.350808427242 119.857180790532 168.799608035277 "
1013 "163.249184432138 191.024007839294 186.003527805173 191.024007839294 188.120210909643 "
1014 "168.799608035277 169.599233745543 124.350808427242 130.440596312876 57.677609015188 "
1015 "70.6442986116381 14.8162665360123 69.7182497534323 10.5830475257226 128.191620514377 "
1016 "6.34982851543373 166.821087170927 2.11660950514397 185.606649723086-2.11660950514397 "
1017 "184.548308170854-6.34982851543373 163.646062514224-10.5830475257226 "
1018 "122.899912753204-14.8162665360123 62.3098588877929-55.8255756981871 "
1019 "42.2675157423582-119.853013228809 69.3875180183586-163.243508084272 "
1020 "86.5855682421661-185.997060264576 93.861666413779-188.113669769721 "
1021 "91.2158125331916-169.593336599706 78.6480066004096-130.436060754531 "
1022 "56.1582486154312-70.6418422341994 "
1023 "23.7465385782562-70.6418422341985-7.93756164175647-130.436060754532-28.046051134208-169."
1024 "593336599706-41.8044913132544-188.113669769721-49.2128821788938-185.997060264576-50."
1025 "271223731128-163.243508084272-44.979515969957-119.853013228809-33.3377588953808-55."
1026 "8255756981871-15.3459525073959");
1028 // Verify DrawCurve with tension=0.125, offset=1, segments=3
1029 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[18]/line", "color"_ostr
,
1032 pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[18]/polypolygon", "path"_ostr
,
1033 "m5162.41058304753 14700.2318678401 10.5830475257226 128.191620514377 6.34982851543373 "
1034 "166.821087170927 2.11660950514397 185.606649723086-2.11660950514397 "
1035 "184.548308170854-6.34982851543373 163.646062514224-10.5830475257226 "
1036 "122.899912753204-14.8162665360123 62.3098588877929-55.8255756981871 "
1037 "42.2675157423582-119.853013228809 69.3875180183586-163.243508084272 "
1038 "86.5855682421661-185.997060264576 93.861666413779-188.113669769721 "
1039 "91.2158125331916-169.593336599706 78.6480066004096-130.436060754531 "
1040 "56.1582486154312-70.6418422341994 23.7465385782562");
1042 // Verify DrawClosedCurve with tension=0.5
1043 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[22]/line", "color"_ostr
,
1046 pDocument
, aXPathPrefix
+ "mask/polypolygonstroke[22]/polypolygon", "path"_ostr
,
1047 "m2709.26016658501 19012.0476443365v122.767620059174 173.568014566423 198.968211820044 "
1048 "198.968211820044 173.568014566423 122.767620059174 46.5670282983083l-46.5654091131796 "
1049 "23.283514149156-122.763351298383 61.383810029587-173.561979421852 "
1050 "86.7840072832114-198.961293483586 99.4841059100218-198.961293483586 "
1051 "99.4841059100218-173.561979421852 86.7840072832114-122.763351298383 "
1052 "61.383810029587-46.5654091131796 "
1053 "23.283514149156-46.5654091131798-11.6417570745798-122.763351298383-30.6919050147917-173."
1054 "561979421852-43.3920036416057-198.961293483586-49.7420529550109-198.961293483586-49."
1055 "7420529550109-173.561979421852-43.3920036416057-122.763351298383-30.6919050147953-46."
1056 "5654091131798-11.6417570745762 46.5654091131798-104.775813671193 "
1057 "122.763351298383-276.227145133147 173.561979421852-390.528032774448 "
1058 "198.961293483586-447.678476595098 198.961293483586-447.678476595102 "
1059 "173.561979421852-390.528032774448 122.763351298383-276.227145133147 "
1060 "46.5654091131798-104.775813671193 46.5654091131796 46.5670282983083 122.763351298383 "
1061 "122.767620059178 173.561979421852 173.568014566419 198.961293483586 198.968211820044 "
1062 "198.961293483586 198.968211820047 173.561979421852 173.568014566419 122.763351298383 "
1063 "122.767620059178 46.5654091131796 46.5670282983083z");
1066 CPPUNIT_TEST_FIXTURE(Test
, testEmfPlusGetDC
)
1068 // tdf#147818 EMF+ records: GetDC, DrawPath, FillRects
1069 Primitive2DSequence aSequence
= parseEmf(u
"emfio/qa/cppunit/emf/data/TestEmfPlusGetDC.emf");
1070 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1071 drawinglayer::Primitive2dXmlDump dumper
;
1072 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1073 CPPUNIT_ASSERT(pDocument
);
1075 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion", "text"_ostr
, "sd CCCCCCCCCCCCCCC");
1076 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion", "fontcolor"_ostr
, "#000000");
1078 assertXPath(pDocument
, aXPathPrefix
+ "group", 5);
1080 pDocument
, aXPathPrefix
+ "group[4]/textsimpleportion", "text"_ostr
,
1081 "Getttttttttttttttttttttttttttttt, uuuu: \"eeeeeeeeeeeeeeeeeeeeeee-7acd04a3953b\")");
1082 assertXPath(pDocument
, aXPathPrefix
+ "group[5]/textsimpleportion", "text"_ostr
,
1083 "TTTTTTTTTTTTTTTTTTTTTTTTTTTTT, trackId: 55)");
1084 assertXPath(pDocument
, aXPathPrefix
+ "group[5]/textsimpleportion", "fontcolor"_ostr
,
1087 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", 6);
1088 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]/polypolygon", "path"_ostr
,
1090 "776.111111111111h3878.64583333333l458.385416666667-493.888888888889v-176."
1091 "388888888889h-4337.03125v670.277777777778");
1092 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]", "color"_ostr
, "#ffffff");
1094 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[3]/polypolygon", "path"_ostr
,
1095 "m2291.92708333333 4550.83333333333h317.34375v-317.5h-317.34375z");
1096 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[3]", "color"_ostr
, "#fcf2e3");
1098 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[6]/polypolygon", "path"_ostr
,
1099 "m19428.4895833333 6632.22222222222h317.34375v-2398.88888888889h-317.34375z");
1100 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[6]", "color"_ostr
, "#fcf2e3");
1102 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke", 4);
1103 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow", 13);
1106 CPPUNIT_TEST_FIXTURE(Test
, testEmfPlusSave
)
1108 // tdf#147818 EMF+ records: Save, Restore, SetWorldTransform, FillRects, SetClipRegion
1109 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestEmfPlusSave.emf");
1110 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1111 drawinglayer::Primitive2dXmlDump dumper
;
1112 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1113 CPPUNIT_ASSERT(pDocument
);
1115 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygon", "path"_ostr
,
1116 "m0 0h33544v21311h-33544z");
1118 assertXPath(pDocument
, aXPathPrefix
+ "mask/group/mask/polypolygoncolor/polypolygon",
1120 "m327.458333333333 638.222222222222h437007.1875v295555.555555556h-437007.1875z");
1121 assertXPath(pDocument
, aXPathPrefix
+ "mask/group/mask/polypolygoncolor", "color"_ostr
,
1124 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor/polypolygon", "path"_ostr
,
1125 "m10853.4145539602 7321.41354709201h41952690v29630720h-41952690z");
1126 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor", "color"_ostr
, "#00ffad");
1128 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstrokearrow/line", "color"_ostr
, "#000000");
1129 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonstrokearrow/polygon",
1130 "10853.4145539602,7321.41354709201 10853.4145539602,4907.54325697157 "
1131 "12832.6557236512,4907.54325697157");
1134 CPPUNIT_TEST_FIXTURE(Test
, testEmfPlusDrawPathWithCustomCap
)
1136 // tdf#142261 EMF+ records: DrawPath, SetWorldTransform, Object (Brush, Pen, Path)
1137 // Check if CustomEndCap is displayed correctly
1138 Primitive2DSequence aSequence
1139 = parseEmf(u
"emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithCustomCap.emf");
1140 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1141 drawinglayer::Primitive2dXmlDump dumper
;
1142 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1143 CPPUNIT_ASSERT(pDocument
);
1145 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonstrokearrow/polygon",
1146 "1423.297394625,1268.98481214025 705.717657763014,1304.88786195939");
1147 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow/line", "color"_ostr
, "#cc0000");
1148 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow/line", "width"_ostr
, "96");
1149 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow/line", "linecap"_ostr
, "BUTT");
1150 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow/stroke", 0);
1151 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow/linestartattribute", 0);
1153 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow/lineendattribute", "centered"_ostr
,
1155 assertXPath(pDocument
, aXPathPrefix
+ "polygonstrokearrow/lineendattribute/polypolygon",
1156 "path"_ostr
, "m-1.5 3 1.5-3 1.5 3z");
1159 CPPUNIT_TEST_FIXTURE(Test
, testEmfPlusDrawPathWithMiterLimit
)
1161 // tdf#142261 EMF+ records: DrawPath, TranslateWorldTransform, Object (Brush, Pen, Path)
1162 // Check if Miter is correctly set for Lines
1163 Primitive2DSequence aSequence
1164 = parseEmf(u
"emfio/qa/cppunit/emf/data/TestEmfPlusDrawPathWithMiterLimit.emf");
1165 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1166 drawinglayer::Primitive2dXmlDump dumper
;
1167 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1168 CPPUNIT_ASSERT(pDocument
);
1170 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke", 3);
1171 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[1]/line", "color"_ostr
, "#c800c8");
1172 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[1]/line", "width"_ostr
, "1057");
1173 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[1]/line", "linejoin"_ostr
, "Miter");
1174 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[1]/line", "miterangle"_ostr
, "5");
1175 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[1]/stroke", 0);
1177 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence", 3);
1178 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence[1]", "transparence"_ostr
, "85");
1179 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence[1]/polypolygonstroke/line",
1180 "color"_ostr
, "#6400c8");
1181 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence[1]/polypolygonstroke/line",
1182 "width"_ostr
, "1057");
1183 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence[1]/polypolygonstroke/line",
1184 "linejoin"_ostr
, "Miter");
1185 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence[1]/polypolygonstroke/line",
1186 "miterangle"_ostr
, "19");
1187 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence[2]", "transparence"_ostr
, "69");
1188 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence[2]/polypolygonstroke/line",
1189 "miterangle"_ostr
, "19");
1190 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence[3]", "transparence"_ostr
, "53");
1191 assertXPath(pDocument
, aXPathPrefix
+ "unifiedtransparence[3]/polypolygonstroke/line",
1192 "miterangle"_ostr
, "19");
1194 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[2]/line", "color"_ostr
, "#0000ff");
1195 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[2]/line", "width"_ostr
, "1057");
1196 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[2]/line", "linejoin"_ostr
, "Miter");
1197 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[2]/line", "miterangle"_ostr
, "60");
1198 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[2]/stroke", 0);
1200 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[3]/line", "color"_ostr
, "#0000ff");
1201 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[3]/line", "width"_ostr
, "1057");
1202 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[3]/line", "linejoin"_ostr
, "Miter");
1203 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[3]/line", "miterangle"_ostr
, "60");
1204 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[3]/stroke", 0);
1207 CPPUNIT_TEST_FIXTURE(Test
, testEmfPlusFillClosedCurve
)
1209 // tdf#143876 EMF+ records: SetWorldTransform, FillClosedCurve, DrawClosedCurve
1210 Primitive2DSequence aSequence
1211 = parseEmf(u
"emfio/qa/cppunit/emf/data/TestEmfPlusFillClosedCurve.emf");
1212 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1213 drawinglayer::Primitive2dXmlDump dumper
;
1214 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1215 CPPUNIT_ASSERT(pDocument
);
1217 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", 2);
1218 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]", "color"_ostr
, "#808080");
1219 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[2]", "color"_ostr
, "#808080");
1221 // Validate curve generated by FillClosedCurve, tension=0.25
1223 pDocument
, aXPathPrefix
+ "polypolygoncolor[2]/polypolygon", "path"_ostr
,
1224 "m1305.97700269476 "
1225 "808.572945906987-50.3314857912787-25.4001972536228-68.1076984321412-40.2169789849024-76."
1226 "5824044585986-48.6837114027768-75.7556038706516-50.8003945072452-65.6272966683-46."
1227 "5670282983082-46.1974828515433-35.9836127759654-17.4661624203823-19.050147940217 "
1228 "18.1896129348361-7.40839086563994 47.9544341009307-5.29170776117132 "
1229 "67.797648211661-3.17502465670293 77.719255267026-1.0583415522342 77.719255267026 "
1230 "1.0583415522342 67.7976482116608 3.17502465670293 47.9544341009309 5.29170776117132 "
1231 "18.1896129348359 7.40839086563994-17.4661624203823 19.050147940217-46.1974828515431 "
1232 "35.9836127759654-65.6272966683 46.5670282983082-75.7556038706516 "
1233 "50.8003945072452-76.5824044585986 48.6837114027768-68.1076984321412 "
1234 "40.2169789849024-50.3314857912787 25.4001972536228-23.2537665360119 4.23336620893701 "
1235 "2.58375183733483-29.7658561565891 18.0862628613424-64.4265419922616 "
1236 "29.2480707986281-87.1808853652984 36.0691756491915-98.0288862757 "
1237 "38.5495774130329-96.9705447234655 36.6892760901519-84.0058607085957 "
1238 "30.4882716805487-59.1348342310902 19.9465641842235-22.3574652909491 19.9465641842235 "
1239 "22.3574652909491 30.4882716805487 59.1348342310902 36.6892760901519 84.0058607085957 "
1240 "38.5495774130327 96.9705447234655 36.0691756491917 98.0288862757 29.2480707986281 "
1241 "87.1808853652984 18.0862628613424 64.4265419922616 2.5837518373346 29.7658561565891z");
1243 // Validate curve generated by DrawClosedCurve, tension=0.25
1245 pDocument
, aXPathPrefix
+ "polypolygonstroke[2]/polypolygon", "path"_ostr
,
1246 "m1305.97700269476 "
1247 "808.572945906987-50.3314857912787-25.4001972536228-68.1076984321412-40.2169789849024-76."
1248 "5824044585986-48.6837114027768-75.7556038706516-50.8003945072452-65.6272966683-46."
1249 "5670282983082-46.1974828515433-35.9836127759654-17.4661624203823-19.050147940217 "
1250 "18.1896129348361-7.40839086563994 47.9544341009307-5.29170776117132 "
1251 "67.797648211661-3.17502465670293 77.719255267026-1.0583415522342 77.719255267026 "
1252 "1.0583415522342 67.7976482116608 3.17502465670293 47.9544341009309 5.29170776117132 "
1253 "18.1896129348359 7.40839086563994-17.4661624203823 19.050147940217-46.1974828515431 "
1254 "35.9836127759654-65.6272966683 46.5670282983082-75.7556038706516 "
1255 "50.8003945072452-76.5824044585986 48.6837114027768-68.1076984321412 "
1256 "40.2169789849024-50.3314857912787 25.4001972536228-23.2537665360119 4.23336620893701 "
1257 "2.58375183733483-29.7658561565891 18.0862628613424-64.4265419922616 "
1258 "29.2480707986281-87.1808853652984 36.0691756491915-98.0288862757 "
1259 "38.5495774130329-96.9705447234655 36.6892760901519-84.0058607085957 "
1260 "30.4882716805487-59.1348342310902 19.9465641842235-22.3574652909491 19.9465641842235 "
1261 "22.3574652909491 30.4882716805487 59.1348342310902 36.6892760901519 84.0058607085957 "
1262 "38.5495774130327 96.9705447234655 36.0691756491917 98.0288862757 29.2480707986281 "
1263 "87.1808853652984 18.0862628613424 64.4265419922616 2.5837518373346 29.7658561565891z");
1265 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke", 2);
1266 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[1]/line", "color"_ostr
, "#00ff00");
1267 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[1]/line", "width"_ostr
, "4");
1268 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[1]/line", "linejoin"_ostr
, "Miter");
1269 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[1]/line", "miterangle"_ostr
, "3");
1270 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[1]/line", "linecap"_ostr
, "BUTT");
1271 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[2]/line", "color"_ostr
, "#aaaa00");
1272 assertXPath(pDocument
, aXPathPrefix
+ "polypolygonstroke[2]/line", "width"_ostr
, "4");
1275 CPPUNIT_TEST_FIXTURE(Test
, testExtTextOutOpaqueAndClipTransform
)
1277 // tdf#142495 EMF records: SETBKCOLOR, SELECTOBJECT, EXTTEXTOUTW, MODIFYWORLDTRANSFORM, CREATEFONTINDIRECT.
1278 Primitive2DSequence aSequence
1279 = parseEmf(u
"/emfio/qa/cppunit/emf/data/TestExtTextOutOpaqueAndClipTransform.emf");
1280 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1281 drawinglayer::Primitive2dXmlDump dumper
;
1282 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1283 CPPUNIT_ASSERT(pDocument
);
1285 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion", 2);
1286 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion[1]", "text"_ostr
, "No_rect- DLP-");
1287 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion[1]", "fontcolor"_ostr
, "#000000");
1289 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion[2]", "text"_ostr
, "OpaqueTranspa");
1290 assertXPath(pDocument
, aXPathPrefix
+ "textsimpleportion[2]", "fontcolor"_ostr
, "#000000");
1292 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", 3);
1293 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]/polypolygon", "path"_ostr
,
1294 "m966 490-477-275-84 147 476 275z");
1295 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]", "color"_ostr
, "#ff0000");
1297 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[2]/polypolygon", "path"_ostr
,
1298 "m251 713 623 361-148 257-623-361z");
1299 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[2]", "color"_ostr
, "#0080ff");
1301 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[3]/polypolygon", "path"_ostr
,
1302 "m972 1326-476-275-148 257 476 276z");
1303 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[3]", "color"_ostr
, "#800080");
1305 assertXPath(pDocument
, aXPathPrefix
+ "group", 3);
1306 assertXPath(pDocument
, aXPathPrefix
+ "group[1]/polypolygoncolor", "color"_ostr
, "#ff0000");
1307 assertXPath(pDocument
, aXPathPrefix
+ "group[1]/textsimpleportion", "text"_ostr
,
1309 assertXPath(pDocument
, aXPathPrefix
+ "group[1]/textsimpleportion", "fontcolor"_ostr
,
1312 assertXPath(pDocument
, aXPathPrefix
+ "group[2]/mask/group/polypolygoncolor", "color"_ostr
,
1314 assertXPath(pDocument
, aXPathPrefix
+ "group[2]/mask/polypolygon", "path"_ostr
,
1315 "m320 508 586 340-169 293-586-339z");
1316 assertXPath(pDocument
, aXPathPrefix
+ "group[2]/mask/group/textsimpleportion", "text"_ostr
,
1318 assertXPath(pDocument
, aXPathPrefix
+ "group[2]/mask/group/textsimpleportion", "fontcolor"_ostr
,
1321 assertXPath(pDocument
, aXPathPrefix
+ "group[3]/mask/group/polypolygoncolor", "color"_ostr
,
1323 assertXPath(pDocument
, aXPathPrefix
+ "group[3]/mask/polypolygon", "path"_ostr
,
1324 "m251 713 623 361-148 257-623-361z");
1325 assertXPath(pDocument
, aXPathPrefix
+ "group[3]/mask/group/textsimpleportion", "text"_ostr
,
1327 assertXPath(pDocument
, aXPathPrefix
+ "group[3]/mask/group/textsimpleportion", "fontcolor"_ostr
,
1331 CPPUNIT_TEST_FIXTURE(Test
, testNegativeWinOrg
)
1333 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestNegativeWinOrg.emf");
1334 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1335 drawinglayer::Primitive2dXmlDump dumper
;
1336 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1337 CPPUNIT_ASSERT(pDocument
);
1339 // The crop box (EMR_EXTSELECTCLIPRGN) would not factor in WinOrg coordinates
1340 // and be lower and more to the right than it actually is which would cut the
1341 // text in the emf above in half.
1342 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[1]/mask/polypolygon", 1);
1343 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[1]/mask/polypolygon", "minx"_ostr
, "0");
1344 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[1]/mask/polypolygon", "miny"_ostr
, "272");
1345 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[1]/mask/polypolygon", "maxx"_ostr
, "6800");
1346 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[1]/mask/polypolygon", "maxy"_ostr
, "644");
1349 CPPUNIT_TEST_FIXTURE(Test
, testBitBltStretchBltWMF
)
1351 // tdf#55058 tdf#142722 WMF records: BITBLT, STRETCHBLT.
1352 Primitive2DSequence aSequence
1353 = parseEmf(u
"/emfio/qa/cppunit/wmf/data/TestBitBltStretchBlt.wmf");
1354 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1355 drawinglayer::Primitive2dXmlDump dumper
;
1356 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1357 CPPUNIT_ASSERT(pDocument
);
1359 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap", 2);
1360 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]", "xy11"_ostr
, "508");
1361 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]", "xy12"_ostr
, "0");
1362 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]", "xy13"_ostr
, "0");
1363 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]", "xy21"_ostr
, "0");
1364 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]", "xy22"_ostr
, "508");
1365 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]", "xy23"_ostr
, "406");
1366 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]", "height"_ostr
, "10");
1367 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]", "width"_ostr
, "10");
1368 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]/data", 10);
1369 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]/data[1]", "row"_ostr
,
1370 "000000,000000,000000,000000,000000,000000,000000,000000,000000,000000");
1371 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]/data[4]", "row"_ostr
,
1372 "000000,ffffff,000000,ffffff,000000,ffffff,000000,ffffff,000000,ffffff");
1373 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[1]/data[5]", "row"_ostr
,
1374 "ffffff,000000,ffffff,ffffff,000000,000000,000000,ffffff,ffffff,000000");
1376 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[2]", "xy11"_ostr
, "1524");
1377 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[2]", "xy12"_ostr
, "0");
1378 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[2]", "xy13"_ostr
, "813");
1379 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[2]", "xy21"_ostr
, "0");
1380 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[2]", "xy22"_ostr
, "1016");
1381 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[2]", "xy23"_ostr
, "0");
1382 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[2]", "height"_ostr
, "10");
1383 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[2]", "width"_ostr
, "10");
1384 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[2]/data", 10);
1385 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[2]/data[1]", "row"_ostr
,
1386 "000000,00001c,000038,000055,000071,00008d,0000aa,0000c6,0000e2,0000ff");
1387 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap[2]/data[5]", "row"_ostr
,
1388 "720000,721c1c,723838,725555,727171,72728d,55728d,39728d,1d728d,00728d");
1391 CPPUNIT_TEST_FIXTURE(Test
, testExtTextOutOpaqueAndClipWMF
)
1393 // tdf#53004 WMF records: SETBKCOLOR, SELECTOBJECT, EXTTEXTOUT, CREATEBRUSHINDIRECT.
1394 Primitive2DSequence aSequence
1395 = parseEmf(u
"/emfio/qa/cppunit/wmf/data/TestExtTextOutOpaqueAndClip.wmf");
1396 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1397 drawinglayer::Primitive2dXmlDump dumper
;
1398 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1399 CPPUNIT_ASSERT(pDocument
);
1402 // On some operating systems (Linux on LO Jenkins CI), the `/mask/` string is not added to XPath
1403 // As a result tests are failing. On my Ubuntu 20.04 the `/mask/` string was added
1404 // I would leave this test case for macOS to make sure there is no regression at least on one platform.
1406 // These values come from the fix for tdf#88163
1407 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor", 5);
1408 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]/polypolygon", "path"_ostr
,
1409 "m7257 1836h320v3628h-320z");
1410 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]", "color"_ostr
, "#ff0000");
1412 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[2]/polypolygon", "path"_ostr
,
1413 "m7257 5976h320v321h-320z");
1414 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[2]", "color"_ostr
, "#00ff00");
1416 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[3]/polypolygon", "path"_ostr
,
1417 "m10203 5976h320v321h-320z");
1418 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[3]", "color"_ostr
, "#8080ff");
1420 assertXPath(pDocument
, aXPathPrefix
+ "mask/group", 5);
1421 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[1]/polypolygoncolor", "color"_ostr
,
1423 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[1]/textsimpleportion", "text"_ostr
, "ABCD");
1424 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[1]/textsimpleportion", "fontcolor"_ostr
,
1427 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[2]/polypolygoncolor", "color"_ostr
,
1429 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[2]/textsimpleportion", "text"_ostr
, "MMMM");
1430 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[2]/textsimpleportion", "fontcolor"_ostr
,
1433 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[3]/mask/group/polypolygoncolor", "color"_ostr
,
1435 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[3]/mask/group/polypolygoncolor/polypolygon",
1436 "path"_ostr
, "m1067 1067h1296v473h-1296z");
1437 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[3]/mask/group/textsimpleportion", "text"_ostr
,
1439 assertXPath(pDocument
, aXPathPrefix
+ "mask/group[3]/mask/group/textsimpleportion",
1440 "fontcolor"_ostr
, "#000000");
1444 CPPUNIT_TEST_FIXTURE(Test
, testPaletteWMF
)
1446 // WMF import with records: CREATEPALETTE, SELECTOBJECT, CREATEPENINDIRECT, CREATEBRUSHINDIRECT, ELLIPSE.
1447 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/wmf/data/TestPalette.wmf");
1448 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1449 drawinglayer::Primitive2dXmlDump dumper
;
1450 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1451 CPPUNIT_ASSERT(pDocument
);
1453 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor", 2);
1454 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]/polypolygon", "path"_ostr
,
1455 "m0 0h3015v3015h-3015z");
1456 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[1]", "color"_ostr
, "#ffff00");
1458 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[2]/polypolygon", "path"_ostr
,
1459 "m2222 2222h2698v2698h-2698z");
1460 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygoncolor[2]", "color"_ostr
, "#0080ff");
1462 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke", 2);
1463 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonstroke[1]/polygon",
1464 "0,0 3015,0 3015,3015 0,3015");
1465 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[1]/line", "color"_ostr
, "#ff0000");
1466 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[1]/line", "width"_ostr
, "132");
1468 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonstroke[2]/polygon",
1469 "2222,2222 4920,2222 4920,4920 2222,4920");
1470 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[2]/line", "color"_ostr
, "#ff0000");
1471 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[2]/line", "width"_ostr
, "132");
1474 CPPUNIT_TEST_FIXTURE(Test
, testRestoreDCWMF
)
1476 // WMF records: RESTOREDC, SAVEDC, CREATEBRUSHINDIRECT, RECTANGLE.
1477 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/wmf/data/TestRestoreDC.wmf");
1478 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1479 drawinglayer::Primitive2dXmlDump dumper
;
1480 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1481 CPPUNIT_ASSERT(pDocument
);
1483 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", 3);
1484 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]", "color"_ostr
, "#0000ff");
1485 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]/polypolygon", "path"_ostr
,
1486 "m238 2884h1640v1110h-1640z");
1487 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline[1]", "color"_ostr
, "#000000");
1488 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonhairline[1]/polygon",
1489 "238,2884 1878,2884 1878,3994 238,3994");
1491 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[2]", "color"_ostr
, "#ff0000");
1492 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[2]/polypolygon", "path"_ostr
,
1493 "m238 238h1640v1110h-1640z");
1494 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline[2]", "color"_ostr
, "#000000");
1496 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[3]", "color"_ostr
, "#ff0000");
1497 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[3]/polypolygon", "path"_ostr
,
1498 "m238 5530h1640v1110h-1640z");
1499 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline[3]", "color"_ostr
, "#000000");
1502 CPPUNIT_TEST_FIXTURE(Test
, testRoundrectWMF
)
1504 // WMF records: ROUNDRECT, SETBKCOLOR, CREATEBRUSHINDIRECT
1505 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/wmf/data/TestRoundRect.wmf");
1506 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1507 drawinglayer::Primitive2dXmlDump dumper
;
1508 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1509 CPPUNIT_ASSERT(pDocument
);
1511 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", "color"_ostr
, "#ffffff");
1514 pDocument
, aXPathPrefix
+ "polygonstroke/polygon",
1515 "2858,659 2858,651 2858,643 2858,635 2858,619 2858,611 2858,603 2850,595 2850,587 2850,580 "
1516 "2850,564 2850,556 2842,548 2842,540 2842,532 2834,524 2834,516 2834,508 2826,500 2826,492 "
1517 "2818,484 2818,476 2810,468 2810,460 2802,452 2802,445 2794,437 2794,429 2786,421 2786,421 "
1518 "2778,413 2770,405 2770,397 2762,389 2754,389 2754,381 2746,373 2738,373 2731,365 2731,365 "
1519 "2723,357 2715,349 2707,349 2707,341 2699,341 2691,341 2683,333 2675,333 2675,333 2667,325 "
1520 "2659,325 2651,325 2643,325 2635,318 2627,318 2627,318 2619,318 2611,318 2604,318 572,318 "
1521 "564,318 556,318 548,318 548,318 540,318 532,325 524,325 516,325 508,325 500,333 500,333 "
1522 "492,333 484,341 476,341 468,341 468,349 460,349 452,357 445,365 445,365 437,373 429,373 "
1523 "421,381 421,389 413,389 405,397 405,405 397,413 389,421 389,421 381,429 381,437 373,445 "
1524 "373,452 365,460 365,468 357,476 357,484 349,492 349,500 341,508 341,516 341,524 333,532 "
1525 "333,540 333,548 325,556 325,564 325,580 325,587 325,595 318,603 318,611 318,619 318,635 "
1526 "318,643 318,651 318,659 318,1667 318,1675 318,1683 318,1691 318,1707 318,1715 318,1723 "
1527 "325,1731 325,1739 325,1746 325,1762 325,1770 333,1778 333,1786 333,1794 341,1802 341,1810 "
1528 "341,1818 349,1826 349,1834 357,1842 357,1850 365,1858 365,1866 373,1874 373,1881 381,1889 "
1529 "381,1897 389,1905 389,1905 397,1913 405,1921 405,1929 413,1937 421,1937 421,1945 429,1953 "
1530 "437,1953 445,1961 445,1961 452,1969 460,1977 468,1977 468,1985 476,1985 484,1985 492,1993 "
1531 "500,1993 500,1993 508,2001 516,2001 524,2001 532,2001 540,2008 548,2008 548,2008 556,2008 "
1532 "564,2008 572,2008 2604,2008 2611,2008 2619,2008 2627,2008 2627,2008 2635,2008 2643,2001 "
1533 "2651,2001 2659,2001 2667,2001 2675,1993 2675,1993 2683,1993 2691,1985 2699,1985 2707,1985 "
1534 "2707,1977 2715,1977 2723,1969 2731,1961 2731,1961 2738,1953 2746,1953 2754,1945 2754,1937 "
1535 "2762,1937 2770,1929 2770,1921 2778,1913 2786,1905 2786,1905 2794,1897 2794,1889 2802,1881 "
1536 "2802,1874 2810,1866 2810,1858 2818,1850 2818,1842 2826,1834 2826,1826 2834,1818 2834,1810 "
1537 "2834,1802 2842,1794 2842,1786 2842,1778 2850,1770 2850,1762 2850,1746 2850,1739 2850,1731 "
1538 "2858,1723 2858,1715 2858,1707 2858,1691 2858,1683 2858,1675 2858,1667");
1539 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke/line", "color"_ostr
, "#000000");
1540 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke/line", "width"_ostr
, "143");
1543 CPPUNIT_TEST_FIXTURE(Test
, testStretchDIBWMF
)
1545 // WMF records: STRETCHDIB
1546 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/wmf/data/TestStretchDIB.wmf");
1547 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1548 drawinglayer::Primitive2dXmlDump dumper
;
1549 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1550 CPPUNIT_ASSERT(pDocument
);
1552 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap", "xy11"_ostr
, "12065");
1553 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap", "xy12"_ostr
, "0");
1554 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap", "xy13"_ostr
, "0");
1555 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap", "xy21"_ostr
, "0");
1556 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap", "xy22"_ostr
, "12065");
1557 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap", "xy23"_ostr
, "0");
1559 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap", "height"_ostr
, "10");
1560 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap", "width"_ostr
, "10");
1561 assertXPath(pDocument
, aXPathPrefix
+ "mask/bitmap/data", 10);
1562 assertXPath(pDocument
, aXPathPrefix
+ "/mask/bitmap/data[1]", "row"_ostr
,
1563 "000000,00001c,000038,000055,000071,00008d,0000aa,0000c6,0000e2,0000ff");
1564 assertXPath(pDocument
, aXPathPrefix
+ "/mask/bitmap/data[5]", "row"_ostr
,
1565 "720000,721c1c,723838,725555,727171,72728d,55728d,39728d,1d728d,00728d");
1568 CPPUNIT_TEST_FIXTURE(Test
, testMoveToLineToWMF
)
1570 // tdf#89331 WMF records: MOTETO, LINETO, CREATEPENINDIRECT.
1571 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/wmf/data/TestLineTo.wmf");
1572 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1573 drawinglayer::Primitive2dXmlDump dumper
;
1574 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1575 CPPUNIT_ASSERT(pDocument
);
1577 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonstroke/polygon",
1578 "5856,3586 7167,621 8625,3586");
1579 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke/line", "color"_ostr
, "#800000");
1580 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke/line", "width"_ostr
, "310");
1581 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke/line", "linejoin"_ostr
, "Bevel");
1582 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke/line", "linecap"_ostr
, "ROUND");
1585 CPPUNIT_TEST_FIXTURE(Test
, testPolyLineWidth
)
1587 // EMF import with records: CREATEPEN, ROUNDRECT.
1588 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestPolyLineWidth.emf");
1589 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1590 drawinglayer::Primitive2dXmlDump dumper
;
1591 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1592 CPPUNIT_ASSERT(pDocument
);
1594 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor/polypolygon", "path"_ostr
,
1595 "m530 529 1236-176-707 352z");
1596 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", "color"_ostr
, "#ffff00");
1598 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonstroke/polygon",
1599 "530,529 530,529 1766,353 1059,705");
1600 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke/line", "color"_ostr
, "#000000");
1601 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke/line", "width"_ostr
, "71");
1604 CPPUNIT_TEST_FIXTURE(Test
, testRestoreDC
)
1606 // EMF records: SAVEDC, RESTOREDC, POLYGON16, MODIFYWORLDTRANSFORM
1607 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestRestoreDC.emf");
1608 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1609 drawinglayer::Primitive2dXmlDump dumper
;
1610 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1611 CPPUNIT_ASSERT(pDocument
);
1613 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", "color"_ostr
, "#ff0000");
1614 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor/polypolygon", "path"_ostr
,
1615 "m1148 4354v1481h4943v-1481z");
1616 assertXPath(pDocument
, aXPathPrefix
+ "polygonhairline", "color"_ostr
, "#000000");
1617 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonhairline/polygon",
1618 "1148,4354 1148,5835 6091,5835 6091,4354");
1621 CPPUNIT_TEST_FIXTURE(Test
, testRoundRect
)
1623 // EMF import with records: CREATEPEN, ROUNDRECT.
1624 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestRoundRect.emf");
1625 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1626 drawinglayer::Primitive2dXmlDump dumper
;
1627 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1628 CPPUNIT_ASSERT(pDocument
);
1630 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor", 2);
1631 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]/polypolygon", "path"_ostr
,
1632 "m100 100h4000v2000h-4000z");
1633 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[1]", "color"_ostr
, "#ffffff");
1635 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke", 2);
1636 assertXPathContent(pDocument
, aXPathPrefix
+ "polygonstroke[1]/polygon",
1637 "100,100 4100,100 4100,2100 100,2100");
1638 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke[1]/line", "color"_ostr
, "#ff0000");
1641 pDocument
, aXPathPrefix
+ "polypolygoncolor[2]/polypolygon", "path"_ostr
,
1643 "2700v-30-20l-10-30v-20l-10-30-10-20-10-20-20-30-10-20-20-20-20-20-20-30-20-20-20-20-20-10-"
1644 "30-20-20-20-30-20-30-10-30-10-30-20-30-10-30-10-40-10-30-10h-30l-40-10h-30l-40-10h-30-40-"
1645 "2590-40-30l-40 10h-30l-40 10h-30l-30 10-40 10-30 10-30 10-30 20-30 10-30 10-30 20-20 "
1646 "20-30 20-20 10-20 20-20 20-20 30-20 20-20 20-10 20-20 30-10 20-10 20-10 30v20l-10 30v20 "
1647 "30 990 30 20l10 30v20l10 30 10 20 10 20 20 30 10 20 20 20 20 20 20 30 20 20 20 20 20 10 "
1648 "30 20 20 20 30 20 30 10 30 10 30 20 30 10 30 10 40 10 30 10h30l40 10h30l40 10h30 40 2590 "
1649 "40 30l40-10h30l40-10h30l30-10 40-10 30-10 30-10 30-20 30-10 30-10 30-20 20-20 30-20 20-10 "
1650 "20-20 20-20 20-30 20-20 20-20 10-20 20-30 10-20 10-20 10-30v-20l10-30v-20-30z");
1651 assertXPath(pDocument
, aXPathPrefix
+ "polypolygoncolor[2]", "color"_ostr
, "#ffffff");
1654 pDocument
, aXPathPrefix
+ "polygonstroke[2]/polygon",
1655 "4090,2700 4090,2670 4090,2650 4080,2620 4080,2600 4070,2570 4060,2550 4050,2530 4030,2500 "
1656 "4020,2480 4000,2460 3980,2440 3960,2410 3940,2390 3920,2370 3900,2360 3870,2340 3850,2320 "
1657 "3820,2300 3790,2290 3760,2280 3730,2260 3700,2250 3670,2240 3630,2230 3600,2220 3570,2220 "
1658 "3530,2210 3500,2210 3460,2200 3430,2200 3390,2200 800,2200 760,2200 730,2200 690,2210 "
1659 "660,2210 620,2220 590,2220 560,2230 520,2240 490,2250 460,2260 430,2280 400,2290 370,2300 "
1660 "340,2320 320,2340 290,2360 270,2370 250,2390 230,2410 210,2440 190,2460 170,2480 160,2500 "
1661 "140,2530 130,2550 120,2570 110,2600 110,2620 100,2650 100,2670 100,2700 100,3690 100,3720 "
1662 "100,3740 110,3770 110,3790 120,3820 130,3840 140,3860 160,3890 170,3910 190,3930 210,3950 "
1663 "230,3980 250,4000 270,4020 290,4030 320,4050 340,4070 370,4090 400,4100 430,4110 460,4130 "
1664 "490,4140 520,4150 560,4160 590,4170 620,4170 660,4180 690,4180 730,4190 760,4190 800,4190 "
1665 "3390,4190 3430,4190 3460,4190 3500,4180 3530,4180 3570,4170 3600,4170 3630,4160 3670,4150 "
1666 "3700,4140 3730,4130 3760,4110 3790,4100 3820,4090 3850,4070 3870,4050 3900,4030 3920,4020 "
1667 "3940,4000 3960,3980 3980,3950 4000,3930 4020,3910 4030,3890 4050,3860 4060,3840 4070,3820 "
1668 "4080,3790 4080,3770 4090,3740 4090,3720 4090,3690");
1669 assertXPath(pDocument
, aXPathPrefix
+ "polygonstroke[2]/line", "color"_ostr
, "#ff0000");
1672 CPPUNIT_TEST_FIXTURE(Test
, testCreatePen
)
1674 // Check import of EMF image with records: RESTOREDC, SAVEDC, MOVETOEX, LINETO, POLYLINE16, EXTTEXTOUTW with DxBuffer
1675 // The CREATEPEN record is used with PS_COSMETIC line style, and in this case width must be set to 0
1676 Primitive2DSequence aSequence
= parseEmf(u
"/emfio/qa/cppunit/emf/data/TestCreatePen.emf");
1677 CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence
.getLength()));
1678 drawinglayer::Primitive2dXmlDump dumper
;
1679 xmlDocUniquePtr pDocument
= dumper
.dumpAndParse(Primitive2DContainer(aSequence
));
1680 CPPUNIT_ASSERT(pDocument
);
1682 assertXPath(pDocument
, aXPathPrefix
+ "mask/polypolygon", "path"_ostr
,
1683 "m0 0h31250v18192h-31250z");
1685 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke", 3);
1686 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonstroke[1]/polygon",
1687 "17898,5693 20172,5693");
1688 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[1]/line", "color"_ostr
, "#008000");
1689 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[1]/line", "width"_ostr
, "0");
1691 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonstroke[2]/polygon",
1692 "17898,6959 20172,6959");
1693 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[2]/line", "color"_ostr
, "#000080");
1694 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[2]/line", "width"_ostr
, "0");
1696 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonstroke[3]/polygon",
1697 "17898,7381 20172,7381");
1698 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[3]/line", "color"_ostr
, "#ff0000");
1699 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonstroke[3]/line", "width"_ostr
, "0");
1701 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonhairline", 755);
1702 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonhairline[5]", "color"_ostr
, "#ff0000");
1703 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonhairline[5]/polygon",
1704 "27925,16078 27875,16078");
1705 assertXPath(pDocument
, aXPathPrefix
+ "mask/polygonhairline[10]", "color"_ostr
, "#ff0000");
1706 assertXPathContent(pDocument
, aXPathPrefix
+ "mask/polygonhairline[10]/polygon",
1707 "27925,14180 27875,14180");
1709 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion", 69);
1710 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[1]", "width"_ostr
, "374");
1711 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[1]", "x"_ostr
, "28124");
1712 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[1]", "y"_ostr
, "16581");
1713 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[1]", "text"_ostr
, "0.0");
1714 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[1]", "fontcolor"_ostr
, "#000000");
1716 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[10]", "width"_ostr
, "266");
1717 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[10]", "x"_ostr
, "28000");
1718 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[10]", "y"_ostr
, "428");
1719 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[10]", "text"_ostr
, "-6");
1720 assertXPath(pDocument
, aXPathPrefix
+ "mask/textsimpleportion[10]", "fontcolor"_ostr
,
1723 assertXPath(pDocument
, aXPathPrefix
+ "mask/pointarray", 8);
1724 assertXPath(pDocument
, aXPathPrefix
+ "mask/pointarray[1]", "color"_ostr
, "#008000");
1725 assertXPath(pDocument
, aXPathPrefix
+ "mask/pointarray[1]/point", "x"_ostr
, "25844");
1726 assertXPath(pDocument
, aXPathPrefix
+ "mask/pointarray[1]/point", "y"_ostr
, "8918");
1729 CPPUNIT_TEST_FIXTURE(Test
, testPdfInEmf
)
1731 if (!vcl::pdf::PDFiumLibrary::get())
1736 // Load a PPTX file, which has a shape, with a bitmap fill, which is an EMF, containing a PDF.
1737 loadFromFile(u
"pdf-in-emf.pptx");
1740 uno::Reference
<drawing::XDrawPagesSupplier
> xDrawPagesSupplier(mxComponent
, uno::UNO_QUERY
);
1741 uno::Reference
<drawing::XDrawPage
> xDrawPage(xDrawPagesSupplier
->getDrawPages()->getByIndex(0),
1743 uno::Reference
<beans::XPropertySet
> xShape(xDrawPage
->getByIndex(0), uno::UNO_QUERY
);
1744 uno::Reference
<graphic::XGraphic
> xGraphic
;
1745 xShape
->getPropertyValue("FillBitmap") >>= xGraphic
;
1746 Graphic
aGraphic(xGraphic
);
1748 // Check the size hint of the EMF, which influences the bitmap generated from the PDF.
1749 const std::shared_ptr
<VectorGraphicData
>& pVectorGraphicData
= aGraphic
.getVectorGraphicData();
1751 // Without the accompanying fix in place, this test would have failed with:
1752 // - Expected: 14321
1754 // i.e. there was no size hint, the shape with 14cm height had a bitmap-from-PDF fill, the PDF
1755 // height was only 5cm, so it looked blurry.
1756 // Tolerance was added later based on results on different systems.
1757 CPPUNIT_ASSERT_LESSEQUAL(1.0, abs(14321.0 - pVectorGraphicData
->getSizeHint().getY()));
1759 // Without the accompanying fix in place, this test would have failed with:
1762 // i.e. the pixel in the center was entirely opaque, while it should be transparent.
1763 BitmapEx aBitmapEx
= aGraphic
.GetBitmapEx();
1764 Size size
= aBitmapEx
.GetSizePixel();
1765 CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt8
>(0),
1766 aBitmapEx
.GetAlpha(size
.Width() / 2, size
.Height() / 2));
1769 CPPUNIT_PLUGIN_IMPLEMENT();
1771 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */