1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: basegfx2d.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 // MARKER(update_precomp.py): autogen include statement, do not remove
33 #include "precompiled_basegfx.hxx"
34 // autogenerated file with codegen.pl
36 #include <cppunit/simpleheader.hxx>
38 #include <basegfx/matrix/b2dhommatrix.hxx>
39 #include <basegfx/polygon/b2dpolygon.hxx>
40 #include <basegfx/polygon/b2dpolygontools.hxx>
41 #include <basegfx/curve/b2dcubicbezier.hxx>
42 #include <basegfx/curve/b2dbeziertools.hxx>
43 #include <basegfx/polygon/b2dpolypolygontools.hxx>
44 #include <basegfx/range/b2dmultirange.hxx>
45 #include <basegfx/numeric/ftools.hxx>
46 #include <basegfx/color/bcolor.hxx>
47 #include <basegfx/color/bcolortools.hxx>
49 #include <basegfx/tools/debugplotter.hxx>
54 using namespace ::basegfx
;
59 /// Gets a random ordinal [0,n)
60 inline double getRandomOrdinal( const ::std::size_t n
)
62 return double(n
) * rand() / (RAND_MAX
+ 1.0);
65 class b2dmultirange
: public CppUnit::TestFixture
68 B2DMultiRange aDisjunctRanges
;
69 B2DMultiRange aEqualRanges
;
70 B2DMultiRange aIntersectionN
;
71 B2DMultiRange aIntersectionE
;
72 B2DMultiRange aIntersectionS
;
73 B2DMultiRange aIntersectionW
;
74 B2DMultiRange aIntersectionNE
;
75 B2DMultiRange aIntersectionSE
;
76 B2DMultiRange aIntersectionSW
;
77 B2DMultiRange aIntersectionNW
;
78 B2DMultiRange aRingIntersection
;
79 B2DMultiRange aComplexIntersections
;
80 B2DMultiRange aRandomIntersections
;
83 // initialise your test code values here.
86 B2DRange
aCenter(1.0, 1.0, -1.0, -1.0);
87 B2DRange
aOffside(9.0, 9.0, 11.0, 11.0);
88 B2DRange
aNorth(1.0, 0.0, -1.0, -2.0);
89 B2DRange
aSouth(1.0, 2.0, -1.0, 0.0);
90 B2DRange
aEast(0.0, 1.0, 2.0, -1.0);
91 B2DRange
aWest(-2.0, 1.0, 0.0, -1.0);
92 B2DRange
aNorthEast(0.0, 0.0, 2.0, -2.0);
93 B2DRange
aSouthEast(0.0, 0.0, 2.0, 2.0);
94 B2DRange
aSouthWest(0.0, 0.0, -2.0, 2.0);
95 B2DRange
aNorthWest(0.0, 0.0, -2.0, -2.0);
97 B2DRange
aNorth2(-1.5, 0.5, 1.5, 3.5);
98 B2DRange
aSouth2(-1.5, -0.5, 1.5, -3.5);
99 B2DRange
aEast2 (0.5, -1.5, 3.5, 1.5);
100 B2DRange
aWest2 (-0.5, -1.5,-3.5, 1.5);
102 ::std::ofstream
output("multirange_testcases.gnuplot");
103 DebugPlotter
aPlotter( "multirange testcases",
106 aPlotter
.plot( aCenter
, "center" );
107 aPlotter
.plot( aOffside
, "offside" );
108 aPlotter
.plot( aNorth
, "north" );
109 aPlotter
.plot( aSouth
, "south" );
110 aPlotter
.plot( aEast
, "east" );
111 aPlotter
.plot( aWest
, "west" );
112 aPlotter
.plot( aNorthEast
, "northeast" );
113 aPlotter
.plot( aSouthEast
, "southeast" );
114 aPlotter
.plot( aSouthWest
, "southwest" );
115 aPlotter
.plot( aNorthWest
, "northwest" );
117 aDisjunctRanges
.addRange( aCenter
);
118 aDisjunctRanges
.addRange( aOffside
);
120 aEqualRanges
.addRange( aCenter
);
121 aEqualRanges
.addRange( aCenter
);
123 aIntersectionN
.addRange( aCenter
);
124 aIntersectionN
.addRange( aNorth
);
126 aIntersectionE
.addRange( aCenter
);
127 aIntersectionE
.addRange( aEast
);
129 aIntersectionS
.addRange( aCenter
);
130 aIntersectionS
.addRange( aSouth
);
132 aIntersectionW
.addRange( aCenter
);
133 aIntersectionW
.addRange( aWest
);
135 aIntersectionNE
.addRange( aCenter
);
136 aIntersectionNE
.addRange( aNorthEast
);
138 aIntersectionSE
.addRange( aCenter
);
139 aIntersectionSE
.addRange( aSouthEast
);
141 aIntersectionSW
.addRange( aCenter
);
142 aIntersectionSW
.addRange( aSouthWest
);
144 aIntersectionNW
.addRange( aCenter
);
145 aIntersectionNW
.addRange( aNorthWest
);
147 aRingIntersection
.addRange( aNorth2
);
148 aRingIntersection
.addRange( aEast2
);
149 aRingIntersection
.addRange( aSouth2
);
150 aRingIntersection
.addRange( aWest2
);
152 aComplexIntersections
.addRange( aCenter
);
153 aComplexIntersections
.addRange( aOffside
);
154 aComplexIntersections
.addRange( aCenter
);
155 aComplexIntersections
.addRange( aNorth
);
156 aComplexIntersections
.addRange( aEast
);
157 aComplexIntersections
.addRange( aSouth
);
158 aComplexIntersections
.addRange( aWest
);
159 aComplexIntersections
.addRange( aNorthEast
);
160 aComplexIntersections
.addRange( aSouthEast
);
161 aComplexIntersections
.addRange( aSouthWest
);
162 aComplexIntersections
.addRange( aNorthWest
);
165 for( int i=0; i<10; ++i )
167 B2DRange aRandomRange(
168 getRandomOrdinal( 10 ),
169 getRandomOrdinal( 10 ),
170 getRandomOrdinal( 10 ),
171 getRandomOrdinal( 10 ) );
173 aRandomIntersections.addRange( aRandomRange );
182 ::basegfx::B2DPolyPolygon
shiftPoly( int nCount
,
183 const ::basegfx::B2DPolyPolygon
& rPoly
)
185 B2DHomMatrix aMatrix
;
186 aMatrix
.translate( nCount
*4.0,
189 ::basegfx::B2DPolyPolygon
aRes( rPoly
);
190 aRes
.transform( aMatrix
);
195 void getPolyPolygon()
197 ::std::ofstream
output("multirange_getpolypolygon.gnuplot");
198 DebugPlotter
aPlotter( "multirange getPolyPolygon",
201 B2DPolyPolygon result
;
203 aPlotter
.plot( shiftPoly(
205 aDisjunctRanges
.getPolyPolygon() ),
207 aPlotter
.plot( shiftPoly(
209 aEqualRanges
.getPolyPolygon() ),
211 aPlotter
.plot( shiftPoly(
213 aIntersectionN
.getPolyPolygon() ),
215 aPlotter
.plot( shiftPoly(
217 aIntersectionE
.getPolyPolygon() ),
219 aPlotter
.plot( shiftPoly(
221 aIntersectionS
.getPolyPolygon() ),
223 aPlotter
.plot( shiftPoly(
225 aIntersectionW
.getPolyPolygon() ),
227 aPlotter
.plot( shiftPoly(
229 aIntersectionNE
.getPolyPolygon() ),
231 aPlotter
.plot( shiftPoly(
233 aIntersectionSE
.getPolyPolygon() ),
235 aPlotter
.plot( shiftPoly(
237 aIntersectionSW
.getPolyPolygon() ),
239 aPlotter
.plot( shiftPoly(
241 aIntersectionNW
.getPolyPolygon() ),
243 aPlotter
.plot( shiftPoly(
245 aRingIntersection
.getPolyPolygon() ),
246 "intersection ring" );
247 aPlotter
.plot( shiftPoly(
249 aComplexIntersections
.getPolyPolygon() ),
250 "intersection complex" );
251 aPlotter
.plot( shiftPoly(
253 aRandomIntersections
.getPolyPolygon() ),
254 "intersection random" );
256 CPPUNIT_ASSERT_MESSAGE("getPolyPolygon", true );
259 // Change the following lines only, if you add, remove or rename
260 // member functions of the current class,
261 // because these macros are need by auto register mechanism.
263 CPPUNIT_TEST_SUITE(b2dmultirange
);
264 CPPUNIT_TEST(getPolyPolygon
);
265 CPPUNIT_TEST_SUITE_END();
266 }; // class b2dmultirange
268 class b2dsvgdimpex
: public CppUnit::TestFixture
271 ::rtl::OUString aPath0
;
272 ::rtl::OUString aPath1
;
273 ::rtl::OUString aPath2
;
274 ::rtl::OUString aPath3
;
277 // initialise your test code values here.
281 aPath0
= ::rtl::OUString::createFromAscii(
282 "M 10 10-10 10-10-10 10-10Z" );
284 // simple bezier polygon
285 aPath1
= ::rtl::OUString::createFromAscii(
286 "m11430 0c-8890 3810 5715 6985 5715 6985 "
287 "0 0-17145-1905-17145-1905 0 0 22860-10160 "
288 "16510 6350-6350 16510-3810-11430-3810-11430z" );
290 // '@' as a bezier polygon
291 aPath2
= ::rtl::OUString::createFromAscii(
292 "m1917 1114c-89-189-233-284-430-284-167 "
293 "0-306 91-419 273-113 182-170 370-170 564 "
294 "0 145 33 259 98 342 65 84 150 126 257 126 "
295 "77 0 154-19 231-57 77-38 147-97 210-176 63"
296 "-79 99-143 109-190 38-199 76-398 114-598z"
297 "m840 1646c-133 73-312 139-537 197-225 57"
298 "-440 86-644 87-483-1-866-132-1150-392-284"
299 "-261-426-619-426-1076 0-292 67-560 200-803 "
300 "133-243 321-433 562-569 241-136 514-204 821"
301 "-204 405 0 739 125 1003 374 264 250 396 550 "
302 "396 899 0 313-88 576-265 787-177 212-386 318"
303 "-627 318-191 0-308-94-352-281-133 187-315 281"
304 "-546 281-172 0-315-67-428-200-113-133-170-301"
305 "-170-505 0-277 90-527 271-751 181-223 394"
306 "-335 640-335 196 0 353 83 470 250 13-68 26"
307 "-136 41-204 96 0 192 0 288 0-74 376-148 752"
308 "-224 1128-21 101-31 183-31 245 0 39 9 70 26 "
309 "93 17 24 39 36 67 36 145 0 279-80 400-240 121"
310 "-160 182-365 182-615 0-288-107-533-322-734"
311 "-215-201-487-301-816-301-395 0-715 124-960 "
312 "373-245 249-368 569-368 958 0 385 119 685 "
313 "357 900 237 216 557 324 958 325 189-1 389-27 "
314 "600-77 211-52 378-110 503-174 27 70 54 140 81 210z" );
316 // first part of 'Hello World' as a line polygon
317 aPath3
= ::rtl::OUString::createFromAscii(
318 "m1598 125h306v2334h-306v-1105h-1293v1105h-305v"
319 "-2334h305v973h1293zm2159 1015 78-44 85 235-91 "
320 "47-91 40-90 34-90 29-89 21-88 16-88 10-88 3-102"
321 "-4-97-12-91-19-85-26-40-16-39-18-38-20-36-22-34"
322 "-24-33-26-32-27-30-30-29-31-27-33-25-33-23-36-21"
323 "-36-19-38-18-40-16-40-26-86-18-91-11-97-4-103 3"
324 "-98 11-94 17-89 24-84 31-79 37-75 22-35 23-34 24"
325 "-33 27-32 28-30 29-28 31-27 31-24 33-22 34-21 35"
326 "-18 37-17 38-14 38-13 41-11 41-8 86-12 91-4 82 4 "
327 "78 10 37 9 37 9 36 12 35 14 33 15 33 17 32 19 31 "
328 "21 30 22 30 25 55 54 26 29 24 31 22 32 21 33 19 "
329 "34 18 36 30 74 23 80 17 84 10 89 3 94v78h-1277l6 "
330 "75 10 70 14 66 19 62 23 57 13 26 14 26 15 25 17 "
331 "23 17 22 19 21 19 20 21 18 21 18 23 16 23 14 24 "
332 "14 26 12 26 11 27 10 28 8 59 13 63 7 67 3 80-3 81"
333 "-9 79-14 80-21 78-26 79-32zm-1049-808-12 53h963l"
334 "-7-51-11-49-14-46-17-43-21-40-24-38-27-36-31-32"
335 "-33-29-35-25-37-22-38-17-40-14-41-9-42-6-44-2-48 "
336 "2-46 6-44 9-42 13-40 17-38 21-36 24-34 28-32 32"
337 "-29 34-26 38-23 41-20 44-17 47zm1648-1293h288v"
338 "2459h-288zm752-2459h288v2459h-288zm1286-1750 86-11 "
339 "91-4 91 4 85 12 42 8 39 11 39 13 38 14 36 17 35 18 "
340 "34 20 33 23 31 24 30 26 29 28 28 30 26 32 25 33 23 "
341 "34 21 35 37 75 31 80 24 84 16 90 11 94 3 100-3 100"
342 "-11 95-16 89-24 85-31 80-37 74-21 35-23 35-25 32-26 "
343 "32-28 30-29 28-30 26-31 24-33 22-34 21-35 18-36 17"
344 "-38 14-39 13-39 10-42 9-85 12-91 4-91-4-86-12-41-9"
345 "-40-10-39-13-37-14-36-17-35-18-34-21-33-22-31-24-30"
346 "-26-29-28-28-30-26-32-25-32-23-35-21-35-38-74-30-80"
347 "-24-85-17-89-11-95-3-100 3-101 11-95 17-90 24-85 30"
348 "-79 38-75 21-35 23-35 25-32 26-32 28-30 29-28 30-26 "
349 "31-24 33-22 34-20 35-18 36-16 37-15 39-12 40-11z" );
358 B2DPolyPolygon aPoly
;
359 ::rtl::OUString aExport
;
361 CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D",
362 tools::importFromSvgD( aPoly
,
364 aExport
= tools::exportToSvgD( aPoly
);
365 const char* sExportString
= "m10 10h-20v-20h20z";
366 CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D",
367 !aExport
.compareToAscii(sExportString
) );
368 CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D (round-trip",
369 tools::importFromSvgD( aPoly
,
371 aExport
= tools::exportToSvgD( aPoly
);
372 CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D (round-trip)",
373 !aExport
.compareToAscii(sExportString
));
375 CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D",
376 tools::importFromSvgD( aPoly
,
378 aExport
= tools::exportToSvgD( aPoly
);
380 // Adaptions for B2DPolygon bezier change (see #i77162#):
382 // The import/export of aPath1 does not reproduce aExport again. This is
383 // correct since aPath1 contains a segment with non-used control points
384 // which gets exported now correctly as 'l' and also a point (#4, index 3)
385 // with C2 continuity which produces a 's' staement now.
387 // The old SVGexport identified nun-used ControlVectors erraneously as bezier segments
388 // because the 2nd vector at the start point was used, even when added
389 // with start point was identical to end point. Exactly for that reason
390 // i reworked the B2DPolygon to use prev, next control points.
392 // so for correct unit test i add the new exported string here as sExportStringSimpleBezier
393 // and compare to it.
394 const char* sExportStringSimpleBezier
=
395 "m11430 0c-8890 3810 5715 6985 5715 6985"
396 "l-17145-1905c0 0 22860-10160 16510 6350"
397 "s-3810-11430-3810-11430z";
398 CPPUNIT_ASSERT_MESSAGE("exporting bezier polygon to SVG-D", !aExport
.compareToAscii(sExportStringSimpleBezier
));
400 // Adaptions for B2DPolygon bezier change (see #i77162#):
402 // a 2nd good test is that re-importing of aExport has to create the same
403 // B2DPolPolygon again:
404 B2DPolyPolygon aReImport
;
405 CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D", tools::importFromSvgD( aReImport
, aExport
));
406 CPPUNIT_ASSERT_MESSAGE("re-imported polygon needs to be identical", aReImport
== aPoly
);
408 CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D", tools::importFromSvgD( aPoly
, aPath2
));
409 aExport
= tools::exportToSvgD( aPoly
);
411 // Adaptions for B2DPolygon bezier change (see #i77162#):
413 // same here, the corrected export with the corrected B2DPolygon is simply more efficient,
414 // so i needed to change the compare string. Also adding the re-import comparison below.
415 const char* sExportString1
=
416 "m1917 1114c-89-189-233-284-430-284-167 0-306 91-419 273s-170 370-17"
417 "0 564c0 145 33 259 98 342 65 84 150 126 257 126q115.5 0 231-57s147-97 210-176 99-143 109-190c38-199 76-398 114"
418 "-598zm840 1646c-133 73-312 139-537 197-225 57-440 86-644 87-483-1-866-132-1150-392-284-261-426-619-426-1076 0-"
419 "292 67-560 200-803s321-433 562-569 514-204 821-204c405 0 739 125 1003 374 264 250 396 550 396 899 0 313-88 576"
420 "-265 787q-265.5 318-627 318c-191 0-308-94-352-281-133 187-315 281-546 281-172 0-315-67-428-200s-170-301-170-50"
421 "5c0-277 90-527 271-751 181-223 394-335 640-335 196 0 353 83 470 250 13-68 26-136 41-204q144 0 288 0c-74 376-14"
422 "8 752-224 1128-21 101-31 183-31 245 0 39 9 70 26 93 17 24 39 36 67 36 145 0 279-80 400-240s182-365 182-615c0-2"
423 "88-107-533-322-734s-487-301-816-301c-395 0-715 124-960 373s-368 569-368 958q0 577.5 357 900c237 216 557 324 95"
424 "8 325 189-1 389-27 600-77 211-52 378-110 503-174q40.5 105 81 210z";
425 CPPUNIT_ASSERT_MESSAGE("re-importing '@' from SVG-D", tools::importFromSvgD( aReImport
, aExport
));
426 CPPUNIT_ASSERT_MESSAGE("re-imported '@' needs to be identical", aReImport
== aPoly
);
428 CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D", !aExport
.compareToAscii(sExportString1
));
429 CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D (round-trip",
430 tools::importFromSvgD( aPoly
,
432 aExport
= tools::exportToSvgD( aPoly
);
433 CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D (round-trip)",
434 !aExport
.compareToAscii(sExportString1
));
437 CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D",
438 tools::importFromSvgD( aPoly
,
440 aExport
= tools::exportToSvgD( aPoly
);
441 const char* sExportString2
=
442 "m1598 125h306v2334h-306v-1105h-1293v1105h-305v-2334h305v973h1293"
443 "zm2159 1015 78-44 85 235-91 47-91 40-90 34-90 29-89 21-88 16-88 10-88 3-102-4-97"
444 "-12-91-19-85-26-40-16-39-18-38-20-36-22-34-24-33-26-32-27-30-30-29-31-27-33-25-3"
445 "3-23-36-21-36-19-38-18-40-16-40-26-86-18-91-11-97-4-103 3-98 11-94 17-89 24-84 3"
446 "1-79 37-75 22-35 23-34 24-33 27-32 28-30 29-28 31-27 31-24 33-22 34-21 35-18 37-"
447 "17 38-14 38-13 41-11 41-8 86-12 91-4 82 4 78 10 37 9 37 9 36 12 35 14 33 15 33 1"
448 "7 32 19 31 21 30 22 30 25 55 54 26 29 24 31 22 32 21 33 19 34 18 36 30 74 23 80 "
449 "17 84 10 89 3 94v78h-1277l6 75 10 70 14 66 19 62 23 57 13 26 14 26 15 25 17 23 1"
450 "7 22 19 21 19 20 21 18 21 18 23 16 23 14 24 14 26 12 26 11 27 10 28 8 59 13 63 7"
451 " 67 3 80-3 81-9 79-14 80-21 78-26 79-32zm-1049-808-12 53h963l-7-51-11-49-14-46-1"
452 "7-43-21-40-24-38-27-36-31-32-33-29-35-25-37-22-38-17-40-14-41-9-42-6-44-2-48 2-4"
453 "6 6-44 9-42 13-40 17-38 21-36 24-34 28-32 32-29 34-26 38-23 41-20 44-17 47zm1648"
454 "-1293h288v2459h-288zm752-2459h288v2459h-288zm1286-1750 86-11 91-4 91 4 85 12 42 "
455 "8 39 11 39 13 38 14 36 17 35 18 34 20 33 23 31 24 30 26 29 28 28 30 26 32 25 33 "
456 "23 34 21 35 37 75 31 80 24 84 16 90 11 94 3 100-3 100-11 95-16 89-24 85-31 80-37"
457 " 74-21 35-23 35-25 32-26 32-28 30-29 28-30 26-31 24-33 22-34 21-35 18-36 17-38 1"
458 "4-39 13-39 10-42 9-85 12-91 4-91-4-86-12-41-9-40-10-39-13-37-14-36-17-35-18-34-2"
459 "1-33-22-31-24-30-26-29-28-28-30-26-32-25-32-23-35-21-35-38-74-30-80-24-85-17-89-"
460 "11-95-3-100 3-101 11-95 17-90 24-85 30-79 38-75 21-35 23-35 25-32 26-32 28-30 29"
461 "-28 30-26 31-24 33-22 34-20 35-18 36-16 37-15 39-12 40-11z";
462 CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D",
463 !aExport
.compareToAscii(sExportString2
));
464 CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D (round-trip",
465 tools::importFromSvgD( aPoly
,
467 aExport
= tools::exportToSvgD( aPoly
);
468 CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D (round-trip)",
469 !aExport
.compareToAscii(sExportString2
));
471 const B2DPolygon
aCircle(
472 tools::createPolygonFromEllipse( B2DPoint(4000,4000),
474 aExport
= tools::exportToSvgD( B2DPolyPolygon(aCircle
), false, false);
476 // count number of spaces, in lieu of a better way - no real
477 // point in comparing with a gold standard, as fractional
478 // parts of the coordinates will differ between systems.
479 sal_Int32 nIndex
=0, nCount
=0;
482 rtl::OUString aToken
= aExport
.getToken( 0, ' ', nIndex
);
485 while ( nIndex
>= 0 );
487 CPPUNIT_ASSERT_MESSAGE("exporting to circle does not produce the expected number of coordinates",
490 const B2DPolygon
aRect(
491 tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) ));
492 aExport
= tools::exportToSvgD( B2DPolyPolygon(aRect
), false, false);
494 const char* sExportStringRect
= "M0 0H4000V4000H0Z";
495 CPPUNIT_ASSERT_MESSAGE("exporting to rectangle svg-d string",
496 !aExport
.compareToAscii(sExportStringRect
));
499 // Change the following lines only, if you add, remove or rename
500 // member functions of the current class,
501 // because these macros are need by auto register mechanism.
503 CPPUNIT_TEST_SUITE(b2dsvgdimpex
);
505 CPPUNIT_TEST_SUITE_END();
506 }; // class b2dsvgdimpex
508 class b2dbeziertools
: public CppUnit::TestFixture
511 B2DCubicBezier aHalfCircle
; // not exactly, but a look-alike
512 B2DCubicBezier aQuarterCircle
; // not exactly, but a look-alike
513 B2DCubicBezier aLoop
; // identical endpoints, curve goes back to where it started
514 B2DCubicBezier aStraightLineDistinctEndPoints
; // truly a line
515 B2DCubicBezier aStraightLineDistinctEndPoints2
; // truly a line, with slightly different control points
516 B2DCubicBezier aStraightLineIdenticalEndPoints
; // degenerate case of aLoop
517 B2DCubicBezier aStraightLineIdenticalEndPoints2
;// degenerate case of aLoop, with slightly different control points
518 B2DCubicBezier aCrossing
; // curve self-intersects somewhere in the middle
519 B2DCubicBezier aCusp
; // curve has a point of undefined tangency
523 // initialise your test code values here.
526 const B2DPoint
a00(0.0, 0.0);
527 const B2DPoint
a10(1.0, 0.0);
528 const B2DPoint
a11(1.0, 1.0);
529 const B2DPoint
a01(0.0, 1.0);
530 const B2DPoint
middle( 0.5, 0.5 );
531 const B2DPoint
quarterDown( 0.25, 0.25 );
532 const B2DPoint
quarterUp( 0.75, 0.75 );
534 aHalfCircle
= B2DCubicBezier(a00
, a01
, a11
, a10
);
536 // The spline control points become
538 // (R * cos(A), R * sin(A))
539 // (R * cos(A) - h * sin(A), R * sin(A) + h * cos (A))
540 // (R * cos(B) + h * sin(B), R * sin(B) - h * cos (B))
541 // (R * cos(B), R * sin(B))
543 // where h = 4/3 * R * tan ((B-A)/4)
545 // with R being the radius, A start angle and B end angle (A < B).
547 // (This calculation courtesy Carl Worth, himself based on
548 // Michael Goldapp and Dokken/Daehlen)
550 // Choosing R=1, A=0, B=pi/2
551 const double h( 4.0/3.0 * tan(M_PI
/8.0) );
552 aQuarterCircle
= B2DCubicBezier(a10
+ B2DPoint(1.0,0.0),
553 B2DPoint(B2DPoint( 1.0, h
) + B2DPoint(1.0,0.0)),
554 B2DPoint(B2DPoint( h
, 1.0) + B2DPoint(1.0,0.0)),
555 a01
+ B2DPoint(1.0,0.0));
557 aCusp
= B2DCubicBezier(a00
+ B2DPoint(2.0,0.0),
558 B2DPoint(a11
+ B2DPoint(2.0,0.0)),
559 B2DPoint(a01
+ B2DPoint(2.0,0.0)),
560 a10
+ B2DPoint(2.0,0.0));
562 aLoop
= B2DCubicBezier(a00
+ B2DPoint(3.0,0.0),
563 B2DPoint(a01
+ B2DPoint(3.0,0.0)),
564 B2DPoint(a10
+ B2DPoint(3.0,0.0)),
565 a00
+ B2DPoint(3.0,0.0));
567 aStraightLineDistinctEndPoints
= B2DCubicBezier(a00
+ B2DPoint(4.0,0.0),
568 B2DPoint(middle
+ B2DPoint(4.0,0.0)),
569 B2DPoint(middle
+ B2DPoint(4.0,0.0)),
570 a11
+ B2DPoint(4.0,0.0));
572 aStraightLineDistinctEndPoints2
= B2DCubicBezier(a00
+ B2DPoint(5.0,0.0),
573 B2DPoint(quarterDown
+ B2DPoint(5.0,0.0)),
574 B2DPoint(quarterUp
+ B2DPoint(5.0,0.0)),
575 a11
+ B2DPoint(5.0,0.0));
577 aStraightLineIdenticalEndPoints
= B2DCubicBezier(a00
+ B2DPoint(6.0,0.0),
578 B2DPoint(a11
+ B2DPoint(6.0,0.0)),
579 B2DPoint(a11
+ B2DPoint(6.0,0.0)),
580 a00
+ B2DPoint(6.0,0.0));
582 aStraightLineIdenticalEndPoints2
= B2DCubicBezier(a00
+ B2DPoint(7.0,0.0),
583 B2DPoint(quarterDown
+ B2DPoint(7.0,0.0)),
584 B2DPoint(quarterUp
+ B2DPoint(7.0,0.0)),
585 a00
+ B2DPoint(7.0,0.0));
587 aCrossing
= B2DCubicBezier(a00
+ B2DPoint(8.0,0.0),
588 B2DPoint(B2DPoint(2.0,2.0) + B2DPoint(8.0,0.0)),
589 B2DPoint(B2DPoint(-1.0,2.0) + B2DPoint(8.0,0.0)),
590 a10
+ B2DPoint(8.0,0.0));
592 ::std::ofstream
output("bez_testcases.gnuplot");
593 DebugPlotter
aPlotter( "Original curves",
596 aPlotter
.plot( aHalfCircle
,
598 aPlotter
.plot( aQuarterCircle
,
600 aPlotter
.plot( aCusp
,
602 aPlotter
.plot( aLoop
,
604 aPlotter
.plot( aStraightLineDistinctEndPoints
,
606 aPlotter
.plot( aStraightLineDistinctEndPoints2
,
608 aPlotter
.plot( aStraightLineIdenticalEndPoints
,
610 aPlotter
.plot( aStraightLineIdenticalEndPoints2
,
612 aPlotter
.plot( aCrossing
,
615 // break up a complex bezier (loopy, spiky or self intersecting)
616 // into simple segments (left to right)
617 B2DCubicBezier aSegment
= aCrossing
;
618 double fExtremePos(0.0);
620 aPlotter
.plot( aSegment
, "segment" );
621 while(aSegment
.getMinimumExtremumPosition(fExtremePos
))
623 aSegment
.split(fExtremePos
, 0, &aSegment
);
624 aPlotter
.plot( aSegment
, "segment" );
632 void adaptiveByDistance()
634 ::std::ofstream
output("bez_adaptiveByDistance.gnuplot");
635 DebugPlotter
aPlotter( "distance-adaptive subdivision",
638 const double fBound( 0.0001 );
641 aHalfCircle
.adaptiveSubdivideByDistance(result
, fBound
);
642 aPlotter
.plot(result
,
643 "half circle"); result
.clear();
645 aQuarterCircle
.adaptiveSubdivideByDistance(result
, fBound
);
646 aPlotter
.plot(result
,
647 "quarter circle"); result
.clear();
649 aLoop
.adaptiveSubdivideByDistance(result
, fBound
);
650 aPlotter
.plot(result
,
651 "loop"); result
.clear();
653 aStraightLineDistinctEndPoints
.adaptiveSubdivideByDistance(result
, fBound
);
654 aPlotter
.plot(result
,
655 "straight line 0"); result
.clear();
657 aStraightLineDistinctEndPoints2
.adaptiveSubdivideByDistance(result
, fBound
);
658 aPlotter
.plot(result
,
659 "straight line 1"); result
.clear();
661 aStraightLineIdenticalEndPoints
.adaptiveSubdivideByDistance(result
, fBound
);
662 aPlotter
.plot(result
,
663 "straight line 2"); result
.clear();
665 aStraightLineIdenticalEndPoints2
.adaptiveSubdivideByDistance(result
, fBound
);
666 aPlotter
.plot(result
,
667 "straight line 3"); result
.clear();
669 aCrossing
.adaptiveSubdivideByDistance(result
, fBound
);
670 aPlotter
.plot(result
,
671 "straight line 4"); result
.clear();
673 aCusp
.adaptiveSubdivideByDistance(result
, fBound
);
674 aPlotter
.plot(result
,
675 "straight line 5"); result
.clear();
677 CPPUNIT_ASSERT_MESSAGE("adaptiveByDistance", true );
680 void adaptiveByAngle()
682 const double fBound( 5.0 );
685 ::std::ofstream
output("bez_adaptiveByAngle.gnuplot");
686 DebugPlotter
aPlotter( "angle-adaptive subdivision",
689 aHalfCircle
.adaptiveSubdivideByAngle(result
, fBound
, true);
690 aPlotter
.plot(result
,
691 "half circle"); result
.clear();
693 aQuarterCircle
.adaptiveSubdivideByAngle(result
, fBound
, true);
694 aPlotter
.plot(result
,
695 "quarter cirle"); result
.clear();
697 aLoop
.adaptiveSubdivideByAngle(result
, fBound
, true);
698 aPlotter
.plot(result
,
699 "loop"); result
.clear();
701 aStraightLineDistinctEndPoints
.adaptiveSubdivideByAngle(result
, fBound
, true);
702 aPlotter
.plot(result
,
703 "straight line 0"); result
.clear();
705 aStraightLineDistinctEndPoints2
.adaptiveSubdivideByAngle(result
, fBound
, true);
706 aPlotter
.plot(result
,
707 "straight line 1"); result
.clear();
709 aStraightLineIdenticalEndPoints
.adaptiveSubdivideByAngle(result
, fBound
, true);
710 aPlotter
.plot(result
,
711 "straight line 2"); result
.clear();
713 aStraightLineIdenticalEndPoints2
.adaptiveSubdivideByAngle(result
, fBound
, true);
714 aPlotter
.plot(result
,
715 "straight line 3"); result
.clear();
717 aCrossing
.adaptiveSubdivideByAngle(result
, fBound
, true);
718 aPlotter
.plot(result
,
719 "straight line 4"); result
.clear();
721 aCusp
.adaptiveSubdivideByAngle(result
, fBound
, true);
722 aPlotter
.plot(result
,
723 "straight line 5"); result
.clear();
725 CPPUNIT_ASSERT_MESSAGE("adaptiveByAngle", true );
728 // Change the following lines only, if you add, remove or rename
729 // member functions of the current class,
730 // because these macros are need by auto register mechanism.
732 CPPUNIT_TEST_SUITE(b2dbeziertools
);
733 CPPUNIT_TEST(adaptiveByDistance
); // TODO: add tests for quadratic bezier (subdivide and degree reduction)
734 CPPUNIT_TEST(adaptiveByAngle
);
735 CPPUNIT_TEST_SUITE_END();
736 }; // class b2dcubicbezier
739 class b2dcubicbezier
: public CppUnit::TestFixture
742 // initialise your test code values here.
751 // insert your test code here.
754 // this is demonstration code
755 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
756 CPPUNIT_ASSERT_STUB();
759 // Change the following lines only, if you add, remove or rename
760 // member functions of the current class,
761 // because these macros are need by auto register mechanism.
763 CPPUNIT_TEST_SUITE(b2dcubicbezier
);
764 CPPUNIT_TEST(EmptyMethod
);
765 CPPUNIT_TEST_SUITE_END();
766 }; // class b2dcubicbezier
769 class b2dhommatrix
: public CppUnit::TestFixture
772 B2DHomMatrix maIdentity
;
773 B2DHomMatrix maScale
;
774 B2DHomMatrix maTranslate
;
775 B2DHomMatrix maShear
;
776 B2DHomMatrix maAffine
;
777 B2DHomMatrix maPerspective
;
780 // initialise your test code values here.
783 // setup some test matrices
784 maIdentity
.identity(); // force compact layout
785 maIdentity
.set(0,0, 1.0);
786 maIdentity
.set(0,1, 0.0);
787 maIdentity
.set(0,2, 0.0);
788 maIdentity
.set(1,0, 0.0);
789 maIdentity
.set(1,1, 1.0);
790 maIdentity
.set(1,2, 0.0);
792 maScale
.identity(); // force compact layout
793 maScale
.set(0,0, 2.0);
794 maScale
.set(1,1, 20.0);
796 maTranslate
.identity(); // force compact layout
797 maTranslate
.set(0,2, 20.0);
798 maTranslate
.set(1,2, 2.0);
800 maShear
.identity(); // force compact layout
801 maShear
.set(0,1, 3.0);
802 maShear
.set(1,0, 7.0);
803 maShear
.set(1,1, 22.0);
805 maAffine
.identity(); // force compact layout
806 maAffine
.set(0,0, 1.0);
807 maAffine
.set(0,1, 2.0);
808 maAffine
.set(0,2, 3.0);
809 maAffine
.set(1,0, 4.0);
810 maAffine
.set(1,1, 5.0);
811 maAffine
.set(1,2, 6.0);
813 maPerspective
.set(0,0, 1.0);
814 maPerspective
.set(0,1, 2.0);
815 maPerspective
.set(0,2, 3.0);
816 maPerspective
.set(1,0, 4.0);
817 maPerspective
.set(1,1, 5.0);
818 maPerspective
.set(1,2, 6.0);
819 maPerspective
.set(2,0, 7.0);
820 maPerspective
.set(2,1, 8.0);
821 maPerspective
.set(2,2, 9.0);
830 B2DHomMatrix aIdentity
;
832 B2DHomMatrix aTranslate
;
834 B2DHomMatrix aAffine
;
835 B2DHomMatrix aPerspective
;
837 // setup some test matrices
838 aIdentity
.identity(); // force compact layout
839 aIdentity
.set(0,0, 1.0);
840 aIdentity
.set(0,1, 0.0);
841 aIdentity
.set(0,2, 0.0);
842 aIdentity
.set(1,0, 0.0);
843 aIdentity
.set(1,1, 1.0);
844 aIdentity
.set(1,2, 0.0);
846 aScale
.identity(); // force compact layout
847 aScale
.set(0,0, 2.0);
848 aScale
.set(1,1, 20.0);
850 aTranslate
.identity(); // force compact layout
851 aTranslate
.set(0,2, 20.0);
852 aTranslate
.set(1,2, 2.0);
854 aShear
.identity(); // force compact layout
855 aShear
.set(0,1, 3.0);
856 aShear
.set(1,0, 7.0);
857 aShear
.set(1,1, 22.0);
859 aAffine
.identity(); // force compact layout
860 aAffine
.set(0,0, 1.0);
861 aAffine
.set(0,1, 2.0);
862 aAffine
.set(0,2, 3.0);
863 aAffine
.set(1,0, 4.0);
864 aAffine
.set(1,1, 5.0);
865 aAffine
.set(1,2, 6.0);
867 aPerspective
.set(0,0, 1.0);
868 aPerspective
.set(0,1, 2.0);
869 aPerspective
.set(0,2, 3.0);
870 aPerspective
.set(1,0, 4.0);
871 aPerspective
.set(1,1, 5.0);
872 aPerspective
.set(1,2, 6.0);
873 aPerspective
.set(2,0, 7.0);
874 aPerspective
.set(2,1, 8.0);
875 aPerspective
.set(2,2, 9.0);
877 CPPUNIT_ASSERT_MESSAGE("operator==: identity matrix", aIdentity
== maIdentity
);
878 CPPUNIT_ASSERT_MESSAGE("operator==: scale matrix", aScale
== maScale
);
879 CPPUNIT_ASSERT_MESSAGE("operator==: translate matrix", aTranslate
== maTranslate
);
880 CPPUNIT_ASSERT_MESSAGE("operator==: shear matrix", aShear
== maShear
);
881 CPPUNIT_ASSERT_MESSAGE("operator==: affine matrix", aAffine
== maAffine
);
882 CPPUNIT_ASSERT_MESSAGE("operator==: perspective matrix", aPerspective
== maPerspective
);
889 CPPUNIT_ASSERT_MESSAGE("identity", maIdentity
== ident
);
896 CPPUNIT_ASSERT_MESSAGE("scale", maScale
== mat
);
902 mat
.translate(20.0,2.0);
903 CPPUNIT_ASSERT_MESSAGE("translate", maTranslate
== mat
);
911 CPPUNIT_ASSERT_MESSAGE("translate", maShear
== mat
);
916 B2DHomMatrix affineAffineProd
;
918 affineAffineProd
.set(0,0, 9);
919 affineAffineProd
.set(0,1, 12);
920 affineAffineProd
.set(0,2, 18);
921 affineAffineProd
.set(1,0, 24);
922 affineAffineProd
.set(1,1, 33);
923 affineAffineProd
.set(1,2, 48);
925 B2DHomMatrix affinePerspectiveProd
;
927 affinePerspectiveProd
.set(0,0, 30);
928 affinePerspectiveProd
.set(0,1, 36);
929 affinePerspectiveProd
.set(0,2, 42);
930 affinePerspectiveProd
.set(1,0, 66);
931 affinePerspectiveProd
.set(1,1, 81);
932 affinePerspectiveProd
.set(1,2, 96);
933 affinePerspectiveProd
.set(2,0, 7);
934 affinePerspectiveProd
.set(2,1, 8);
935 affinePerspectiveProd
.set(2,2, 9);
937 B2DHomMatrix perspectiveAffineProd
;
939 perspectiveAffineProd
.set(0,0, 9);
940 perspectiveAffineProd
.set(0,1, 12);
941 perspectiveAffineProd
.set(0,2, 18);
942 perspectiveAffineProd
.set(1,0, 24);
943 perspectiveAffineProd
.set(1,1, 33);
944 perspectiveAffineProd
.set(1,2, 48);
945 perspectiveAffineProd
.set(2,0, 39);
946 perspectiveAffineProd
.set(2,1, 54);
947 perspectiveAffineProd
.set(2,2, 78);
949 B2DHomMatrix perspectivePerspectiveProd
;
951 perspectivePerspectiveProd
.set(0,0, 30);
952 perspectivePerspectiveProd
.set(0,1, 36);
953 perspectivePerspectiveProd
.set(0,2, 42);
954 perspectivePerspectiveProd
.set(1,0, 66);
955 perspectivePerspectiveProd
.set(1,1, 81);
956 perspectivePerspectiveProd
.set(1,2, 96);
957 perspectivePerspectiveProd
.set(2,0, 102);
958 perspectivePerspectiveProd
.set(2,1, 126);
959 perspectivePerspectiveProd
.set(2,2, 150);
965 CPPUNIT_ASSERT_MESSAGE("multiply: both compact", temp
== affineAffineProd
);
967 temp
= maPerspective
;
969 CPPUNIT_ASSERT_MESSAGE("multiply: first compact", temp
== affinePerspectiveProd
);
973 CPPUNIT_ASSERT_MESSAGE("multiply: second compact", temp
== perspectiveAffineProd
);
975 temp
= maPerspective
;
977 CPPUNIT_ASSERT_MESSAGE("multiply: none compact", temp
== perspectivePerspectiveProd
);
980 void impFillMatrix(B2DHomMatrix
& rSource
, double fScaleX
, double fScaleY
, double fShearX
, double fRotate
)
982 // fill rSource with a linear combination of scale, shear and rotate
984 rSource
.scale(fScaleX
, fScaleY
);
985 rSource
.shearX(fShearX
);
986 rSource
.rotate(fRotate
);
989 bool impDecomposeComposeTest(double fScaleX
, double fScaleY
, double fShearX
, double fRotate
)
991 // linear combine matrix with given values
992 B2DHomMatrix aSource
;
993 impFillMatrix(aSource
, fScaleX
, fScaleY
, fShearX
, fRotate
);
995 // decompose that matrix
1000 bool bWorked
= aSource
.decompose(aDScale
, aDTrans
, fDRot
, fDShX
);
1002 // linear combine another matrix with decomposition results
1003 B2DHomMatrix aRecombined
;
1004 impFillMatrix(aRecombined
, aDScale
.getX(), aDScale
.getY(), fDShX
, fDRot
);
1006 // if decomposition worked, matrices need to be the same
1007 return bWorked
&& aSource
== aRecombined
;
1012 // test matrix decompositions. Each matrix decomposed and rebuilt
1013 // using the decompose result should be the same as before. Test
1014 // with all ranges of values. Translations are not tested since these
1015 // are just the two rightmost values and uncritical
1016 static double fSX(10.0);
1017 static double fSY(12.0);
1018 static double fR(45.0 * F_PI180
);
1019 static double fS(15.0 * F_PI180
);
1021 // check all possible scaling combinations
1022 CPPUNIT_ASSERT_MESSAGE("decompose: error test A1", impDecomposeComposeTest(fSX
, fSY
, 0.0, 0.0));
1023 CPPUNIT_ASSERT_MESSAGE("decompose: error test A2", impDecomposeComposeTest(-fSX
, fSY
, 0.0, 0.0));
1024 CPPUNIT_ASSERT_MESSAGE("decompose: error test A3", impDecomposeComposeTest(fSX
, -fSY
, 0.0, 0.0));
1025 CPPUNIT_ASSERT_MESSAGE("decompose: error test A4", impDecomposeComposeTest(-fSX
, -fSY
, 0.0, 0.0));
1027 // check all possible scaling combinations with positive rotation
1028 CPPUNIT_ASSERT_MESSAGE("decompose: error test B1", impDecomposeComposeTest(fSX
, fSY
, 0.0, fR
));
1029 CPPUNIT_ASSERT_MESSAGE("decompose: error test B2", impDecomposeComposeTest(-fSX
, fSY
, 0.0, fR
));
1030 CPPUNIT_ASSERT_MESSAGE("decompose: error test B3", impDecomposeComposeTest(fSX
, -fSY
, 0.0, fR
));
1031 CPPUNIT_ASSERT_MESSAGE("decompose: error test B4", impDecomposeComposeTest(-fSX
, -fSY
, 0.0, fR
));
1033 // check all possible scaling combinations with negative rotation
1034 CPPUNIT_ASSERT_MESSAGE("decompose: error test C1", impDecomposeComposeTest(fSX
, fSY
, 0.0, -fR
));
1035 CPPUNIT_ASSERT_MESSAGE("decompose: error test C2", impDecomposeComposeTest(-fSX
, fSY
, 0.0, -fR
));
1036 CPPUNIT_ASSERT_MESSAGE("decompose: error test C3", impDecomposeComposeTest(fSX
, -fSY
, 0.0, -fR
));
1037 CPPUNIT_ASSERT_MESSAGE("decompose: error test C4", impDecomposeComposeTest(-fSX
, -fSY
, 0.0, -fR
));
1039 // check all possible scaling combinations with positive shear
1040 CPPUNIT_ASSERT_MESSAGE("decompose: error test D1", impDecomposeComposeTest(fSX
, fSY
, tan(fS
), 0.0));
1041 CPPUNIT_ASSERT_MESSAGE("decompose: error test D2", impDecomposeComposeTest(-fSX
, fSY
, tan(fS
), 0.0));
1042 CPPUNIT_ASSERT_MESSAGE("decompose: error test D3", impDecomposeComposeTest(fSX
, -fSY
, tan(fS
), 0.0));
1043 CPPUNIT_ASSERT_MESSAGE("decompose: error test D4", impDecomposeComposeTest(-fSX
, -fSY
, tan(fS
), 0.0));
1045 // check all possible scaling combinations with negative shear
1046 CPPUNIT_ASSERT_MESSAGE("decompose: error test E1", impDecomposeComposeTest(fSX
, fSY
, tan(-fS
), 0.0));
1047 CPPUNIT_ASSERT_MESSAGE("decompose: error test E2", impDecomposeComposeTest(-fSX
, fSY
, tan(-fS
), 0.0));
1048 CPPUNIT_ASSERT_MESSAGE("decompose: error test E3", impDecomposeComposeTest(fSX
, -fSY
, tan(-fS
), 0.0));
1049 CPPUNIT_ASSERT_MESSAGE("decompose: error test E4", impDecomposeComposeTest(-fSX
, -fSY
, tan(-fS
), 0.0));
1051 // check all possible scaling combinations with positive rotate and positive shear
1052 CPPUNIT_ASSERT_MESSAGE("decompose: error test F1", impDecomposeComposeTest(fSX
, fSY
, tan(fS
), fR
));
1053 CPPUNIT_ASSERT_MESSAGE("decompose: error test F2", impDecomposeComposeTest(-fSX
, fSY
, tan(fS
), fR
));
1054 CPPUNIT_ASSERT_MESSAGE("decompose: error test F3", impDecomposeComposeTest(fSX
, -fSY
, tan(fS
), fR
));
1055 CPPUNIT_ASSERT_MESSAGE("decompose: error test F4", impDecomposeComposeTest(-fSX
, -fSY
, tan(fS
), fR
));
1057 // check all possible scaling combinations with negative rotate and positive shear
1058 CPPUNIT_ASSERT_MESSAGE("decompose: error test G1", impDecomposeComposeTest(fSX
, fSY
, tan(fS
), -fR
));
1059 CPPUNIT_ASSERT_MESSAGE("decompose: error test G2", impDecomposeComposeTest(-fSX
, fSY
, tan(fS
), -fR
));
1060 CPPUNIT_ASSERT_MESSAGE("decompose: error test G3", impDecomposeComposeTest(fSX
, -fSY
, tan(fS
), -fR
));
1061 CPPUNIT_ASSERT_MESSAGE("decompose: error test G4", impDecomposeComposeTest(-fSX
, -fSY
, tan(fS
), -fR
));
1063 // check all possible scaling combinations with positive rotate and negative shear
1064 CPPUNIT_ASSERT_MESSAGE("decompose: error test H1", impDecomposeComposeTest(fSX
, fSY
, tan(-fS
), fR
));
1065 CPPUNIT_ASSERT_MESSAGE("decompose: error test H2", impDecomposeComposeTest(-fSX
, fSY
, tan(-fS
), fR
));
1066 CPPUNIT_ASSERT_MESSAGE("decompose: error test H3", impDecomposeComposeTest(fSX
, -fSY
, tan(-fS
), fR
));
1067 CPPUNIT_ASSERT_MESSAGE("decompose: error test H4", impDecomposeComposeTest(-fSX
, -fSY
, tan(-fS
), fR
));
1069 // check all possible scaling combinations with negative rotate and negative shear
1070 CPPUNIT_ASSERT_MESSAGE("decompose: error test I1", impDecomposeComposeTest(fSX
, fSY
, tan(-fS
), -fR
));
1071 CPPUNIT_ASSERT_MESSAGE("decompose: error test I2", impDecomposeComposeTest(-fSX
, fSY
, tan(-fS
), -fR
));
1072 CPPUNIT_ASSERT_MESSAGE("decompose: error test I3", impDecomposeComposeTest(fSX
, -fSY
, tan(-fS
), -fR
));
1073 CPPUNIT_ASSERT_MESSAGE("decompose: error test I4", impDecomposeComposeTest(-fSX
, -fSY
, tan(-fS
), -fR
));
1076 // Change the following lines only, if you add, remove or rename
1077 // member functions of the current class,
1078 // because these macros are need by auto register mechanism.
1080 CPPUNIT_TEST_SUITE(b2dhommatrix
);
1081 CPPUNIT_TEST(equal
);
1082 CPPUNIT_TEST(identity
);
1083 CPPUNIT_TEST(scale
);
1084 CPPUNIT_TEST(translate
);
1085 CPPUNIT_TEST(shear
);
1086 CPPUNIT_TEST(multiply
);
1087 CPPUNIT_TEST(decompose
);
1088 CPPUNIT_TEST_SUITE_END();
1090 }; // class b2dhommatrix
1093 class b2dhompoint
: public CppUnit::TestFixture
1096 // initialise your test code values here.
1105 // insert your test code here.
1108 CPPUNIT_ASSERT_STUB();
1111 // Change the following lines only, if you add, remove or rename
1112 // member functions of the current class,
1113 // because these macros are need by auto register mechanism.
1115 CPPUNIT_TEST_SUITE(b2dhompoint
);
1116 CPPUNIT_TEST(EmptyMethod
);
1117 CPPUNIT_TEST_SUITE_END();
1118 }; // class b2dhompoint
1121 class b2dpoint
: public CppUnit::TestFixture
1124 // initialise your test code values here.
1133 // insert your test code here.
1134 // this is only demonstration code
1137 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
1138 CPPUNIT_ASSERT_STUB();
1141 // Change the following lines only, if you add, remove or rename
1142 // member functions of the current class,
1143 // because these macros are need by auto register mechanism.
1145 CPPUNIT_TEST_SUITE(b2dpoint
);
1146 CPPUNIT_TEST(EmptyMethod
);
1147 CPPUNIT_TEST_SUITE_END();
1148 }; // class b2dpoint
1151 class b2dpolygon
: public CppUnit::TestFixture
1154 // initialise your test code values here.
1163 // insert your test code here.
1168 aPoly
.appendBezierSegment(B2DPoint(1,1),B2DPoint(2,2),B2DPoint(3,3));
1170 CPPUNIT_ASSERT_MESSAGE("#1 first polygon point wrong",
1171 aPoly
.getB2DPoint(0) == B2DPoint(3,3));
1172 CPPUNIT_ASSERT_MESSAGE("#1 first control point wrong",
1173 aPoly
.getPrevControlPoint(0) == B2DPoint(2,2));
1174 CPPUNIT_ASSERT_MESSAGE("#1 second control point wrong",
1175 aPoly
.getNextControlPoint(0) == B2DPoint(3,3));
1176 CPPUNIT_ASSERT_MESSAGE("next control point not used",
1177 aPoly
.isNextControlPointUsed(0) == false);
1179 aPoly
.setNextControlPoint(0,B2DPoint(4,4));
1180 CPPUNIT_ASSERT_MESSAGE("#1.1 second control point wrong",
1181 aPoly
.getNextControlPoint(0) == B2DPoint(4,4));
1182 CPPUNIT_ASSERT_MESSAGE("next control point used",
1183 aPoly
.isNextControlPointUsed(0) == true);
1184 CPPUNIT_ASSERT_MESSAGE("areControlPointsUsed() wrong",
1185 aPoly
.areControlPointsUsed() == true);
1186 CPPUNIT_ASSERT_MESSAGE("getContinuityInPoint() wrong",
1187 aPoly
.getContinuityInPoint(0) == CONTINUITY_C2
);
1189 aPoly
.resetControlPoints();
1190 CPPUNIT_ASSERT_MESSAGE("resetControlPoints() did not clear",
1191 aPoly
.getB2DPoint(0) == B2DPoint(3,3));
1192 CPPUNIT_ASSERT_MESSAGE("resetControlPoints() did not clear",
1193 aPoly
.getPrevControlPoint(0) == B2DPoint(3,3));
1194 CPPUNIT_ASSERT_MESSAGE("resetControlPoints() did not clear",
1195 aPoly
.getNextControlPoint(0) == B2DPoint(3,3));
1196 CPPUNIT_ASSERT_MESSAGE("areControlPointsUsed() wrong #2",
1197 aPoly
.areControlPointsUsed() == false);
1200 aPoly
.append(B2DPoint(0,0));
1201 aPoly
.appendBezierSegment(B2DPoint(1,1),B2DPoint(2,2),B2DPoint(3,3));
1203 CPPUNIT_ASSERT_MESSAGE("#2 first polygon point wrong",
1204 aPoly
.getB2DPoint(0) == B2DPoint(0,0));
1205 CPPUNIT_ASSERT_MESSAGE("#2 first control point wrong",
1206 aPoly
.getPrevControlPoint(0) == B2DPoint(0,0));
1207 CPPUNIT_ASSERT_MESSAGE("#2 second control point wrong",
1208 aPoly
.getNextControlPoint(0) == B2DPoint(1,1));
1209 CPPUNIT_ASSERT_MESSAGE("#2 third control point wrong",
1210 aPoly
.getPrevControlPoint(1) == B2DPoint(2,2));
1211 CPPUNIT_ASSERT_MESSAGE("#2 fourth control point wrong",
1212 aPoly
.getNextControlPoint(1) == B2DPoint(3,3));
1213 CPPUNIT_ASSERT_MESSAGE("#2 second polygon point wrong",
1214 aPoly
.getB2DPoint(1) == B2DPoint(3,3));
1216 // Change the following lines only, if you add, remove or rename
1217 // member functions of the current class,
1218 // because these macros are need by auto register mechanism.
1220 CPPUNIT_TEST_SUITE(b2dpolygon
);
1221 CPPUNIT_TEST(testBasics
);
1222 CPPUNIT_TEST_SUITE_END();
1223 }; // class b2dpolygon
1226 class b2dpolygontools
: public CppUnit::TestFixture
1229 // initialise your test code values here.
1238 // insert your test code here.
1239 // this is only demonstration code
1240 void testIsRectangle()
1243 tools::createPolygonFromRect(
1244 B2DRange(0,0,1,1) ) );
1247 aRect2
.append( B2DPoint(0,0) );
1248 aRect2
.append( B2DPoint(1,0) );
1249 aRect2
.append( B2DPoint(1,.5));
1250 aRect2
.append( B2DPoint(1,1) );
1251 aRect2
.append( B2DPoint(0,1) );
1252 aRect2
.setClosed(true);
1254 B2DPolygon aNonRect1
;
1255 aNonRect1
.append( B2DPoint(0,0) );
1256 aNonRect1
.append( B2DPoint(1,0) );
1257 aNonRect1
.append( B2DPoint(1,1) );
1258 aNonRect1
.append( B2DPoint(0.5,1) );
1259 aNonRect1
.append( B2DPoint(0.5,0) );
1260 aNonRect1
.setClosed(true);
1262 B2DPolygon aNonRect2
;
1263 aNonRect2
.append( B2DPoint(0,0) );
1264 aNonRect2
.append( B2DPoint(1,1) );
1265 aNonRect2
.append( B2DPoint(1,0) );
1266 aNonRect2
.append( B2DPoint(0,1) );
1267 aNonRect2
.setClosed(true);
1269 B2DPolygon aNonRect3
;
1270 aNonRect3
.append( B2DPoint(0,0) );
1271 aNonRect3
.append( B2DPoint(1,0) );
1272 aNonRect3
.append( B2DPoint(1,1) );
1273 aNonRect3
.setClosed(true);
1275 B2DPolygon aNonRect4
;
1276 aNonRect4
.append( B2DPoint(0,0) );
1277 aNonRect4
.append( B2DPoint(1,0) );
1278 aNonRect4
.append( B2DPoint(1,1) );
1279 aNonRect4
.append( B2DPoint(0,1) );
1281 CPPUNIT_ASSERT_MESSAGE("checking rectangle-ness of rectangle 1",
1282 tools::isRectangle( aRect1
));
1283 CPPUNIT_ASSERT_MESSAGE("checking rectangle-ness of rectangle 2",
1284 tools::isRectangle( aRect2
));
1285 CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 1",
1286 !tools::isRectangle( aNonRect1
));
1287 CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 2",
1288 !tools::isRectangle( aNonRect2
));
1289 CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 3",
1290 !tools::isRectangle( aNonRect3
));
1291 CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 4",
1292 !tools::isRectangle( aNonRect4
));
1295 // Change the following lines only, if you add, remove or rename
1296 // member functions of the current class,
1297 // because these macros are need by auto register mechanism.
1299 CPPUNIT_TEST_SUITE(b2dpolygontools
);
1300 CPPUNIT_TEST(testIsRectangle
);
1301 CPPUNIT_TEST_SUITE_END();
1302 }; // class b2dpolygontools
1305 class b2dpolypolygon
: public CppUnit::TestFixture
1308 // initialise your test code values here.
1317 // insert your test code here.
1320 CPPUNIT_ASSERT_STUB();
1323 // Change the following lines only, if you add, remove or rename
1324 // member functions of the current class,
1325 // because these macros are need by auto register mechanism.
1327 CPPUNIT_TEST_SUITE(b2dpolypolygon
);
1328 CPPUNIT_TEST(EmptyMethod
);
1329 CPPUNIT_TEST_SUITE_END();
1330 }; // class b2dpolypolygon
1333 class b2dquadraticbezier
: public CppUnit::TestFixture
1336 // initialise your test code values here.
1345 // insert your test code here.
1346 // this is only demonstration code
1349 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
1350 CPPUNIT_ASSERT_STUB();
1353 // Change the following lines only, if you add, remove or rename
1354 // member functions of the current class,
1355 // because these macros are need by auto register mechanism.
1357 CPPUNIT_TEST_SUITE(b2dquadraticbezier
);
1358 CPPUNIT_TEST(EmptyMethod
);
1359 CPPUNIT_TEST_SUITE_END();
1360 }; // class b2dquadraticbezier
1363 class b2drange
: public CppUnit::TestFixture
1366 // initialise your test code values here.
1375 // insert your test code here.
1378 CPPUNIT_ASSERT_STUB();
1381 // Change the following lines only, if you add, remove or rename
1382 // member functions of the current class,
1383 // because these macros are need by auto register mechanism.
1385 CPPUNIT_TEST_SUITE(b2drange
);
1386 CPPUNIT_TEST(EmptyMethod
);
1387 CPPUNIT_TEST_SUITE_END();
1388 }; // class b2drange
1391 class b2dtuple
: public CppUnit::TestFixture
1394 // initialise your test code values here.
1403 // insert your test code here.
1404 // this is only demonstration code
1407 // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
1408 CPPUNIT_ASSERT_STUB();
1411 // Change the following lines only, if you add, remove or rename
1412 // member functions of the current class,
1413 // because these macros are need by auto register mechanism.
1415 CPPUNIT_TEST_SUITE(b2dtuple
);
1416 CPPUNIT_TEST(EmptyMethod
);
1417 CPPUNIT_TEST_SUITE_END();
1418 }; // class b2dtuple
1421 class b2dvector
: public CppUnit::TestFixture
1424 // initialise your test code values here.
1433 // insert your test code here.
1436 CPPUNIT_ASSERT_STUB();
1439 // Change the following lines only, if you add, remove or rename
1440 // member functions of the current class,
1441 // because these macros are need by auto register mechanism.
1443 CPPUNIT_TEST_SUITE(b2dvector
);
1444 CPPUNIT_TEST(EmptyMethod
);
1445 CPPUNIT_TEST_SUITE_END();
1446 }; // class b2dvector
1448 class bcolor
: public CppUnit::TestFixture
1472 // initialise your test code values here.
1481 // insert your test code here.
1484 CPPUNIT_ASSERT_MESSAGE("white",
1485 tools::rgb2hsl(maWhite
) == BColor(0,0,1));
1486 CPPUNIT_ASSERT_MESSAGE("black",
1487 tools::rgb2hsl(maBlack
) == BColor(0,0,0));
1488 CPPUNIT_ASSERT_MESSAGE("red",
1489 tools::rgb2hsl(maRed
) == BColor(0,1,0.5));
1490 CPPUNIT_ASSERT_MESSAGE("green",
1491 tools::rgb2hsl(maGreen
) == BColor(120,1,0.5));
1492 CPPUNIT_ASSERT_MESSAGE("blue",
1493 tools::rgb2hsl(maBlue
) == BColor(240,1,0.5));
1494 CPPUNIT_ASSERT_MESSAGE("yellow",
1495 tools::rgb2hsl(maYellow
) == BColor(60,1,0.5));
1496 CPPUNIT_ASSERT_MESSAGE("magenta",
1497 tools::rgb2hsl(maMagenta
) == BColor(300,1,0.5));
1498 CPPUNIT_ASSERT_MESSAGE("cyan",
1499 tools::rgb2hsl(maCyan
) == BColor(180,1,0.5));
1501 CPPUNIT_ASSERT_MESSAGE("roundtrip white",
1502 tools::hsl2rgb(tools::rgb2hsl(maWhite
)) == maWhite
);
1503 CPPUNIT_ASSERT_MESSAGE("roundtrip black",
1504 tools::hsl2rgb(tools::rgb2hsl(maBlack
)) == maBlack
);
1505 CPPUNIT_ASSERT_MESSAGE("roundtrip red",
1506 tools::hsl2rgb(tools::rgb2hsl(maRed
)) == maRed
);
1507 CPPUNIT_ASSERT_MESSAGE("roundtrip green",
1508 tools::hsl2rgb(tools::rgb2hsl(maGreen
)) == maGreen
);
1509 CPPUNIT_ASSERT_MESSAGE("roundtrip blue",
1510 tools::hsl2rgb(tools::rgb2hsl(maBlue
)) == maBlue
);
1511 CPPUNIT_ASSERT_MESSAGE("roundtrip yellow",
1512 tools::hsl2rgb(tools::rgb2hsl(maYellow
)) == maYellow
);
1513 CPPUNIT_ASSERT_MESSAGE("roundtrip magenta",
1514 tools::hsl2rgb(tools::rgb2hsl(maMagenta
)) == maMagenta
);
1515 CPPUNIT_ASSERT_MESSAGE("roundtrip cyan",
1516 tools::hsl2rgb(tools::rgb2hsl(maCyan
)) == maCyan
);
1518 CPPUNIT_ASSERT_MESSAGE("grey10",
1519 tools::rgb2hsl(maWhite
*.1) == BColor(0,0,.1));
1520 CPPUNIT_ASSERT_MESSAGE("grey90",
1521 tools::rgb2hsl(maWhite
*.9) == BColor(0,0,.9));
1522 CPPUNIT_ASSERT_MESSAGE("red/2",
1523 tools::rgb2hsl(maRed
*.5) == BColor(0,1,0.25));
1524 CPPUNIT_ASSERT_MESSAGE("green/2",
1525 tools::rgb2hsl(maGreen
*.5) == BColor(120,1,0.25));
1526 CPPUNIT_ASSERT_MESSAGE("blue/2",
1527 tools::rgb2hsl(maBlue
*.5) == BColor(240,1,0.25));
1528 CPPUNIT_ASSERT_MESSAGE("yellow/2",
1529 tools::rgb2hsl(maYellow
*.5) == BColor(60,1,0.25));
1530 CPPUNIT_ASSERT_MESSAGE("magenta/2",
1531 tools::rgb2hsl(maMagenta
*.5) == BColor(300,1,0.25));
1532 CPPUNIT_ASSERT_MESSAGE("cyan/2",
1533 tools::rgb2hsl(maCyan
*.5) == BColor(180,1,0.25));
1535 CPPUNIT_ASSERT_MESSAGE("pastel",
1536 tools::rgb2hsl(BColor(.75,.25,.25)) == BColor(0,.5,.5));
1539 // insert your test code here.
1542 CPPUNIT_ASSERT_MESSAGE("white",
1543 tools::rgb2hsv(maWhite
) == BColor(0,0,1));
1544 CPPUNIT_ASSERT_MESSAGE("black",
1545 tools::rgb2hsv(maBlack
) == BColor(0,0,0));
1546 CPPUNIT_ASSERT_MESSAGE("red",
1547 tools::rgb2hsv(maRed
) == BColor(0,1,1));
1548 CPPUNIT_ASSERT_MESSAGE("green",
1549 tools::rgb2hsv(maGreen
) == BColor(120,1,1));
1550 CPPUNIT_ASSERT_MESSAGE("blue",
1551 tools::rgb2hsv(maBlue
) == BColor(240,1,1));
1552 CPPUNIT_ASSERT_MESSAGE("yellow",
1553 tools::rgb2hsv(maYellow
) == BColor(60,1,1));
1554 CPPUNIT_ASSERT_MESSAGE("magenta",
1555 tools::rgb2hsv(maMagenta
) == BColor(300,1,1));
1556 CPPUNIT_ASSERT_MESSAGE("cyan",
1557 tools::rgb2hsv(maCyan
) == BColor(180,1,1));
1559 CPPUNIT_ASSERT_MESSAGE("roundtrip white",
1560 tools::hsv2rgb(tools::rgb2hsv(maWhite
)) == maWhite
);
1561 CPPUNIT_ASSERT_MESSAGE("roundtrip black",
1562 tools::hsv2rgb(tools::rgb2hsv(maBlack
)) == maBlack
);
1563 CPPUNIT_ASSERT_MESSAGE("roundtrip red",
1564 tools::hsv2rgb(tools::rgb2hsv(maRed
)) == maRed
);
1565 CPPUNIT_ASSERT_MESSAGE("roundtrip green",
1566 tools::hsv2rgb(tools::rgb2hsv(maGreen
)) == maGreen
);
1567 CPPUNIT_ASSERT_MESSAGE("roundtrip blue",
1568 tools::hsv2rgb(tools::rgb2hsv(maBlue
)) == maBlue
);
1569 CPPUNIT_ASSERT_MESSAGE("roundtrip yellow",
1570 tools::hsv2rgb(tools::rgb2hsv(maYellow
)) == maYellow
);
1571 CPPUNIT_ASSERT_MESSAGE("roundtrip magenta",
1572 tools::hsv2rgb(tools::rgb2hsv(maMagenta
)) == maMagenta
);
1573 CPPUNIT_ASSERT_MESSAGE("roundtrip cyan",
1574 tools::hsv2rgb(tools::rgb2hsv(maCyan
)) == maCyan
);
1576 CPPUNIT_ASSERT_MESSAGE("grey10",
1577 tools::rgb2hsv(maWhite
*.1) == BColor(0,0,.1));
1578 CPPUNIT_ASSERT_MESSAGE("grey90",
1579 tools::rgb2hsv(maWhite
*.9) == BColor(0,0,.9));
1580 CPPUNIT_ASSERT_MESSAGE("red/2",
1581 tools::rgb2hsv(maRed
*.5) == BColor(0,1,0.5));
1582 CPPUNIT_ASSERT_MESSAGE("green/2",
1583 tools::rgb2hsv(maGreen
*.5) == BColor(120,1,0.5));
1584 CPPUNIT_ASSERT_MESSAGE("blue/2",
1585 tools::rgb2hsv(maBlue
*.5) == BColor(240,1,0.5));
1586 CPPUNIT_ASSERT_MESSAGE("yellow/2",
1587 tools::rgb2hsv(maYellow
*.5) == BColor(60,1,0.5));
1588 CPPUNIT_ASSERT_MESSAGE("magenta/2",
1589 tools::rgb2hsv(maMagenta
*.5) == BColor(300,1,0.5));
1590 CPPUNIT_ASSERT_MESSAGE("cyan/2",
1591 tools::rgb2hsv(maCyan
*.5) == BColor(180,1,0.5));
1593 CPPUNIT_ASSERT_MESSAGE("pastel",
1594 tools::rgb2hsv(BColor(.5,.25,.25)) == BColor(0,.5,.5));
1599 tools::rgb2ciexyz(maWhite
);
1600 tools::rgb2ciexyz(maBlack
);
1601 tools::rgb2ciexyz(maRed
);
1602 tools::rgb2ciexyz(maGreen
);
1603 tools::rgb2ciexyz(maBlue
);
1604 tools::rgb2ciexyz(maYellow
);
1605 tools::rgb2ciexyz(maMagenta
);
1606 tools::rgb2ciexyz(maCyan
);
1609 // Change the following lines only, if you add, remove or rename
1610 // member functions of the current class,
1611 // because these macros are need by auto register mechanism.
1613 CPPUNIT_TEST_SUITE(bcolor
);
1614 CPPUNIT_TEST(hslTest
);
1615 CPPUNIT_TEST(hsvTest
);
1616 CPPUNIT_TEST(ciexyzTest
);
1617 CPPUNIT_TEST_SUITE_END();
1618 }; // class b2dvector
1620 // -----------------------------------------------------------------------------
1621 //CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dmultirange, "basegfx2d");
1622 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dsvgdimpex
, "basegfx2d");
1623 //CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dbeziertools, "basegfx2d");
1624 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dcubicbezier
, "basegfx2d");
1625 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dhommatrix
, "basegfx2d");
1626 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dhompoint
, "basegfx2d");
1627 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpoint
, "basegfx2d");
1628 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpolygon
, "basegfx2d");
1629 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpolygontools
, "basegfx2d");
1630 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dpolypolygon
, "basegfx2d");
1631 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dquadraticbezier
, "basegfx2d");
1632 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2drange
, "basegfx2d");
1633 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dtuple
, "basegfx2d");
1634 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::b2dvector
, "basegfx2d");
1635 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(basegfx2d::bcolor
, "basegfx2d");
1636 } // namespace basegfx2d
1639 // -----------------------------------------------------------------------------
1641 // this macro creates an empty function, which will called by the RegisterAllFunctions()
1642 // to let the user the possibility to also register some functions by hand.