Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include "cppunit/TestAssert.h"
21 : #include "cppunit/TestFixture.h"
22 : #include "cppunit/extensions/HelperMacros.h"
23 :
24 : #include <basegfx/matrix/b2dhommatrix.hxx>
25 : #include <basegfx/matrix/b2dhommatrixtools.hxx>
26 : #include <basegfx/polygon/b2dpolygon.hxx>
27 : #include <basegfx/polygon/b2dpolygontools.hxx>
28 : #include <basegfx/curve/b2dcubicbezier.hxx>
29 : #include <basegfx/curve/b2dbeziertools.hxx>
30 : #include <basegfx/polygon/b2dpolypolygontools.hxx>
31 : #include <basegfx/polygon/b2dpolygonclipper.hxx>
32 : #include <basegfx/polygon/b2dpolypolygon.hxx>
33 : #include <basegfx/range/b2irange.hxx>
34 : #include <basegfx/range/b2ibox.hxx>
35 : #include <basegfx/range/b1drange.hxx>
36 : #include <basegfx/range/b1irange.hxx>
37 : #include <basegfx/range/b1ibox.hxx>
38 : #include <basegfx/range/b2drange.hxx>
39 : #include <basegfx/range/b2dpolyrange.hxx>
40 : #include <basegfx/numeric/ftools.hxx>
41 : #include <basegfx/color/bcolor.hxx>
42 : #include <basegfx/color/bcolortools.hxx>
43 :
44 : #include <basegfx/tools/rectcliptools.hxx>
45 :
46 : #include <iostream>
47 : #include <fstream>
48 :
49 : using namespace ::basegfx;
50 :
51 :
52 : namespace basegfx2d
53 : {
54 :
55 3 : class b2dsvgdimpex : public CppUnit::TestFixture
56 : {
57 : private:
58 : OUString aPath0;
59 : OUString aPath1;
60 : OUString aPath2;
61 : OUString aPath3;
62 :
63 : public:
64 : // initialise your test code values here.
65 1 : void setUp()
66 : {
67 : // simple rectangle
68 1 : aPath0 = "M 10 10-10 10-10-10 10-10Z";
69 :
70 : // simple bezier polygon
71 1 : aPath1 = "m11430 0c-8890 3810 5715 6985 5715 6985 "
72 : "0 0-17145-1905-17145-1905 0 0 22860-10160 "
73 1 : "16510 6350-6350 16510-3810-11430-3810-11430z";
74 :
75 : // '@' as a bezier polygon
76 1 : aPath2 = "m1917 1114c-89-189-233-284-430-284-167 "
77 : "0-306 91-419 273-113 182-170 370-170 564 "
78 : "0 145 33 259 98 342 65 84 150 126 257 126 "
79 : "77 0 154-19 231-57 77-38 147-97 210-176 63"
80 : "-79 99-143 109-190 38-199 76-398 114-598z"
81 : "m840 1646c-133 73-312 139-537 197-225 57"
82 : "-440 86-644 87-483-1-866-132-1150-392-284"
83 : "-261-426-619-426-1076 0-292 67-560 200-803 "
84 : "133-243 321-433 562-569 241-136 514-204 821"
85 : "-204 405 0 739 125 1003 374 264 250 396 550 "
86 : "396 899 0 313-88 576-265 787-177 212-386 318"
87 : "-627 318-191 0-308-94-352-281-133 187-315 281"
88 : "-546 281-172 0-315-67-428-200-113-133-170-301"
89 : "-170-505 0-277 90-527 271-751 181-223 394"
90 : "-335 640-335 196 0 353 83 470 250 13-68 26"
91 : "-136 41-204 96 0 192 0 288 0-74 376-148 752"
92 : "-224 1128-21 101-31 183-31 245 0 39 9 70 26 "
93 : "93 17 24 39 36 67 36 145 0 279-80 400-240 121"
94 : "-160 182-365 182-615 0-288-107-533-322-734"
95 : "-215-201-487-301-816-301-395 0-715 124-960 "
96 : "373-245 249-368 569-368 958 0 385 119 685 "
97 : "357 900 237 216 557 324 958 325 189-1 389-27 "
98 1 : "600-77 211-52 378-110 503-174 27 70 54 140 81 210z";
99 :
100 : // first part of 'Hello World' as a line polygon
101 1 : aPath3 = "m1598 125h306v2334h-306v-1105h-1293v1105h-305v"
102 : "-2334h305v973h1293zm2159 1015 78-44 85 235-91 "
103 : "47-91 40-90 34-90 29-89 21-88 16-88 10-88 3-102"
104 : "-4-97-12-91-19-85-26-40-16-39-18-38-20-36-22-34"
105 : "-24-33-26-32-27-30-30-29-31-27-33-25-33-23-36-21"
106 : "-36-19-38-18-40-16-40-26-86-18-91-11-97-4-103 3"
107 : "-98 11-94 17-89 24-84 31-79 37-75 22-35 23-34 24"
108 : "-33 27-32 28-30 29-28 31-27 31-24 33-22 34-21 35"
109 : "-18 37-17 38-14 38-13 41-11 41-8 86-12 91-4 82 4 "
110 : "78 10 37 9 37 9 36 12 35 14 33 15 33 17 32 19 31 "
111 : "21 30 22 30 25 55 54 26 29 24 31 22 32 21 33 19 "
112 : "34 18 36 30 74 23 80 17 84 10 89 3 94v78h-1277l6 "
113 : "75 10 70 14 66 19 62 23 57 13 26 14 26 15 25 17 "
114 : "23 17 22 19 21 19 20 21 18 21 18 23 16 23 14 24 "
115 : "14 26 12 26 11 27 10 28 8 59 13 63 7 67 3 80-3 81"
116 : "-9 79-14 80-21 78-26 79-32zm-1049-808-12 53h963l"
117 : "-7-51-11-49-14-46-17-43-21-40-24-38-27-36-31-32"
118 : "-33-29-35-25-37-22-38-17-40-14-41-9-42-6-44-2-48 "
119 : "2-46 6-44 9-42 13-40 17-38 21-36 24-34 28-32 32"
120 : "-29 34-26 38-23 41-20 44-17 47zm1648-1293h288v"
121 : "2459h-288zm752-2459h288v2459h-288zm1286-1750 86-11 "
122 : "91-4 91 4 85 12 42 8 39 11 39 13 38 14 36 17 35 18 "
123 : "34 20 33 23 31 24 30 26 29 28 28 30 26 32 25 33 23 "
124 : "34 21 35 37 75 31 80 24 84 16 90 11 94 3 100-3 100"
125 : "-11 95-16 89-24 85-31 80-37 74-21 35-23 35-25 32-26 "
126 : "32-28 30-29 28-30 26-31 24-33 22-34 21-35 18-36 17"
127 : "-38 14-39 13-39 10-42 9-85 12-91 4-91-4-86-12-41-9"
128 : "-40-10-39-13-37-14-36-17-35-18-34-21-33-22-31-24-30"
129 : "-26-29-28-28-30-26-32-25-32-23-35-21-35-38-74-30-80"
130 : "-24-85-17-89-11-95-3-100 3-101 11-95 17-90 24-85 30"
131 : "-79 38-75 21-35 23-35 25-32 26-32 28-30 29-28 30-26 "
132 1 : "31-24 33-22 34-20 35-18 36-16 37-15 39-12 40-11z";
133 1 : }
134 :
135 1 : void tearDown()
136 : {
137 1 : }
138 :
139 1 : void impex()
140 : {
141 1 : B2DPolyPolygon aPoly;
142 2 : OUString aExport;
143 :
144 2 : CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D",
145 : tools::importFromSvgD( aPoly,
146 1 : aPath0 ));
147 1 : aExport = tools::exportToSvgD( aPoly );
148 1 : const char* sExportString = "m10 10h-20v-20h20z";
149 2 : CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D",
150 1 : !aExport.compareToAscii(sExportString) );
151 2 : CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D (round-trip",
152 : tools::importFromSvgD( aPoly,
153 1 : aExport ));
154 1 : aExport = tools::exportToSvgD( aPoly );
155 2 : CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D (round-trip)",
156 1 : !aExport.compareToAscii(sExportString));
157 :
158 2 : CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D",
159 : tools::importFromSvgD( aPoly,
160 1 : aPath1 ));
161 1 : aExport = tools::exportToSvgD( aPoly );
162 :
163 : // Adaptions for B2DPolygon bezier change (see #i77162#):
164 : //
165 : // The import/export of aPath1 does not reproduce aExport again. This is
166 : // correct since aPath1 contains a segment with non-used control points
167 : // which gets exported now correctly as 'l' and also a point (#4, index 3)
168 : // with C2 continuity which produces a 's' staement now.
169 : //
170 : // The old SVGexport identified nun-used ControlVectors erraneously as bezier segments
171 : // because the 2nd vector at the start point was used, even when added
172 : // with start point was identical to end point. Exactly for that reason
173 : // i reworked the B2DPolygon to use prev, next control points.
174 : //
175 : // so for correct unit test i add the new exported string here as sExportStringSimpleBezier
176 : // and compare to it.
177 : const char* sExportStringSimpleBezier =
178 : "m11430 0c-8890 3810 5715 6985 5715 6985"
179 : "l-17145-1905c0 0 22860-10160 16510 6350"
180 1 : "s-3810-11430-3810-11430z";
181 1 : CPPUNIT_ASSERT_MESSAGE("exporting bezier polygon to SVG-D", !aExport.compareToAscii(sExportStringSimpleBezier));
182 :
183 : // Adaptions for B2DPolygon bezier change (see #i77162#):
184 : //
185 : // a 2nd good test is that re-importing of aExport has to create the same
186 : // B2DPolPolygon again:
187 2 : B2DPolyPolygon aReImport;
188 1 : CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D", tools::importFromSvgD( aReImport, aExport));
189 1 : CPPUNIT_ASSERT_MESSAGE("re-imported polygon needs to be identical", aReImport == aPoly);
190 :
191 1 : CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D", tools::importFromSvgD( aPoly, aPath2 ));
192 1 : aExport = tools::exportToSvgD( aPoly );
193 :
194 : // Adaptions for B2DPolygon bezier change (see #i77162#):
195 : //
196 : // same here, the corrected export with the corrected B2DPolygon is simply more efficient,
197 : // so i needed to change the compare string. Also adding the re-import comparison below.
198 : const char* sExportString1 =
199 : "m1917 1114c-89-189-233-284-430-284-167 0-306 91-419 273s-170 370-17"
200 : "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"
201 : "-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-"
202 : "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"
203 : "-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"
204 : "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"
205 : "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"
206 : "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"
207 1 : "8 325 189-1 389-27 600-77 211-52 378-110 503-174q40.5 105 81 210z";
208 1 : CPPUNIT_ASSERT_MESSAGE("re-importing '@' from SVG-D", tools::importFromSvgD( aReImport, aExport));
209 1 : CPPUNIT_ASSERT_MESSAGE("re-imported '@' needs to be identical", aReImport == aPoly);
210 :
211 1 : CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D", !aExport.compareToAscii(sExportString1));
212 2 : CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D (round-trip",
213 : tools::importFromSvgD( aPoly,
214 1 : aExport ));
215 1 : aExport = tools::exportToSvgD( aPoly );
216 2 : CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D (round-trip)",
217 1 : !aExport.compareToAscii(sExportString1));
218 :
219 :
220 2 : CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D",
221 : tools::importFromSvgD( aPoly,
222 1 : aPath3 ));
223 1 : aExport = tools::exportToSvgD( aPoly );
224 : const char* sExportString2 =
225 : "m1598 125h306v2334h-306v-1105h-1293v1105h-305v-2334h305v973h1293"
226 : "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"
227 : "-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"
228 : "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"
229 : "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-"
230 : "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"
231 : "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 "
232 : "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"
233 : "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"
234 : " 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"
235 : "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"
236 : "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"
237 : "-1293h288v2459h-288zm752-2459h288v2459h-288zm1286-1750 86-11 91-4 91 4 85 12 42 "
238 : "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 "
239 : "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"
240 : " 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"
241 : "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"
242 : "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-"
243 : "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"
244 1 : "-28 30-26 31-24 33-22 34-20 35-18 36-16 37-15 39-12 40-11z";
245 2 : CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D",
246 1 : !aExport.compareToAscii(sExportString2));
247 2 : CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D (round-trip",
248 : tools::importFromSvgD( aPoly,
249 1 : aExport ));
250 1 : aExport = tools::exportToSvgD( aPoly );
251 2 : CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D (round-trip)",
252 1 : !aExport.compareToAscii(sExportString2));
253 :
254 : const B2DPolygon aRect(
255 2 : tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) ));
256 1 : aExport = tools::exportToSvgD( B2DPolyPolygon(aRect), false, false);
257 :
258 1 : const char* sExportStringRect = "M0 0H4000V4000H0Z";
259 2 : CPPUNIT_ASSERT_MESSAGE("exporting to rectangle svg-d string",
260 2 : !aExport.compareToAscii(sExportStringRect));
261 1 : }
262 :
263 : // Change the following lines only, if you add, remove or rename
264 : // member functions of the current class,
265 : // because these macros are need by auto register mechanism.
266 :
267 2 : CPPUNIT_TEST_SUITE(b2dsvgdimpex);
268 1 : CPPUNIT_TEST(impex);
269 2 : CPPUNIT_TEST_SUITE_END();
270 : }; // class b2dsvgdimpex
271 :
272 3 : class b2drange : public CppUnit::TestFixture
273 : {
274 : private:
275 : public:
276 1 : void check()
277 : {
278 2 : CPPUNIT_ASSERT_MESSAGE("simple range rounding from double to integer",
279 1 : fround(B2DRange(1.2, 2.3, 3.5, 4.8)) == B2IRange(1, 2, 4, 5));
280 1 : }
281 :
282 : // Change the following lines only, if you add, remove or rename
283 : // member functions of the current class,
284 : // because these macros are need by auto register mechanism.
285 :
286 2 : CPPUNIT_TEST_SUITE(b2drange);
287 1 : CPPUNIT_TEST(check);
288 2 : CPPUNIT_TEST_SUITE_END();
289 : };
290 :
291 3 : class b2dpolyrange : public CppUnit::TestFixture
292 : {
293 : private:
294 : public:
295 1 : void check()
296 : {
297 1 : B2DPolyRange aRange;
298 1 : aRange.appendElement(B2DRange(0,0,1,1),ORIENTATION_POSITIVE);
299 1 : aRange.appendElement(B2DRange(2,2,3,3),ORIENTATION_POSITIVE);
300 :
301 2 : CPPUNIT_ASSERT_MESSAGE("simple poly range - count",
302 1 : aRange.count() == 2);
303 2 : CPPUNIT_ASSERT_MESSAGE("simple poly range - first element",
304 1 : aRange.getElement(0).head == B2DRange(0,0,1,1));
305 2 : CPPUNIT_ASSERT_MESSAGE("simple poly range - second element",
306 1 : aRange.getElement(1).head == B2DRange(2,2,3,3));
307 :
308 : // B2DPolyRange relies on correctly orientated rects
309 1 : const B2DRange aRect(0,0,1,1);
310 2 : CPPUNIT_ASSERT_MESSAGE("createPolygonFromRect - correct orientation",
311 : tools::getOrientation(
312 2 : tools::createPolygonFromRect(aRect)) == ORIENTATION_POSITIVE );
313 1 : }
314 :
315 : // Change the following lines only, if you add, remove or rename
316 : // member functions of the current class,
317 : // because these macros are need by auto register mechanism.
318 :
319 2 : CPPUNIT_TEST_SUITE(b2dpolyrange);
320 1 : CPPUNIT_TEST(check);
321 2 : CPPUNIT_TEST_SUITE_END();
322 : };
323 :
324 24 : class b2dhommatrix : public CppUnit::TestFixture
325 : {
326 : private:
327 : B2DHomMatrix maIdentity;
328 : B2DHomMatrix maScale;
329 : B2DHomMatrix maTranslate;
330 : B2DHomMatrix maShear;
331 : B2DHomMatrix maAffine;
332 : B2DHomMatrix maPerspective;
333 :
334 : public:
335 : // initialise your test code values here.
336 8 : void setUp()
337 : {
338 : // setup some test matrices
339 8 : maIdentity.identity(); // force compact layout
340 8 : maIdentity.set(0,0, 1.0);
341 8 : maIdentity.set(0,1, 0.0);
342 8 : maIdentity.set(0,2, 0.0);
343 8 : maIdentity.set(1,0, 0.0);
344 8 : maIdentity.set(1,1, 1.0);
345 8 : maIdentity.set(1,2, 0.0);
346 :
347 8 : maScale.identity(); // force compact layout
348 8 : maScale.set(0,0, 2.0);
349 8 : maScale.set(1,1, 20.0);
350 :
351 8 : maTranslate.identity(); // force compact layout
352 8 : maTranslate.set(0,2, 20.0);
353 8 : maTranslate.set(1,2, 2.0);
354 :
355 8 : maShear.identity(); // force compact layout
356 8 : maShear.set(0,1, 3.0);
357 8 : maShear.set(1,0, 7.0);
358 8 : maShear.set(1,1, 22.0);
359 :
360 8 : maAffine.identity(); // force compact layout
361 8 : maAffine.set(0,0, 1.0);
362 8 : maAffine.set(0,1, 2.0);
363 8 : maAffine.set(0,2, 3.0);
364 8 : maAffine.set(1,0, 4.0);
365 8 : maAffine.set(1,1, 5.0);
366 8 : maAffine.set(1,2, 6.0);
367 :
368 8 : maPerspective.set(0,0, 1.0);
369 8 : maPerspective.set(0,1, 2.0);
370 8 : maPerspective.set(0,2, 3.0);
371 8 : maPerspective.set(1,0, 4.0);
372 8 : maPerspective.set(1,1, 5.0);
373 8 : maPerspective.set(1,2, 6.0);
374 8 : maPerspective.set(2,0, 7.0);
375 8 : maPerspective.set(2,1, 8.0);
376 8 : maPerspective.set(2,2, 9.0);
377 8 : }
378 :
379 8 : void tearDown()
380 : {
381 8 : }
382 :
383 1 : void equal()
384 : {
385 1 : B2DHomMatrix aIdentity;
386 2 : B2DHomMatrix aScale;
387 2 : B2DHomMatrix aTranslate;
388 2 : B2DHomMatrix aShear;
389 2 : B2DHomMatrix aAffine;
390 2 : B2DHomMatrix aPerspective;
391 :
392 : // setup some test matrices
393 1 : aIdentity.identity(); // force compact layout
394 1 : aIdentity.set(0,0, 1.0);
395 1 : aIdentity.set(0,1, 0.0);
396 1 : aIdentity.set(0,2, 0.0);
397 1 : aIdentity.set(1,0, 0.0);
398 1 : aIdentity.set(1,1, 1.0);
399 1 : aIdentity.set(1,2, 0.0);
400 :
401 1 : aScale.identity(); // force compact layout
402 1 : aScale.set(0,0, 2.0);
403 1 : aScale.set(1,1, 20.0);
404 :
405 1 : aTranslate.identity(); // force compact layout
406 1 : aTranslate.set(0,2, 20.0);
407 1 : aTranslate.set(1,2, 2.0);
408 :
409 1 : aShear.identity(); // force compact layout
410 1 : aShear.set(0,1, 3.0);
411 1 : aShear.set(1,0, 7.0);
412 1 : aShear.set(1,1, 22.0);
413 :
414 1 : aAffine.identity(); // force compact layout
415 1 : aAffine.set(0,0, 1.0);
416 1 : aAffine.set(0,1, 2.0);
417 1 : aAffine.set(0,2, 3.0);
418 1 : aAffine.set(1,0, 4.0);
419 1 : aAffine.set(1,1, 5.0);
420 1 : aAffine.set(1,2, 6.0);
421 :
422 1 : aPerspective.set(0,0, 1.0);
423 1 : aPerspective.set(0,1, 2.0);
424 1 : aPerspective.set(0,2, 3.0);
425 1 : aPerspective.set(1,0, 4.0);
426 1 : aPerspective.set(1,1, 5.0);
427 1 : aPerspective.set(1,2, 6.0);
428 1 : aPerspective.set(2,0, 7.0);
429 1 : aPerspective.set(2,1, 8.0);
430 1 : aPerspective.set(2,2, 9.0);
431 :
432 1 : CPPUNIT_ASSERT_MESSAGE("operator==: identity matrix", aIdentity == maIdentity);
433 1 : CPPUNIT_ASSERT_MESSAGE("operator==: scale matrix", aScale == maScale);
434 1 : CPPUNIT_ASSERT_MESSAGE("operator==: translate matrix", aTranslate == maTranslate);
435 1 : CPPUNIT_ASSERT_MESSAGE("operator==: shear matrix", aShear == maShear);
436 1 : CPPUNIT_ASSERT_MESSAGE("operator==: affine matrix", aAffine == maAffine);
437 2 : CPPUNIT_ASSERT_MESSAGE("operator==: perspective matrix", aPerspective == maPerspective);
438 1 : }
439 :
440 1 : void identity()
441 : {
442 1 : B2DHomMatrix ident;
443 :
444 1 : CPPUNIT_ASSERT_MESSAGE("identity", maIdentity == ident);
445 1 : }
446 :
447 1 : void scale()
448 : {
449 1 : B2DHomMatrix mat;
450 1 : mat.scale(2.0,20.0);
451 1 : CPPUNIT_ASSERT_MESSAGE("scale", maScale == mat);
452 1 : }
453 :
454 1 : void rotate()
455 : {
456 1 : B2DHomMatrix mat;
457 1 : mat.rotate(90*F_PI180);
458 2 : CPPUNIT_ASSERT_MESSAGE("rotate pi/2 yields exact matrix",
459 : mat.get(0,0) == 0.0 &&
460 : mat.get(0,1) == -1.0 &&
461 : mat.get(0,2) == 0.0 &&
462 : mat.get(1,0) == 1.0 &&
463 : mat.get(1,1) == 0.0 &&
464 1 : mat.get(1,2) == 0.0);
465 1 : mat.rotate(90*F_PI180);
466 2 : CPPUNIT_ASSERT_MESSAGE("rotate pi yields exact matrix",
467 : mat.get(0,0) == -1.0 &&
468 : mat.get(0,1) == 0.0 &&
469 : mat.get(0,2) == 0.0 &&
470 : mat.get(1,0) == 0.0 &&
471 : mat.get(1,1) == -1.0 &&
472 1 : mat.get(1,2) == 0.0);
473 1 : mat.rotate(90*F_PI180);
474 2 : CPPUNIT_ASSERT_MESSAGE("rotate 3/2 pi yields exact matrix",
475 : mat.get(0,0) == 0.0 &&
476 : mat.get(0,1) == 1.0 &&
477 : mat.get(0,2) == 0.0 &&
478 : mat.get(1,0) == -1.0 &&
479 : mat.get(1,1) == 0.0 &&
480 1 : mat.get(1,2) == 0.0);
481 1 : mat.rotate(90*F_PI180);
482 2 : CPPUNIT_ASSERT_MESSAGE("rotate 2 pi yields exact matrix",
483 : mat.get(0,0) == 1.0 &&
484 : mat.get(0,1) == 0.0 &&
485 : mat.get(0,2) == 0.0 &&
486 : mat.get(1,0) == 0.0 &&
487 : mat.get(1,1) == 1.0 &&
488 2 : mat.get(1,2) == 0.0);
489 1 : }
490 :
491 1 : void translate()
492 : {
493 1 : B2DHomMatrix mat;
494 1 : mat.translate(20.0,2.0);
495 1 : CPPUNIT_ASSERT_MESSAGE("translate", maTranslate == mat);
496 1 : }
497 :
498 1 : void shear()
499 : {
500 1 : B2DHomMatrix mat;
501 1 : mat.shearX(3.0);
502 1 : mat.shearY(7.0);
503 1 : CPPUNIT_ASSERT_MESSAGE("translate", maShear == mat);
504 1 : }
505 :
506 1 : void multiply()
507 : {
508 1 : B2DHomMatrix affineAffineProd;
509 :
510 1 : affineAffineProd.set(0,0, 9);
511 1 : affineAffineProd.set(0,1, 12);
512 1 : affineAffineProd.set(0,2, 18);
513 1 : affineAffineProd.set(1,0, 24);
514 1 : affineAffineProd.set(1,1, 33);
515 1 : affineAffineProd.set(1,2, 48);
516 :
517 2 : B2DHomMatrix affinePerspectiveProd;
518 :
519 1 : affinePerspectiveProd.set(0,0, 30);
520 1 : affinePerspectiveProd.set(0,1, 36);
521 1 : affinePerspectiveProd.set(0,2, 42);
522 1 : affinePerspectiveProd.set(1,0, 66);
523 1 : affinePerspectiveProd.set(1,1, 81);
524 1 : affinePerspectiveProd.set(1,2, 96);
525 1 : affinePerspectiveProd.set(2,0, 7);
526 1 : affinePerspectiveProd.set(2,1, 8);
527 1 : affinePerspectiveProd.set(2,2, 9);
528 :
529 2 : B2DHomMatrix perspectiveAffineProd;
530 :
531 1 : perspectiveAffineProd.set(0,0, 9);
532 1 : perspectiveAffineProd.set(0,1, 12);
533 1 : perspectiveAffineProd.set(0,2, 18);
534 1 : perspectiveAffineProd.set(1,0, 24);
535 1 : perspectiveAffineProd.set(1,1, 33);
536 1 : perspectiveAffineProd.set(1,2, 48);
537 1 : perspectiveAffineProd.set(2,0, 39);
538 1 : perspectiveAffineProd.set(2,1, 54);
539 1 : perspectiveAffineProd.set(2,2, 78);
540 :
541 2 : B2DHomMatrix perspectivePerspectiveProd;
542 :
543 1 : perspectivePerspectiveProd.set(0,0, 30);
544 1 : perspectivePerspectiveProd.set(0,1, 36);
545 1 : perspectivePerspectiveProd.set(0,2, 42);
546 1 : perspectivePerspectiveProd.set(1,0, 66);
547 1 : perspectivePerspectiveProd.set(1,1, 81);
548 1 : perspectivePerspectiveProd.set(1,2, 96);
549 1 : perspectivePerspectiveProd.set(2,0, 102);
550 1 : perspectivePerspectiveProd.set(2,1, 126);
551 1 : perspectivePerspectiveProd.set(2,2, 150);
552 :
553 2 : B2DHomMatrix temp;
554 :
555 1 : temp = maAffine;
556 1 : temp*=maAffine;
557 1 : CPPUNIT_ASSERT_MESSAGE("multiply: both compact", temp == affineAffineProd);
558 :
559 1 : temp = maPerspective;
560 1 : temp*=maAffine;
561 1 : CPPUNIT_ASSERT_MESSAGE("multiply: first compact", temp == affinePerspectiveProd);
562 :
563 1 : temp = maAffine;
564 1 : temp*=maPerspective;
565 1 : CPPUNIT_ASSERT_MESSAGE("multiply: second compact", temp == perspectiveAffineProd);
566 :
567 1 : temp = maPerspective;
568 1 : temp*=maPerspective;
569 2 : CPPUNIT_ASSERT_MESSAGE("multiply: none compact", temp == perspectivePerspectiveProd);
570 1 : }
571 :
572 72 : void impFillMatrix(B2DHomMatrix& rSource, double fScaleX, double fScaleY, double fShearX, double fRotate)
573 : {
574 : // fill rSource with a linear combination of scale, shear and rotate
575 72 : rSource.identity();
576 72 : rSource.scale(fScaleX, fScaleY);
577 72 : rSource.shearX(fShearX);
578 72 : rSource.rotate(fRotate);
579 72 : }
580 :
581 36 : bool impDecomposeComposeTest(double fScaleX, double fScaleY, double fShearX, double fRotate)
582 : {
583 : // linear combine matrix with given values
584 36 : B2DHomMatrix aSource;
585 36 : impFillMatrix(aSource, fScaleX, fScaleY, fShearX, fRotate);
586 :
587 : // decompose that matrix
588 72 : B2DTuple aDScale;
589 72 : B2DTuple aDTrans;
590 : double fDRot;
591 : double fDShX;
592 36 : bool bWorked = aSource.decompose(aDScale, aDTrans, fDRot, fDShX);
593 :
594 : // linear combine another matrix with decomposition results
595 72 : B2DHomMatrix aRecombined;
596 36 : impFillMatrix(aRecombined, aDScale.getX(), aDScale.getY(), fDShX, fDRot);
597 :
598 : // if decomposition worked, matrices need to be the same
599 72 : return bWorked && aSource == aRecombined;
600 : }
601 :
602 1 : void decompose()
603 : {
604 : // test matrix decompositions. Each matrix decomposed and rebuilt
605 : // using the decompose result should be the same as before. Test
606 : // with all ranges of values. Translations are not tested since these
607 : // are just the two rightmost values and uncritical
608 : static double fSX(10.0);
609 : static double fSY(12.0);
610 : static double fR(45.0 * F_PI180);
611 : static double fS(15.0 * F_PI180);
612 :
613 : // check all possible scaling combinations
614 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test A1", impDecomposeComposeTest(fSX, fSY, 0.0, 0.0));
615 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test A2", impDecomposeComposeTest(-fSX, fSY, 0.0, 0.0));
616 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test A3", impDecomposeComposeTest(fSX, -fSY, 0.0, 0.0));
617 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test A4", impDecomposeComposeTest(-fSX, -fSY, 0.0, 0.0));
618 :
619 : // check all possible scaling combinations with positive rotation
620 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test B1", impDecomposeComposeTest(fSX, fSY, 0.0, fR));
621 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test B2", impDecomposeComposeTest(-fSX, fSY, 0.0, fR));
622 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test B3", impDecomposeComposeTest(fSX, -fSY, 0.0, fR));
623 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test B4", impDecomposeComposeTest(-fSX, -fSY, 0.0, fR));
624 :
625 : // check all possible scaling combinations with negative rotation
626 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test C1", impDecomposeComposeTest(fSX, fSY, 0.0, -fR));
627 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test C2", impDecomposeComposeTest(-fSX, fSY, 0.0, -fR));
628 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test C3", impDecomposeComposeTest(fSX, -fSY, 0.0, -fR));
629 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test C4", impDecomposeComposeTest(-fSX, -fSY, 0.0, -fR));
630 :
631 : // check all possible scaling combinations with positive shear
632 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test D1", impDecomposeComposeTest(fSX, fSY, tan(fS), 0.0));
633 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test D2", impDecomposeComposeTest(-fSX, fSY, tan(fS), 0.0));
634 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test D3", impDecomposeComposeTest(fSX, -fSY, tan(fS), 0.0));
635 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test D4", impDecomposeComposeTest(-fSX, -fSY, tan(fS), 0.0));
636 :
637 : // check all possible scaling combinations with negative shear
638 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test E1", impDecomposeComposeTest(fSX, fSY, tan(-fS), 0.0));
639 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test E2", impDecomposeComposeTest(-fSX, fSY, tan(-fS), 0.0));
640 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test E3", impDecomposeComposeTest(fSX, -fSY, tan(-fS), 0.0));
641 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test E4", impDecomposeComposeTest(-fSX, -fSY, tan(-fS), 0.0));
642 :
643 : // check all possible scaling combinations with positive rotate and positive shear
644 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test F1", impDecomposeComposeTest(fSX, fSY, tan(fS), fR));
645 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test F2", impDecomposeComposeTest(-fSX, fSY, tan(fS), fR));
646 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test F3", impDecomposeComposeTest(fSX, -fSY, tan(fS), fR));
647 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test F4", impDecomposeComposeTest(-fSX, -fSY, tan(fS), fR));
648 :
649 : // check all possible scaling combinations with negative rotate and positive shear
650 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test G1", impDecomposeComposeTest(fSX, fSY, tan(fS), -fR));
651 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test G2", impDecomposeComposeTest(-fSX, fSY, tan(fS), -fR));
652 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test G3", impDecomposeComposeTest(fSX, -fSY, tan(fS), -fR));
653 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test G4", impDecomposeComposeTest(-fSX, -fSY, tan(fS), -fR));
654 :
655 : // check all possible scaling combinations with positive rotate and negative shear
656 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test H1", impDecomposeComposeTest(fSX, fSY, tan(-fS), fR));
657 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test H2", impDecomposeComposeTest(-fSX, fSY, tan(-fS), fR));
658 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test H3", impDecomposeComposeTest(fSX, -fSY, tan(-fS), fR));
659 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test H4", impDecomposeComposeTest(-fSX, -fSY, tan(-fS), fR));
660 :
661 : // check all possible scaling combinations with negative rotate and negative shear
662 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test I1", impDecomposeComposeTest(fSX, fSY, tan(-fS), -fR));
663 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test I2", impDecomposeComposeTest(-fSX, fSY, tan(-fS), -fR));
664 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test I3", impDecomposeComposeTest(fSX, -fSY, tan(-fS), -fR));
665 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test I4", impDecomposeComposeTest(-fSX, -fSY, tan(-fS), -fR));
666 :
667 : // cover special case of 180 degree rotation
668 : B2DHomMatrix aTest=tools::createScaleShearXRotateTranslateB2DHomMatrix(
669 : 6425,3938,
670 : 0,
671 : 180*F_PI180,
672 1 : 10482,4921);
673 : // decompose that matrix
674 2 : B2DTuple aDScale;
675 2 : B2DTuple aDTrans;
676 : double fDRot;
677 : double fDShX;
678 1 : aTest.decompose(aDScale, aDTrans, fDRot, fDShX);
679 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test J1", aDScale.getX() == 6425 && aDScale.getY() == 3938);
680 1 : CPPUNIT_ASSERT_MESSAGE("decompose: error test J1", aDTrans.getX() == 10482 && aDTrans.getY() == 4921);
681 2 : CPPUNIT_ASSERT_MESSAGE("decompose: error test J1", fDRot == 180*F_PI180);
682 1 : }
683 :
684 : // Change the following lines only, if you add, remove or rename
685 : // member functions of the current class,
686 : // because these macros are need by auto register mechanism.
687 :
688 2 : CPPUNIT_TEST_SUITE(b2dhommatrix);
689 1 : CPPUNIT_TEST(equal);
690 1 : CPPUNIT_TEST(identity);
691 1 : CPPUNIT_TEST(scale);
692 1 : CPPUNIT_TEST(translate);
693 1 : CPPUNIT_TEST(rotate);
694 1 : CPPUNIT_TEST(shear);
695 1 : CPPUNIT_TEST(multiply);
696 1 : CPPUNIT_TEST(decompose);
697 2 : CPPUNIT_TEST_SUITE_END();
698 :
699 : }; // class b2dhommatrix
700 :
701 :
702 3 : class b2dpoint : public CppUnit::TestFixture
703 : {
704 : public:
705 : // insert your test code here.
706 : // this is only demonstration code
707 1 : void EmptyMethod()
708 : {
709 : // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
710 1 : }
711 :
712 : // Change the following lines only, if you add, remove or rename
713 : // member functions of the current class,
714 : // because these macros are need by auto register mechanism.
715 :
716 2 : CPPUNIT_TEST_SUITE(b2dpoint);
717 1 : CPPUNIT_TEST(EmptyMethod);
718 2 : CPPUNIT_TEST_SUITE_END();
719 : }; // class b2dpoint
720 :
721 :
722 3 : class b2dpolygon : public CppUnit::TestFixture
723 : {
724 : public:
725 : // insert your test code here.
726 1 : void testBasics()
727 : {
728 1 : B2DPolygon aPoly;
729 :
730 1 : aPoly.appendBezierSegment(B2DPoint(1,1),B2DPoint(2,2),B2DPoint(3,3));
731 :
732 2 : CPPUNIT_ASSERT_MESSAGE("#1 first polygon point wrong",
733 1 : aPoly.getB2DPoint(0) == B2DPoint(3,3));
734 2 : CPPUNIT_ASSERT_MESSAGE("#1 first control point wrong",
735 1 : aPoly.getPrevControlPoint(0) == B2DPoint(2,2));
736 2 : CPPUNIT_ASSERT_MESSAGE("#1 second control point wrong",
737 1 : aPoly.getNextControlPoint(0) == B2DPoint(3,3));
738 2 : CPPUNIT_ASSERT_MESSAGE("next control point not used",
739 1 : aPoly.isNextControlPointUsed(0) == false);
740 :
741 1 : aPoly.setNextControlPoint(0,B2DPoint(4,4));
742 2 : CPPUNIT_ASSERT_MESSAGE("#1.1 second control point wrong",
743 1 : aPoly.getNextControlPoint(0) == B2DPoint(4,4));
744 2 : CPPUNIT_ASSERT_MESSAGE("next control point used",
745 1 : aPoly.isNextControlPointUsed(0) == true);
746 2 : CPPUNIT_ASSERT_MESSAGE("areControlPointsUsed() wrong",
747 1 : aPoly.areControlPointsUsed() == true);
748 2 : CPPUNIT_ASSERT_MESSAGE("getContinuityInPoint() wrong",
749 1 : aPoly.getContinuityInPoint(0) == CONTINUITY_C2);
750 :
751 1 : aPoly.resetControlPoints();
752 2 : CPPUNIT_ASSERT_MESSAGE("resetControlPoints() did not clear",
753 1 : aPoly.getB2DPoint(0) == B2DPoint(3,3));
754 2 : CPPUNIT_ASSERT_MESSAGE("resetControlPoints() did not clear",
755 1 : aPoly.getPrevControlPoint(0) == B2DPoint(3,3));
756 2 : CPPUNIT_ASSERT_MESSAGE("resetControlPoints() did not clear",
757 1 : aPoly.getNextControlPoint(0) == B2DPoint(3,3));
758 2 : CPPUNIT_ASSERT_MESSAGE("areControlPointsUsed() wrong #2",
759 1 : aPoly.areControlPointsUsed() == false);
760 :
761 1 : aPoly.clear();
762 1 : aPoly.append(B2DPoint(0,0));
763 1 : aPoly.appendBezierSegment(B2DPoint(1,1),B2DPoint(2,2),B2DPoint(3,3));
764 :
765 2 : CPPUNIT_ASSERT_MESSAGE("#2 first polygon point wrong",
766 1 : aPoly.getB2DPoint(0) == B2DPoint(0,0));
767 2 : CPPUNIT_ASSERT_MESSAGE("#2 first control point wrong",
768 1 : aPoly.getPrevControlPoint(0) == B2DPoint(0,0));
769 2 : CPPUNIT_ASSERT_MESSAGE("#2 second control point wrong",
770 1 : aPoly.getNextControlPoint(0) == B2DPoint(1,1));
771 2 : CPPUNIT_ASSERT_MESSAGE("#2 third control point wrong",
772 1 : aPoly.getPrevControlPoint(1) == B2DPoint(2,2));
773 2 : CPPUNIT_ASSERT_MESSAGE("#2 fourth control point wrong",
774 1 : aPoly.getNextControlPoint(1) == B2DPoint(3,3));
775 2 : CPPUNIT_ASSERT_MESSAGE("#2 second polygon point wrong",
776 2 : aPoly.getB2DPoint(1) == B2DPoint(3,3));
777 1 : }
778 : // Change the following lines only, if you add, remove or rename
779 : // member functions of the current class,
780 : // because these macros are need by auto register mechanism.
781 :
782 2 : CPPUNIT_TEST_SUITE(b2dpolygon);
783 1 : CPPUNIT_TEST(testBasics);
784 2 : CPPUNIT_TEST_SUITE_END();
785 : }; // class b2dpolygon
786 :
787 :
788 3 : class b2dpolygontools : public CppUnit::TestFixture
789 : {
790 : public:
791 : // insert your test code here.
792 : // this is only demonstration code
793 1 : void testIsRectangle()
794 : {
795 : B2DPolygon aRect1(
796 : tools::createPolygonFromRect(
797 1 : B2DRange(0,0,1,1) ) );
798 :
799 2 : B2DPolygon aRect2;
800 1 : aRect2.append( B2DPoint(0,0) );
801 1 : aRect2.append( B2DPoint(1,0) );
802 1 : aRect2.append( B2DPoint(1,.5));
803 1 : aRect2.append( B2DPoint(1,1) );
804 1 : aRect2.append( B2DPoint(0,1) );
805 1 : aRect2.setClosed(true);
806 :
807 2 : B2DPolygon aNonRect1;
808 1 : aNonRect1.append( B2DPoint(0,0) );
809 1 : aNonRect1.append( B2DPoint(1,0) );
810 1 : aNonRect1.append( B2DPoint(1,1) );
811 1 : aNonRect1.append( B2DPoint(0.5,1) );
812 1 : aNonRect1.append( B2DPoint(0.5,0) );
813 1 : aNonRect1.setClosed(true);
814 :
815 2 : B2DPolygon aNonRect2;
816 1 : aNonRect2.append( B2DPoint(0,0) );
817 1 : aNonRect2.append( B2DPoint(1,1) );
818 1 : aNonRect2.append( B2DPoint(1,0) );
819 1 : aNonRect2.append( B2DPoint(0,1) );
820 1 : aNonRect2.setClosed(true);
821 :
822 2 : B2DPolygon aNonRect3;
823 1 : aNonRect3.append( B2DPoint(0,0) );
824 1 : aNonRect3.append( B2DPoint(1,0) );
825 1 : aNonRect3.append( B2DPoint(1,1) );
826 1 : aNonRect3.setClosed(true);
827 :
828 2 : B2DPolygon aNonRect4;
829 1 : aNonRect4.append( B2DPoint(0,0) );
830 1 : aNonRect4.append( B2DPoint(1,0) );
831 1 : aNonRect4.append( B2DPoint(1,1) );
832 1 : aNonRect4.append( B2DPoint(0,1) );
833 :
834 2 : B2DPolygon aNonRect5;
835 1 : aNonRect5.append( B2DPoint(0,0) );
836 1 : aNonRect5.append( B2DPoint(1,0) );
837 1 : aNonRect5.append( B2DPoint(1,1) );
838 1 : aNonRect5.append( B2DPoint(0,1) );
839 1 : aNonRect5.setControlPoints(1,B2DPoint(1,0),B2DPoint(-11,0));
840 1 : aNonRect5.setClosed(true);
841 :
842 2 : CPPUNIT_ASSERT_MESSAGE("checking rectangle-ness of rectangle 1",
843 1 : tools::isRectangle( aRect1 ));
844 2 : CPPUNIT_ASSERT_MESSAGE("checking rectangle-ness of rectangle 2",
845 1 : tools::isRectangle( aRect2 ));
846 2 : CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 1",
847 1 : !tools::isRectangle( aNonRect1 ));
848 2 : CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 2",
849 1 : !tools::isRectangle( aNonRect2 ));
850 2 : CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 3",
851 1 : !tools::isRectangle( aNonRect3 ));
852 2 : CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 4",
853 1 : !tools::isRectangle( aNonRect4 ));
854 2 : CPPUNIT_ASSERT_MESSAGE("checking non-rectangle-ness of polygon 5",
855 2 : !tools::isRectangle( aNonRect5 ));
856 1 : }
857 :
858 : // Change the following lines only, if you add, remove or rename
859 : // member functions of the current class,
860 : // because these macros are need by auto register mechanism.
861 :
862 2 : CPPUNIT_TEST_SUITE(b2dpolygontools);
863 1 : CPPUNIT_TEST(testIsRectangle);
864 2 : CPPUNIT_TEST_SUITE_END();
865 : }; // class b2dpolygontools
866 :
867 :
868 3 : class b2dpolypolygon : public CppUnit::TestFixture
869 : {
870 : public:
871 : // insert your test code here.
872 1 : void EmptyMethod()
873 : {
874 1 : }
875 :
876 : // Change the following lines only, if you add, remove or rename
877 : // member functions of the current class,
878 : // because these macros are need by auto register mechanism.
879 :
880 2 : CPPUNIT_TEST_SUITE(b2dpolypolygon);
881 1 : CPPUNIT_TEST(EmptyMethod);
882 2 : CPPUNIT_TEST_SUITE_END();
883 : }; // class b2dpolypolygon
884 :
885 3 : class b1Xrange : public CppUnit::TestFixture
886 : {
887 : public:
888 2 : template<class Type> void implCheck()
889 : {
890 : // test interval axioms
891 : // (http://en.wikipedia.org/wiki/Interval_%28mathematics%29)
892 2 : Type aRange;
893 2 : CPPUNIT_ASSERT_MESSAGE("default ctor - empty range", aRange.isEmpty());
894 2 : CPPUNIT_ASSERT_MESSAGE("center - get cop-out value since range is empty", aRange.getCenter()==0);
895 :
896 : // degenerate interval
897 2 : aRange.expand(1);
898 2 : CPPUNIT_ASSERT_MESSAGE("degenerate range - still, not empty!", !aRange.isEmpty());
899 2 : CPPUNIT_ASSERT_MESSAGE("degenerate range - size of 0", aRange.getRange() == 0);
900 2 : CPPUNIT_ASSERT_MESSAGE("same value as degenerate range - is inside range", aRange.isInside(1));
901 2 : CPPUNIT_ASSERT_MESSAGE("center - must be the single range value", aRange.getCenter()==1);
902 :
903 : // proper interval
904 2 : aRange.expand(2);
905 2 : CPPUNIT_ASSERT_MESSAGE("proper range - size of 1", aRange.getRange() == 1);
906 2 : CPPUNIT_ASSERT_MESSAGE("smaller value of range - is inside *closed* range", aRange.isInside(1));
907 2 : CPPUNIT_ASSERT_MESSAGE("larger value of range - is inside *closed* range", aRange.isInside(2));
908 :
909 : // center for proper interval that works for ints, too
910 2 : aRange.expand(3);
911 2 : CPPUNIT_ASSERT_MESSAGE("center - must be half of the range", aRange.getCenter()==2);
912 :
913 : // check overlap
914 2 : Type aRange2(0,1);
915 2 : CPPUNIT_ASSERT_MESSAGE("range overlapping *includes* upper bound", aRange.overlaps(aRange2));
916 2 : CPPUNIT_ASSERT_MESSAGE("range overlapping *includes* upper bound, but only barely", !aRange.overlapsMore(aRange2));
917 :
918 2 : Type aRange3(0,2);
919 2 : CPPUNIT_ASSERT_MESSAGE("range overlapping is fully overlapping now", aRange.overlapsMore(aRange3));
920 :
921 : // check intersect
922 2 : Type aRange4(3,4);
923 2 : aRange.intersect(aRange4);
924 2 : CPPUNIT_ASSERT_MESSAGE("range intersection is yielding empty range!", !aRange.isEmpty());
925 :
926 2 : Type aRange5(5,6);
927 2 : aRange.intersect(aRange5);
928 2 : CPPUNIT_ASSERT_MESSAGE("range intersection is yielding nonempty range!", aRange.isEmpty());
929 :
930 : // just so that this compiles -
931 2 : Type aRange6( aRange );
932 : (void)aRange6;
933 2 : }
934 :
935 1 : void check()
936 : {
937 1 : implCheck<B1DRange>();
938 1 : implCheck<B1IRange>();
939 1 : }
940 :
941 : // Change the following lines only, if you add, remove or rename
942 : // member functions of the current class,
943 : // because these macros are need by auto register mechanism.
944 :
945 2 : CPPUNIT_TEST_SUITE(b1Xrange);
946 1 : CPPUNIT_TEST(check);
947 2 : CPPUNIT_TEST_SUITE_END();
948 : }; // class b1Xrange
949 :
950 :
951 3 : class b1ibox : public CppUnit::TestFixture
952 : {
953 : public:
954 1 : void TestBox()
955 : {
956 : // test axioms - markedly different from proper mathematical
957 : // intervals (behaviour modelled after how polygon fill
958 : // algorithms fill pixels)
959 1 : B1IBox aBox;
960 1 : CPPUNIT_ASSERT_MESSAGE("default ctor - empty range", aBox.isEmpty());
961 :
962 : // degenerate box
963 1 : aBox.expand(1);
964 1 : CPPUNIT_ASSERT_MESSAGE("degenerate box - still empty!", aBox.isEmpty());
965 1 : CPPUNIT_ASSERT_MESSAGE("degenerate box - size of 0", aBox.getRange() == 0);
966 1 : CPPUNIT_ASSERT_MESSAGE("same value as degenerate box - is outside (since empty)", !aBox.isInside(1));
967 1 : CPPUNIT_ASSERT_MESSAGE("center - get cop-out value since box is empty", aBox.getCenter()==0);
968 :
969 : // proper box
970 1 : aBox.expand(2);
971 1 : CPPUNIT_ASSERT_MESSAGE("proper box - size of 1", aBox.getRange() == 1);
972 1 : CPPUNIT_ASSERT_MESSAGE("smaller value of box", aBox.isInside(1));
973 1 : CPPUNIT_ASSERT_MESSAGE("larger value of box - must be outside", !aBox.isInside(2));
974 :
975 : // center for proper box that works for ints, too
976 1 : aBox.expand(4);
977 1 : CPPUNIT_ASSERT_MESSAGE("center - must be center pixel of the box", aBox.getCenter()==2);
978 :
979 : // check overlap, which is markedly different from Range
980 1 : B1IBox aBox2(0,1);
981 1 : CPPUNIT_ASSERT_MESSAGE("box overlapping *excludes* upper bound", !aBox.overlaps(aBox2));
982 :
983 1 : B1IBox aBox3(0,2);
984 1 : CPPUNIT_ASSERT_MESSAGE("box overlapping then includes upper bound-1", aBox.overlaps(aBox3));
985 :
986 : // check intersect
987 1 : B1IBox aBox4(4,5);
988 1 : aBox.intersect(aBox4);
989 1 : CPPUNIT_ASSERT_MESSAGE("box intersection is yielding nonempty box!", aBox.isEmpty());
990 :
991 1 : B1IBox aBox5(2,5);
992 1 : aBox5.intersect(aBox4);
993 1 : CPPUNIT_ASSERT_MESSAGE("box intersection is yielding empty box!", !aBox5.isEmpty());
994 :
995 : // just so that this compiles -
996 1 : B1IBox aBox6( aBox );
997 : (void)aBox6;
998 1 : }
999 :
1000 : // Change the following lines only, if you add, remove or rename
1001 : // member functions of the current class,
1002 : // because these macros are need by auto register mechanism.
1003 :
1004 2 : CPPUNIT_TEST_SUITE(b1ibox);
1005 1 : CPPUNIT_TEST(TestBox);
1006 2 : CPPUNIT_TEST_SUITE_END();
1007 : }; // class b1ibox
1008 :
1009 :
1010 3 : class b2Xrange : public CppUnit::TestFixture
1011 : {
1012 : public:
1013 2 : template<class Type> void implCheck()
1014 : {
1015 : // cohen sutherland clipping
1016 2 : Type aRange(0,0,10,10);
1017 :
1018 2 : CPPUNIT_ASSERT_MESSAGE("(0,0) is outside range!",
1019 : tools::getCohenSutherlandClipFlags(B2IPoint(0,0),aRange) == 0);
1020 2 : CPPUNIT_ASSERT_MESSAGE("(-1,-1) is inside range!",
1021 : tools::getCohenSutherlandClipFlags(B2IPoint(-1,-1),aRange) ==
1022 : (tools::RectClipFlags::LEFT|tools::RectClipFlags::TOP));
1023 2 : CPPUNIT_ASSERT_MESSAGE("(10,10) is outside range!",
1024 : tools::getCohenSutherlandClipFlags(B2IPoint(10,10),aRange) == 0);
1025 2 : CPPUNIT_ASSERT_MESSAGE("(11,11) is inside range!",
1026 : tools::getCohenSutherlandClipFlags(B2IPoint(11,11),aRange) ==
1027 : (tools::RectClipFlags::RIGHT|tools::RectClipFlags::BOTTOM));
1028 :
1029 : // just so that this compiles -
1030 2 : Type aRange1( aRange );
1031 : (void)aRange1;
1032 2 : }
1033 :
1034 1 : void check()
1035 : {
1036 1 : implCheck<B2DRange>();
1037 1 : implCheck<B2IRange>();
1038 1 : }
1039 :
1040 : // Change the following lines only, if you add, remove or rename
1041 : // member functions of the current class,
1042 : // because these macros are need by auto register mechanism.
1043 :
1044 2 : CPPUNIT_TEST_SUITE(b2Xrange);
1045 1 : CPPUNIT_TEST(check);
1046 2 : CPPUNIT_TEST_SUITE_END();
1047 : }; // class b2Xrange
1048 :
1049 :
1050 3 : class b2ibox : public CppUnit::TestFixture
1051 : {
1052 : public:
1053 1 : void TestBox()
1054 : {
1055 : // cohen sutherland clipping
1056 1 : B2IBox aBox(0,0,10,10);
1057 :
1058 2 : CPPUNIT_ASSERT_MESSAGE("(0,0) is outside range!",
1059 1 : tools::getCohenSutherlandClipFlags(B2IPoint(0,0),aBox) == 0);
1060 2 : CPPUNIT_ASSERT_MESSAGE("(-1,-1) is inside range!",
1061 : tools::getCohenSutherlandClipFlags(B2IPoint(-1,-1),aBox) ==
1062 1 : (tools::RectClipFlags::LEFT|tools::RectClipFlags::TOP));
1063 2 : CPPUNIT_ASSERT_MESSAGE("(9,9) is outside range!",
1064 1 : tools::getCohenSutherlandClipFlags(B2IPoint(9,9),aBox) == 0);
1065 2 : CPPUNIT_ASSERT_MESSAGE("(10,10) is inside range!",
1066 : tools::getCohenSutherlandClipFlags(B2IPoint(10,10),aBox) ==
1067 1 : (tools::RectClipFlags::RIGHT|tools::RectClipFlags::BOTTOM));
1068 :
1069 : // just so that this compiles -
1070 1 : B2IBox aBox1( aBox );
1071 : (void)aBox1;
1072 1 : }
1073 :
1074 : // Change the following lines only, if you add, remove or rename
1075 : // member functions of the current class,
1076 : // because these macros are need by auto register mechanism.
1077 2 : CPPUNIT_TEST_SUITE(b2ibox);
1078 1 : CPPUNIT_TEST(TestBox);
1079 2 : CPPUNIT_TEST_SUITE_END();
1080 : }; // class b2ibox
1081 :
1082 :
1083 3 : class b2dtuple : public CppUnit::TestFixture
1084 : {
1085 : public:
1086 : // insert your test code here.
1087 : // this is only demonstration code
1088 1 : void EmptyMethod()
1089 : {
1090 : // CPPUNIT_ASSERT_MESSAGE("a message", 1 == 1);
1091 1 : }
1092 :
1093 : // Change the following lines only, if you add, remove or rename
1094 : // member functions of the current class,
1095 : // because these macros are need by auto register mechanism.
1096 :
1097 2 : CPPUNIT_TEST_SUITE(b2dtuple);
1098 1 : CPPUNIT_TEST(EmptyMethod);
1099 2 : CPPUNIT_TEST_SUITE_END();
1100 : }; // class b2dtuple
1101 :
1102 6 : class bcolor : public CppUnit::TestFixture
1103 : {
1104 : BColor maWhite;
1105 : BColor maBlack;
1106 : BColor maRed;
1107 : BColor maGreen;
1108 : BColor maBlue;
1109 : BColor maYellow;
1110 : BColor maMagenta;
1111 : BColor maCyan;
1112 :
1113 : public:
1114 3 : bcolor() :
1115 : maWhite(1,1,1),
1116 : maBlack(0,0,0),
1117 : maRed(1,0,0),
1118 : maGreen(0,1,0),
1119 : maBlue(0,0,1),
1120 : maYellow(1,1,0),
1121 : maMagenta(1,0,1),
1122 3 : maCyan(0,1,1)
1123 3 : {}
1124 :
1125 : // insert your test code here.
1126 1 : void hslTest()
1127 : {
1128 2 : CPPUNIT_ASSERT_MESSAGE("white",
1129 1 : tools::rgb2hsl(maWhite) == BColor(0,0,1));
1130 2 : CPPUNIT_ASSERT_MESSAGE("black",
1131 1 : tools::rgb2hsl(maBlack) == BColor(0,0,0));
1132 2 : CPPUNIT_ASSERT_MESSAGE("red",
1133 1 : tools::rgb2hsl(maRed) == BColor(0,1,0.5));
1134 2 : CPPUNIT_ASSERT_MESSAGE("green",
1135 1 : tools::rgb2hsl(maGreen) == BColor(120,1,0.5));
1136 2 : CPPUNIT_ASSERT_MESSAGE("blue",
1137 1 : tools::rgb2hsl(maBlue) == BColor(240,1,0.5));
1138 2 : CPPUNIT_ASSERT_MESSAGE("yellow",
1139 1 : tools::rgb2hsl(maYellow) == BColor(60,1,0.5));
1140 2 : CPPUNIT_ASSERT_MESSAGE("magenta",
1141 1 : tools::rgb2hsl(maMagenta) == BColor(300,1,0.5));
1142 2 : CPPUNIT_ASSERT_MESSAGE("cyan",
1143 1 : tools::rgb2hsl(maCyan) == BColor(180,1,0.5));
1144 2 : CPPUNIT_ASSERT_MESSAGE("third hue case",
1145 1 : tools::rgb2hsl(BColor(0,0.5,1)) == BColor(210,1,0.5));
1146 :
1147 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip white",
1148 1 : tools::hsl2rgb(tools::rgb2hsl(maWhite)) == maWhite);
1149 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip black",
1150 1 : tools::hsl2rgb(tools::rgb2hsl(maBlack)) == maBlack);
1151 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip red",
1152 1 : tools::hsl2rgb(tools::rgb2hsl(maRed)) == maRed);
1153 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip green",
1154 1 : tools::hsl2rgb(tools::rgb2hsl(maGreen)) == maGreen);
1155 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip blue",
1156 1 : tools::hsl2rgb(tools::rgb2hsl(maBlue)) == maBlue);
1157 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip yellow",
1158 1 : tools::hsl2rgb(tools::rgb2hsl(maYellow)) == maYellow);
1159 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip magenta",
1160 1 : tools::hsl2rgb(tools::rgb2hsl(maMagenta)) == maMagenta);
1161 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip cyan",
1162 1 : tools::hsl2rgb(tools::rgb2hsl(maCyan)) == maCyan);
1163 :
1164 2 : CPPUNIT_ASSERT_MESSAGE("grey10",
1165 1 : tools::rgb2hsl(maWhite*.1) == BColor(0,0,.1));
1166 2 : CPPUNIT_ASSERT_MESSAGE("grey90",
1167 1 : tools::rgb2hsl(maWhite*.9) == BColor(0,0,.9));
1168 2 : CPPUNIT_ASSERT_MESSAGE("red/2",
1169 1 : tools::rgb2hsl(maRed*.5) == BColor(0,1,0.25));
1170 2 : CPPUNIT_ASSERT_MESSAGE("green/2",
1171 1 : tools::rgb2hsl(maGreen*.5) == BColor(120,1,0.25));
1172 2 : CPPUNIT_ASSERT_MESSAGE("blue/2",
1173 1 : tools::rgb2hsl(maBlue*.5) == BColor(240,1,0.25));
1174 2 : CPPUNIT_ASSERT_MESSAGE("yellow/2",
1175 1 : tools::rgb2hsl(maYellow*.5) == BColor(60,1,0.25));
1176 2 : CPPUNIT_ASSERT_MESSAGE("magenta/2",
1177 1 : tools::rgb2hsl(maMagenta*.5) == BColor(300,1,0.25));
1178 2 : CPPUNIT_ASSERT_MESSAGE("cyan/2",
1179 1 : tools::rgb2hsl(maCyan*.5) == BColor(180,1,0.25));
1180 :
1181 2 : CPPUNIT_ASSERT_MESSAGE("pastel",
1182 1 : tools::rgb2hsl(BColor(.75,.25,.25)) == BColor(0,.5,.5));
1183 1 : }
1184 :
1185 : // insert your test code here.
1186 1 : void hsvTest()
1187 : {
1188 2 : CPPUNIT_ASSERT_MESSAGE("white",
1189 1 : tools::rgb2hsv(maWhite) == BColor(0,0,1));
1190 2 : CPPUNIT_ASSERT_MESSAGE("black",
1191 1 : tools::rgb2hsv(maBlack) == BColor(0,0,0));
1192 2 : CPPUNIT_ASSERT_MESSAGE("red",
1193 1 : tools::rgb2hsv(maRed) == BColor(0,1,1));
1194 2 : CPPUNIT_ASSERT_MESSAGE("green",
1195 1 : tools::rgb2hsv(maGreen) == BColor(120,1,1));
1196 2 : CPPUNIT_ASSERT_MESSAGE("blue",
1197 1 : tools::rgb2hsv(maBlue) == BColor(240,1,1));
1198 2 : CPPUNIT_ASSERT_MESSAGE("yellow",
1199 1 : tools::rgb2hsv(maYellow) == BColor(60,1,1));
1200 2 : CPPUNIT_ASSERT_MESSAGE("magenta",
1201 1 : tools::rgb2hsv(maMagenta) == BColor(300,1,1));
1202 2 : CPPUNIT_ASSERT_MESSAGE("cyan",
1203 1 : tools::rgb2hsv(maCyan) == BColor(180,1,1));
1204 :
1205 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip white",
1206 1 : tools::hsv2rgb(tools::rgb2hsv(maWhite)) == maWhite);
1207 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip black",
1208 1 : tools::hsv2rgb(tools::rgb2hsv(maBlack)) == maBlack);
1209 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip red",
1210 1 : tools::hsv2rgb(tools::rgb2hsv(maRed)) == maRed);
1211 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip green",
1212 1 : tools::hsv2rgb(tools::rgb2hsv(maGreen)) == maGreen);
1213 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip blue",
1214 1 : tools::hsv2rgb(tools::rgb2hsv(maBlue)) == maBlue);
1215 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip yellow",
1216 1 : tools::hsv2rgb(tools::rgb2hsv(maYellow)) == maYellow);
1217 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip magenta",
1218 1 : tools::hsv2rgb(tools::rgb2hsv(maMagenta)) == maMagenta);
1219 2 : CPPUNIT_ASSERT_MESSAGE("roundtrip cyan",
1220 1 : tools::hsv2rgb(tools::rgb2hsv(maCyan)) == maCyan);
1221 :
1222 2 : CPPUNIT_ASSERT_MESSAGE("grey10",
1223 1 : tools::rgb2hsv(maWhite*.1) == BColor(0,0,.1));
1224 2 : CPPUNIT_ASSERT_MESSAGE("grey90",
1225 1 : tools::rgb2hsv(maWhite*.9) == BColor(0,0,.9));
1226 2 : CPPUNIT_ASSERT_MESSAGE("red/2",
1227 1 : tools::rgb2hsv(maRed*.5) == BColor(0,1,0.5));
1228 2 : CPPUNIT_ASSERT_MESSAGE("green/2",
1229 1 : tools::rgb2hsv(maGreen*.5) == BColor(120,1,0.5));
1230 2 : CPPUNIT_ASSERT_MESSAGE("blue/2",
1231 1 : tools::rgb2hsv(maBlue*.5) == BColor(240,1,0.5));
1232 2 : CPPUNIT_ASSERT_MESSAGE("yellow/2",
1233 1 : tools::rgb2hsv(maYellow*.5) == BColor(60,1,0.5));
1234 2 : CPPUNIT_ASSERT_MESSAGE("magenta/2",
1235 1 : tools::rgb2hsv(maMagenta*.5) == BColor(300,1,0.5));
1236 2 : CPPUNIT_ASSERT_MESSAGE("cyan/2",
1237 1 : tools::rgb2hsv(maCyan*.5) == BColor(180,1,0.5));
1238 :
1239 2 : CPPUNIT_ASSERT_MESSAGE("pastel",
1240 1 : tools::rgb2hsv(BColor(.5,.25,.25)) == BColor(0,.5,.5));
1241 1 : }
1242 :
1243 1 : void ciexyzTest()
1244 : {
1245 1 : tools::rgb2ciexyz(maWhite);
1246 1 : tools::rgb2ciexyz(maBlack);
1247 1 : tools::rgb2ciexyz(maRed);
1248 1 : tools::rgb2ciexyz(maGreen);
1249 1 : tools::rgb2ciexyz(maBlue);
1250 1 : tools::rgb2ciexyz(maYellow);
1251 1 : tools::rgb2ciexyz(maMagenta);
1252 1 : tools::rgb2ciexyz(maCyan);
1253 1 : }
1254 :
1255 : // Change the following lines only, if you add, remove or rename
1256 : // member functions of the current class,
1257 : // because these macros are need by auto register mechanism.
1258 :
1259 2 : CPPUNIT_TEST_SUITE(bcolor);
1260 1 : CPPUNIT_TEST(hslTest);
1261 1 : CPPUNIT_TEST(hsvTest);
1262 1 : CPPUNIT_TEST(ciexyzTest);
1263 2 : CPPUNIT_TEST_SUITE_END();
1264 : }; // class b2dvector
1265 :
1266 : // -----------------------------------------------------------------------------
1267 :
1268 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dsvgdimpex);
1269 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2drange);
1270 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolyrange);
1271 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dhommatrix);
1272 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpoint);
1273 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolygon);
1274 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolygontools);
1275 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dpolypolygon);
1276 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b1Xrange);
1277 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b1ibox);
1278 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2Xrange);
1279 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2ibox);
1280 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::b2dtuple);
1281 1 : CPPUNIT_TEST_SUITE_REGISTRATION(basegfx2d::bcolor);
1282 3 : } // namespace basegfx2d
1283 :
1284 :
1285 : // -----------------------------------------------------------------------------
1286 :
1287 : // this macro creates an empty function, which will called by the RegisterAllFunctions()
1288 : // to let the user the possibility to also register some functions by hand.
1289 : // NOADDITIONAL;
1290 :
1291 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|