gdiplus: Implement GdipIsVisibleRegionRect.
[wine.git] / dlls / gdiplus / tests / region.c
blobb3142ba7fa4d5ded157029ea8549c3a6227a0a69
1 /*
2 * Unit test suite for gdiplus regions
4 * Copyright (C) 2008 Huw Davies
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "windows.h"
22 #include "gdiplus.h"
23 #include "wingdi.h"
24 #include "wine/test.h"
26 #define RGNDATA_RECT 0x10000000
27 #define RGNDATA_PATH 0x10000001
28 #define RGNDATA_EMPTY_RECT 0x10000002
29 #define RGNDATA_INFINITE_RECT 0x10000003
31 #define RGNDATA_MAGIC 0xdbc01001
32 #define RGNDATA_MAGIC2 0xdbc01002
34 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
36 #define expect_magic(value) ok(*value == RGNDATA_MAGIC || *value == RGNDATA_MAGIC2, "Expected a known magic value, got %8x\n", *value)
38 #define expect_dword(value, expected) ok(*(value) == expected, "expected %08x got %08x\n", expected, *(value))
40 static inline void expect_float(DWORD *value, FLOAT expected)
42 FLOAT valuef = *(FLOAT*)value;
43 ok(valuef == expected, "expected %f got %f\n", expected, valuef);
46 /* We get shorts back, not INTs like a GpPoint */
47 typedef struct RegionDataPoint
49 short X, Y;
50 } RegionDataPoint;
52 static void verify_region(HRGN hrgn, const RECT *rc)
54 union
56 RGNDATA data;
57 char buf[sizeof(RGNDATAHEADER) + sizeof(RECT)];
58 } rgn;
59 const RECT *rect;
60 DWORD ret;
62 ret = GetRegionData(hrgn, 0, NULL);
63 if (IsRectEmpty(rc))
64 ok(ret == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", ret);
65 else
66 ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);
68 if (!ret) return;
70 ret = GetRegionData(hrgn, sizeof(rgn), &rgn.data);
71 if (IsRectEmpty(rc))
72 ok(ret == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", ret);
73 else
74 ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);
76 trace("size %u, type %u, count %u, rgn size %u, bound (%d,%d-%d,%d)\n",
77 rgn.data.rdh.dwSize, rgn.data.rdh.iType,
78 rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize,
79 rgn.data.rdh.rcBound.left, rgn.data.rdh.rcBound.top,
80 rgn.data.rdh.rcBound.right, rgn.data.rdh.rcBound.bottom);
81 if (rgn.data.rdh.nCount != 0)
83 rect = (const RECT *)rgn.data.Buffer;
84 trace("rect (%d,%d-%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom);
85 ok(EqualRect(rect, rc), "rects don't match\n");
88 ok(rgn.data.rdh.dwSize == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", rgn.data.rdh.dwSize);
89 ok(rgn.data.rdh.iType == RDH_RECTANGLES, "expected RDH_RECTANGLES, got %u\n", rgn.data.rdh.iType);
90 if (IsRectEmpty(rc))
92 ok(rgn.data.rdh.nCount == 0, "expected 0, got %u\n", rgn.data.rdh.nCount);
93 ok(rgn.data.rdh.nRgnSize == 0, "expected 0, got %u\n", rgn.data.rdh.nRgnSize);
95 else
97 ok(rgn.data.rdh.nCount == 1, "expected 1, got %u\n", rgn.data.rdh.nCount);
98 ok(rgn.data.rdh.nRgnSize == sizeof(RECT), "expected sizeof(RECT), got %u\n", rgn.data.rdh.nRgnSize);
100 ok(EqualRect(&rgn.data.rdh.rcBound, rc), "rects don't match\n");
103 static void test_getregiondata(void)
105 GpStatus status;
106 GpRegion *region, *region2;
107 RegionDataPoint *point;
108 UINT needed;
109 DWORD buf[100];
110 GpRect rect;
111 GpPath *path;
113 memset(buf, 0xee, sizeof(buf));
115 status = GdipCreateRegion(&region);
116 ok(status == Ok, "status %08x\n", status);
118 status = GdipGetRegionDataSize(region, &needed);
119 ok(status == Ok, "status %08x\n", status);
120 expect(20, needed);
121 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
122 ok(status == Ok, "status %08x\n", status);
123 expect(20, needed);
124 expect_dword(buf, 12);
125 trace("buf[1] = %08x\n", buf[1]);
126 expect_magic((DWORD*)(buf + 2));
127 expect_dword(buf + 3, 0);
128 expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
130 status = GdipSetEmpty(region);
131 ok(status == Ok, "status %08x\n", status);
132 status = GdipGetRegionDataSize(region, &needed);
133 ok(status == Ok, "status %08x\n", status);
134 expect(20, needed);
135 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
136 ok(status == Ok, "status %08x\n", status);
137 expect(20, needed);
138 expect_dword(buf, 12);
139 trace("buf[1] = %08x\n", buf[1]);
140 expect_magic((DWORD*)(buf + 2));
141 expect_dword(buf + 3, 0);
142 expect_dword(buf + 4, RGNDATA_EMPTY_RECT);
144 status = GdipSetInfinite(region);
145 ok(status == Ok, "status %08x\n", status);
146 status = GdipGetRegionDataSize(region, &needed);
147 ok(status == Ok, "status %08x\n", status);
148 expect(20, needed);
149 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
150 ok(status == Ok, "status %08x\n", status);
151 expect(20, needed);
152 expect_dword(buf, 12);
153 trace("buf[1] = %08x\n", buf[1]);
154 expect_magic((DWORD*)(buf + 2));
155 expect_dword(buf + 3, 0);
156 expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
158 status = GdipDeleteRegion(region);
159 ok(status == Ok, "status %08x\n", status);
161 rect.X = 10;
162 rect.Y = 20;
163 rect.Width = 100;
164 rect.Height = 200;
165 status = GdipCreateRegionRectI(&rect, &region);
166 ok(status == Ok, "status %08x\n", status);
167 status = GdipGetRegionDataSize(region, &needed);
168 ok(status == Ok, "status %08x\n", status);
169 expect(36, needed);
170 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
171 ok(status == Ok, "status %08x\n", status);
172 expect(36, needed);
173 expect_dword(buf, 28);
174 trace("buf[1] = %08x\n", buf[1]);
175 expect_magic((DWORD*)(buf + 2));
176 expect_dword(buf + 3, 0);
177 expect_dword(buf + 4, RGNDATA_RECT);
178 expect_float(buf + 5, 10.0);
179 expect_float(buf + 6, 20.0);
180 expect_float(buf + 7, 100.0);
181 expect_float(buf + 8, 200.0);
183 rect.X = 50;
184 rect.Y = 30;
185 rect.Width = 10;
186 rect.Height = 20;
187 status = GdipCombineRegionRectI(region, &rect, CombineModeIntersect);
188 ok(status == Ok, "status %08x\n", status);
189 rect.X = 100;
190 rect.Y = 300;
191 rect.Width = 30;
192 rect.Height = 50;
193 status = GdipCombineRegionRectI(region, &rect, CombineModeXor);
194 ok(status == Ok, "status %08x\n", status);
196 rect.X = 200;
197 rect.Y = 100;
198 rect.Width = 133;
199 rect.Height = 266;
200 status = GdipCreateRegionRectI(&rect, &region2);
201 ok(status == Ok, "status %08x\n", status);
202 rect.X = 20;
203 rect.Y = 10;
204 rect.Width = 40;
205 rect.Height = 66;
206 status = GdipCombineRegionRectI(region2, &rect, CombineModeUnion);
207 ok(status == Ok, "status %08x\n", status);
209 status = GdipCombineRegionRegion(region, region2, CombineModeComplement);
210 ok(status == Ok, "status %08x\n", status);
212 rect.X = 400;
213 rect.Y = 500;
214 rect.Width = 22;
215 rect.Height = 55;
216 status = GdipCombineRegionRectI(region, &rect, CombineModeExclude);
217 ok(status == Ok, "status %08x\n", status);
219 status = GdipGetRegionDataSize(region, &needed);
220 ok(status == Ok, "status %08x\n", status);
221 expect(156, needed);
222 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
223 ok(status == Ok, "status %08x\n", status);
224 expect(156, needed);
225 expect_dword(buf, 148);
226 trace("buf[1] = %08x\n", buf[1]);
227 expect_magic((DWORD*)(buf + 2));
228 expect_dword(buf + 3, 10);
229 expect_dword(buf + 4, CombineModeExclude);
230 expect_dword(buf + 5, CombineModeComplement);
231 expect_dword(buf + 6, CombineModeXor);
232 expect_dword(buf + 7, CombineModeIntersect);
233 expect_dword(buf + 8, RGNDATA_RECT);
234 expect_float(buf + 9, 10.0);
235 expect_float(buf + 10, 20.0);
236 expect_float(buf + 11, 100.0);
237 expect_float(buf + 12, 200.0);
238 expect_dword(buf + 13, RGNDATA_RECT);
239 expect_float(buf + 14, 50.0);
240 expect_float(buf + 15, 30.0);
241 expect_float(buf + 16, 10.0);
242 expect_float(buf + 17, 20.0);
243 expect_dword(buf + 18, RGNDATA_RECT);
244 expect_float(buf + 19, 100.0);
245 expect_float(buf + 20, 300.0);
246 expect_float(buf + 21, 30.0);
247 expect_float(buf + 22, 50.0);
248 expect_dword(buf + 23, CombineModeUnion);
249 expect_dword(buf + 24, RGNDATA_RECT);
250 expect_float(buf + 25, 200.0);
251 expect_float(buf + 26, 100.0);
252 expect_float(buf + 27, 133.0);
253 expect_float(buf + 28, 266.0);
254 expect_dword(buf + 29, RGNDATA_RECT);
255 expect_float(buf + 30, 20.0);
256 expect_float(buf + 31, 10.0);
257 expect_float(buf + 32, 40.0);
258 expect_float(buf + 33, 66.0);
259 expect_dword(buf + 34, RGNDATA_RECT);
260 expect_float(buf + 35, 400.0);
261 expect_float(buf + 36, 500.0);
262 expect_float(buf + 37, 22.0);
263 expect_float(buf + 38, 55.0);
265 status = GdipDeleteRegion(region2);
266 ok(status == Ok, "status %08x\n", status);
267 status = GdipDeleteRegion(region);
268 ok(status == Ok, "status %08x\n", status);
270 /* Try some paths */
272 status = GdipCreatePath(FillModeAlternate, &path);
273 ok(status == Ok, "status %08x\n", status);
274 GdipAddPathRectangle(path, 12.5, 13.0, 14.0, 15.0);
276 status = GdipCreateRegionPath(path, &region);
277 ok(status == Ok, "status %08x\n", status);
278 status = GdipGetRegionDataSize(region, &needed);
279 ok(status == Ok, "status %08x\n", status);
280 expect(72, needed);
281 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
282 ok(status == Ok, "status %08x\n", status);
283 expect(72, needed);
284 expect_dword(buf, 64);
285 trace("buf[1] = %08x\n", buf[1]);
286 expect_magic((DWORD*)(buf + 2));
287 expect_dword(buf + 3, 0);
288 expect_dword(buf + 4, RGNDATA_PATH);
289 expect_dword(buf + 5, 0x00000030);
290 expect_magic((DWORD*)(buf + 6));
291 expect_dword(buf + 7, 0x00000004);
292 expect_dword(buf + 8, 0x00000000);
293 expect_float(buf + 9, 12.5);
294 expect_float(buf + 10, 13.0);
295 expect_float(buf + 11, 26.5);
296 expect_float(buf + 12, 13.0);
297 expect_float(buf + 13, 26.5);
298 expect_float(buf + 14, 28.0);
299 expect_float(buf + 15, 12.5);
300 expect_float(buf + 16, 28.0);
301 expect_dword(buf + 17, 0x81010100);
304 rect.X = 50;
305 rect.Y = 30;
306 rect.Width = 10;
307 rect.Height = 20;
308 status = GdipCombineRegionRectI(region, &rect, CombineModeIntersect);
309 ok(status == Ok, "status %08x\n", status);
310 status = GdipGetRegionDataSize(region, &needed);
311 ok(status == Ok, "status %08x\n", status);
312 expect(96, needed);
313 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
314 ok(status == Ok, "status %08x\n", status);
315 expect(96, needed);
316 expect_dword(buf, 88);
317 trace("buf[1] = %08x\n", buf[1]);
318 expect_magic((DWORD*)(buf + 2));
319 expect_dword(buf + 3, 2);
320 expect_dword(buf + 4, CombineModeIntersect);
321 expect_dword(buf + 5, RGNDATA_PATH);
322 expect_dword(buf + 6, 0x00000030);
323 expect_magic((DWORD*)(buf + 7));
324 expect_dword(buf + 8, 0x00000004);
325 expect_dword(buf + 9, 0x00000000);
326 expect_float(buf + 10, 12.5);
327 expect_float(buf + 11, 13.0);
328 expect_float(buf + 12, 26.5);
329 expect_float(buf + 13, 13.0);
330 expect_float(buf + 14, 26.5);
331 expect_float(buf + 15, 28.0);
332 expect_float(buf + 16, 12.5);
333 expect_float(buf + 17, 28.0);
334 expect_dword(buf + 18, 0x81010100);
335 expect_dword(buf + 19, RGNDATA_RECT);
336 expect_float(buf + 20, 50.0);
337 expect_float(buf + 21, 30.0);
338 expect_float(buf + 22, 10.0);
339 expect_float(buf + 23, 20.0);
341 status = GdipDeleteRegion(region);
342 ok(status == Ok, "status %08x\n", status);
343 status = GdipDeletePath(path);
344 ok(status == Ok, "status %08x\n", status);
346 /* Test an empty path */
347 status = GdipCreatePath(FillModeAlternate, &path);
348 expect(Ok, status);
349 status = GdipCreateRegionPath(path, &region);
350 expect(Ok, status);
351 status = GdipGetRegionDataSize(region, &needed);
352 expect(Ok, status);
353 expect(36, needed);
354 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
355 expect(Ok, status);
356 expect(36, needed);
357 expect_dword(buf, 28);
358 trace("buf[1] = %08x\n", buf[1]);
359 expect_magic((DWORD*)(buf + 2));
360 expect_dword(buf + 3, 0);
361 expect_dword(buf + 4, RGNDATA_PATH);
363 /* Second signature for pathdata */
364 expect_dword(buf + 5, 12);
365 expect_magic((DWORD*)(buf + 6));
366 expect_dword(buf + 7, 0);
367 expect_dword(buf + 8, 0x00004000);
369 status = GdipDeleteRegion(region);
370 expect(Ok, status);
372 /* Test a simple triangle of INTs */
373 status = GdipAddPathLine(path, 5, 6, 7, 8);
374 expect(Ok, status);
375 status = GdipAddPathLine(path, 8, 1, 5, 6);
376 expect(Ok, status);
377 status = GdipClosePathFigure(path);
378 expect(Ok, status);
379 status = GdipCreateRegionPath(path, &region);
380 expect(Ok, status);
381 status = GdipGetRegionDataSize(region, &needed);
382 expect(Ok, status);
383 expect(56, needed);
384 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
385 expect(Ok, status);
386 expect(56, needed);
387 expect_dword(buf, 48);
388 trace("buf[1] = %08x\n", buf[1]);
389 expect_magic((DWORD*)(buf + 2));
390 expect_dword(buf + 3 , 0);
391 expect_dword(buf + 4 , RGNDATA_PATH);
393 expect_dword(buf + 5, 32);
394 expect_magic((DWORD*)(buf + 6));
395 expect_dword(buf + 7, 4);
396 expect_dword(buf + 8, 0x00004000); /* ?? */
398 point = (RegionDataPoint*)buf + 9;
399 expect(5, point[0].X);
400 expect(6, point[0].Y);
401 expect(7, point[1].X); /* buf + 10 */
402 expect(8, point[1].Y);
403 expect(8, point[2].X); /* buf + 11 */
404 expect(1, point[2].Y);
405 expect(5, point[3].X); /* buf + 12 */
406 expect(6, point[3].Y);
407 expect_dword(buf + 13, 0x81010100); /* 0x01010100 if we don't close the path */
409 status = GdipDeletePath(path);
410 expect(Ok, status);
411 status = GdipDeleteRegion(region);
412 expect(Ok, status);
414 /* Test a floating-point triangle */
415 status = GdipCreatePath(FillModeAlternate, &path);
416 expect(Ok, status);
417 status = GdipAddPathLine(path, 5.6, 6.2, 7.2, 8.9);
418 expect(Ok, status);
419 status = GdipAddPathLine(path, 8.1, 1.6, 5.6, 6.2);
420 expect(Ok, status);
421 status = GdipCreateRegionPath(path, &region);
422 expect(Ok, status);
423 status = GdipGetRegionDataSize(region, &needed);
424 expect(Ok, status);
425 expect(72, needed);
426 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
427 expect(Ok, status);
428 expect(72, needed);
429 expect_dword(buf, 64);
430 trace("buf[1] = %08x\n", buf[1]);
431 expect_magic((DWORD*)(buf + 2));
432 expect_dword(buf + 3, 0);
433 expect_dword(buf + 4, RGNDATA_PATH);
435 expect_dword(buf + 5, 48);
436 expect_magic((DWORD*)(buf + 6));
437 expect_dword(buf + 7, 4);
438 expect_dword(buf + 8, 0);
439 expect_float(buf + 9, 5.6);
440 expect_float(buf + 10, 6.2);
441 expect_float(buf + 11, 7.2);
442 expect_float(buf + 12, 8.9);
443 expect_float(buf + 13, 8.1);
444 expect_float(buf + 14, 1.6);
445 expect_float(buf + 15, 5.6);
446 expect_float(buf + 16, 6.2);
448 status = GdipDeletePath(path);
449 expect(Ok, status);
450 status = GdipDeleteRegion(region);
451 expect(Ok, status);
453 /* Test for a path with > 4 points, and CombineRegionPath */
454 GdipCreatePath(FillModeAlternate, &path);
455 status = GdipAddPathLine(path, 50, 70.2, 60, 102.8);
456 expect(Ok, status);
457 status = GdipAddPathLine(path, 55.4, 122.4, 40.4, 60.2);
458 expect(Ok, status);
459 status = GdipAddPathLine(path, 45.6, 20.2, 50, 70.2);
460 expect(Ok, status);
461 rect.X = 20;
462 rect.Y = 25;
463 rect.Width = 60;
464 rect.Height = 120;
465 status = GdipCreateRegionRectI(&rect, &region);
466 expect(Ok, status);
467 status = GdipCombineRegionPath(region, path, CombineModeUnion);
468 expect(Ok, status);
470 status = GdipGetRegionDataSize(region, &needed);
471 expect(Ok, status);
472 expect(116, needed);
473 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
474 expect(Ok, status);
475 expect(116, needed);
476 expect_dword(buf, 108);
477 trace("buf[1] = %08x\n", buf[1]);
478 expect_magic((DWORD*)(buf + 2));
479 expect_dword(buf + 3, 2);
480 expect_dword(buf + 4, CombineModeUnion);
481 expect_dword(buf + 5, RGNDATA_RECT);
482 expect_float(buf + 6, 20);
483 expect_float(buf + 7, 25);
484 expect_float(buf + 8, 60);
485 expect_float(buf + 9, 120);
486 expect_dword(buf + 10, RGNDATA_PATH);
488 expect_dword(buf + 11, 68);
489 expect_magic((DWORD*)(buf + 12));
490 expect_dword(buf + 13, 6);
491 expect_float(buf + 14, 0x0);
493 expect_float(buf + 15, 50);
494 expect_float(buf + 16, 70.2);
495 expect_float(buf + 17, 60);
496 expect_float(buf + 18, 102.8);
497 expect_float(buf + 19, 55.4);
498 expect_float(buf + 20, 122.4);
499 expect_float(buf + 21, 40.4);
500 expect_float(buf + 22, 60.2);
501 expect_float(buf + 23, 45.6);
502 expect_float(buf + 24, 20.2);
503 expect_float(buf + 25, 50);
504 expect_float(buf + 26, 70.2);
505 expect_dword(buf + 27, 0x01010100);
506 expect_dword(buf + 28, 0x00000101);
508 status = GdipDeletePath(path);
509 expect(Ok, status);
510 status = GdipDeleteRegion(region);
511 expect(Ok, status);
514 static void test_isinfinite(void)
516 GpStatus status;
517 GpRegion *region;
518 GpGraphics *graphics = NULL;
519 GpMatrix *m;
520 HDC hdc = GetDC(0);
521 BOOL res;
523 status = GdipCreateFromHDC(hdc, &graphics);
524 expect(Ok, status);
525 GdipCreateRegion(&region);
527 GdipCreateMatrix2(3.0, 0.0, 0.0, 1.0, 20.0, 30.0, &m);
529 /* NULL arguments */
530 status = GdipIsInfiniteRegion(NULL, NULL, NULL);
531 expect(InvalidParameter, status);
532 status = GdipIsInfiniteRegion(region, NULL, NULL);
533 expect(InvalidParameter, status);
534 status = GdipIsInfiniteRegion(NULL, graphics, NULL);
535 expect(InvalidParameter, status);
536 status = GdipIsInfiniteRegion(NULL, NULL, &res);
537 expect(InvalidParameter, status);
538 status = GdipIsInfiniteRegion(region, NULL, &res);
539 expect(InvalidParameter, status);
541 res = FALSE;
542 status = GdipIsInfiniteRegion(region, graphics, &res);
543 expect(Ok, status);
544 expect(TRUE, res);
546 /* after world transform */
547 status = GdipSetWorldTransform(graphics, m);
548 expect(Ok, status);
550 res = FALSE;
551 status = GdipIsInfiniteRegion(region, graphics, &res);
552 expect(Ok, status);
553 expect(TRUE, res);
555 GdipDeleteMatrix(m);
556 GdipDeleteRegion(region);
557 GdipDeleteGraphics(graphics);
558 ReleaseDC(0, hdc);
561 static void test_isempty(void)
563 GpStatus status;
564 GpRegion *region;
565 GpGraphics *graphics = NULL;
566 HDC hdc = GetDC(0);
567 BOOL res;
569 status = GdipCreateFromHDC(hdc, &graphics);
570 expect(Ok, status);
571 GdipCreateRegion(&region);
573 /* NULL arguments */
574 status = GdipIsEmptyRegion(NULL, NULL, NULL);
575 expect(InvalidParameter, status);
576 status = GdipIsEmptyRegion(region, NULL, NULL);
577 expect(InvalidParameter, status);
578 status = GdipIsEmptyRegion(NULL, graphics, NULL);
579 expect(InvalidParameter, status);
580 status = GdipIsEmptyRegion(NULL, NULL, &res);
581 expect(InvalidParameter, status);
582 status = GdipIsEmptyRegion(region, NULL, &res);
583 expect(InvalidParameter, status);
585 /* default is infinite */
586 res = TRUE;
587 status = GdipIsEmptyRegion(region, graphics, &res);
588 expect(Ok, status);
589 expect(FALSE, res);
591 status = GdipSetEmpty(region);
592 expect(Ok, status);
594 res = FALSE;
595 status = GdipIsEmptyRegion(region, graphics, &res);
596 expect(Ok, status);
597 expect(TRUE, res);
599 GdipDeleteRegion(region);
600 GdipDeleteGraphics(graphics);
601 ReleaseDC(0, hdc);
604 static void test_combinereplace(void)
606 GpStatus status;
607 GpRegion *region, *region2;
608 GpPath *path;
609 GpRectF rectf;
610 UINT needed;
611 DWORD buf[50];
613 rectf.X = rectf.Y = 0.0;
614 rectf.Width = rectf.Height = 100.0;
616 status = GdipCreateRegionRect(&rectf, &region);
617 expect(Ok, status);
619 /* replace with the same rectangle */
620 status = GdipCombineRegionRect(region, &rectf,CombineModeReplace);
621 expect(Ok, status);
623 status = GdipGetRegionDataSize(region, &needed);
624 expect(Ok, status);
625 expect(36, needed);
626 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
627 expect(Ok, status);
628 expect(36, needed);
629 expect_dword(buf, 28);
630 trace("buf[1] = %08x\n", buf[1]);
631 expect_magic((DWORD*)(buf + 2));
632 expect_dword(buf + 3, 0);
633 expect_dword(buf + 4, RGNDATA_RECT);
635 /* replace with path */
636 status = GdipCreatePath(FillModeAlternate, &path);
637 expect(Ok, status);
638 status = GdipAddPathEllipse(path, 0.0, 0.0, 100.0, 250.0);
639 expect(Ok, status);
640 status = GdipCombineRegionPath(region, path, CombineModeReplace);
641 expect(Ok, status);
643 status = GdipGetRegionDataSize(region, &needed);
644 expect(Ok, status);
645 expect(156, needed);
646 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
647 expect(Ok, status);
648 expect(156, needed);
649 expect_dword(buf, 148);
650 trace("buf[1] = %08x\n", buf[1]);
651 expect_magic((DWORD*)(buf + 2));
652 expect_dword(buf + 3, 0);
653 expect_dword(buf + 4, RGNDATA_PATH);
654 GdipDeletePath(path);
656 /* replace with infinite rect */
657 status = GdipCreateRegion(&region2);
658 expect(Ok, status);
659 status = GdipCombineRegionRegion(region, region2, CombineModeReplace);
660 expect(Ok, status);
662 status = GdipGetRegionDataSize(region, &needed);
663 expect(Ok, status);
664 expect(20, needed);
665 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
666 expect(Ok, status);
667 expect(20, needed);
668 expect_dword(buf, 12);
669 trace("buf[1] = %08x\n", buf[1]);
670 expect_magic((DWORD*)(buf + 2));
671 expect_dword(buf + 3, 0);
672 expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
673 GdipDeleteRegion(region2);
675 /* more complex case : replace with a combined region */
676 status = GdipCreateRegionRect(&rectf, &region2);
677 expect(Ok, status);
678 status = GdipCreatePath(FillModeAlternate, &path);
679 expect(Ok, status);
680 status = GdipAddPathEllipse(path, 0.0, 0.0, 100.0, 250.0);
681 expect(Ok, status);
682 status = GdipCombineRegionPath(region2, path, CombineModeUnion);
683 expect(Ok, status);
684 GdipDeletePath(path);
685 status = GdipCombineRegionRegion(region, region2, CombineModeReplace);
686 expect(Ok, status);
687 GdipDeleteRegion(region2);
689 status = GdipGetRegionDataSize(region, &needed);
690 expect(Ok, status);
691 expect(180, needed);
692 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
693 expect(Ok, status);
694 expect(180, needed);
695 expect_dword(buf, 172);
696 trace("buf[1] = %08x\n", buf[1]);
697 expect_magic((DWORD*)(buf + 2));
698 expect_dword(buf + 3, 2);
699 expect_dword(buf + 4, CombineModeUnion);
701 GdipDeleteRegion(region);
704 static void test_fromhrgn(void)
706 GpStatus status;
707 GpRegion *region = (GpRegion*)0xabcdef01;
708 HRGN hrgn;
709 UINT needed;
710 DWORD buf[220];
711 RegionDataPoint *point;
712 GpGraphics *graphics = NULL;
713 HDC hdc;
714 BOOL res;
716 /* NULL */
717 status = GdipCreateRegionHrgn(NULL, NULL);
718 expect(InvalidParameter, status);
719 status = GdipCreateRegionHrgn(NULL, &region);
720 expect(InvalidParameter, status);
721 status = GdipCreateRegionHrgn((HRGN)0xdeadbeef, &region);
722 expect(InvalidParameter, status);
723 ok(region == (GpRegion*)0xabcdef01, "Expected region not to be created\n");
725 /* empty rectangle */
726 hrgn = CreateRectRgn(0, 0, 0, 0);
727 status = GdipCreateRegionHrgn(hrgn, &region);
728 expect(Ok, status);
729 if(status == Ok) {
731 hdc = GetDC(0);
732 status = GdipCreateFromHDC(hdc, &graphics);
733 expect(Ok, status);
734 res = FALSE;
735 status = GdipIsEmptyRegion(region, graphics, &res);
736 expect(Ok, status);
737 expect(TRUE, res);
738 GdipDeleteGraphics(graphics);
739 ReleaseDC(0, hdc);
740 GdipDeleteRegion(region);
743 DeleteObject(hrgn);
745 /* rectangle */
746 hrgn = CreateRectRgn(0, 0, 100, 10);
747 status = GdipCreateRegionHrgn(hrgn, &region);
748 expect(Ok, status);
750 status = GdipGetRegionDataSize(region, &needed);
751 expect(Ok, status);
752 expect(56, needed);
754 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
755 expect(Ok, status);
757 if(status == Ok){
759 expect(56, needed);
760 expect_dword(buf, 48);
761 expect_magic((DWORD*)(buf + 2));
762 expect_dword(buf + 3, 0);
763 expect_dword(buf + 4, RGNDATA_PATH);
764 expect_dword(buf + 5, 0x00000020);
765 expect_magic((DWORD*)(buf + 6));
766 expect_dword(buf + 7, 0x00000004);
767 todo_wine expect_dword(buf + 8, 0x00006000); /* ?? */
769 point = (RegionDataPoint*)buf + 9;
771 expect(0, point[0].X);
772 expect(0, point[0].Y);
774 expect(100,point[1].X); /* buf + 10 */
775 expect(0, point[1].Y);
776 expect(100,point[2].X); /* buf + 11 */
777 expect(10, point[2].Y);
779 expect(0, point[3].X); /* buf + 12 */
781 expect(10, point[3].Y);
782 expect_dword(buf + 13, 0x81010100); /* closed */
786 GdipDeleteRegion(region);
787 DeleteObject(hrgn);
789 /* ellipse */
790 hrgn = CreateEllipticRgn(0, 0, 100, 10);
791 status = GdipCreateRegionHrgn(hrgn, &region);
792 expect(Ok, status);
794 status = GdipGetRegionDataSize(region, &needed);
795 expect(Ok, status);
796 ok(needed == 216 ||
797 needed == 196, /* win98 */
798 "Got %.8x\n", needed);
800 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
801 expect(Ok, status);
803 if(status == Ok && needed == 216) /* Don't try to test win98 layout */
805 expect(Ok, status);
806 expect(216, needed);
807 expect_dword(buf, 208);
808 expect_magic((DWORD*)(buf + 2));
809 expect_dword(buf + 3, 0);
810 expect_dword(buf + 4, RGNDATA_PATH);
811 expect_dword(buf + 5, 0x000000C0);
812 expect_magic((DWORD*)(buf + 6));
813 expect_dword(buf + 7, 0x00000024);
814 todo_wine expect_dword(buf + 8, 0x00006000); /* ?? */
817 GdipDeleteRegion(region);
818 DeleteObject(hrgn);
821 static void test_gethrgn(void)
823 GpStatus status;
824 GpRegion *region, *region2;
825 GpPath *path;
826 GpGraphics *graphics;
827 HRGN hrgn;
828 HDC hdc=GetDC(0);
829 static const RECT empty_rect = {0,0,0,0};
830 static const RECT test_rect = {10, 11, 20, 21};
831 static const GpRectF test_rectF = {10.0, 11.0, 10.0, 10.0};
832 static const RECT scaled_rect = {20, 22, 40, 42};
833 static const RECT test_rect2 = {10, 21, 20, 31};
834 static const GpRectF test_rect2F = {10.0, 21.0, 10.0, 10.0};
835 static const RECT test_rect3 = {10, 11, 20, 31};
836 static const GpRectF test_rect3F = {10.0, 11.0, 10.0, 20.0};
838 status = GdipCreateFromHDC(hdc, &graphics);
839 ok(status == Ok, "status %08x\n", status);
841 status = GdipCreateRegion(&region);
842 ok(status == Ok, "status %08x\n", status);
844 status = GdipGetRegionHRgn(NULL, graphics, &hrgn);
845 ok(status == InvalidParameter, "status %08x\n", status);
846 status = GdipGetRegionHRgn(region, graphics, NULL);
847 ok(status == InvalidParameter, "status %08x\n", status);
849 status = GdipGetRegionHRgn(region, NULL, &hrgn);
850 ok(status == Ok, "status %08x\n", status);
851 ok(hrgn == NULL, "hrgn=%p\n", hrgn);
852 DeleteObject(hrgn);
854 status = GdipGetRegionHRgn(region, graphics, &hrgn);
855 ok(status == Ok, "status %08x\n", status);
856 ok(hrgn == NULL, "hrgn=%p\n", hrgn);
857 DeleteObject(hrgn);
859 status = GdipSetEmpty(region);
860 ok(status == Ok, "status %08x\n", status);
861 status = GdipGetRegionHRgn(region, NULL, &hrgn);
862 ok(status == Ok, "status %08x\n", status);
863 verify_region(hrgn, &empty_rect);
864 DeleteObject(hrgn);
866 status = GdipCreatePath(FillModeAlternate, &path);
867 ok(status == Ok, "status %08x\n", status);
868 status = GdipAddPathRectangle(path, 10.0, 11.0, 10.0, 10.0);
869 ok(status == Ok, "status %08x\n", status);
871 status = GdipCreateRegionPath(path, &region2);
872 ok(status == Ok, "status %08x\n", status);
873 status = GdipGetRegionHRgn(region2, NULL, &hrgn);
874 ok(status == Ok, "status %08x\n", status);
875 verify_region(hrgn, &test_rect);
876 DeleteObject(hrgn);
878 /* resulting HRGN is in device coordinates */
879 status = GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
880 ok(status == Ok, "status %08x\n", status);
881 status = GdipGetRegionHRgn(region2, graphics, &hrgn);
882 ok(status == Ok, "status %08x\n", status);
883 verify_region(hrgn, &scaled_rect);
884 DeleteObject(hrgn);
886 status = GdipCombineRegionRect(region2, &test_rectF, CombineModeReplace);
887 ok(status == Ok, "status %08x\n", status);
888 status = GdipGetRegionHRgn(region2, NULL, &hrgn);
889 ok(status == Ok, "status %08x\n", status);
890 verify_region(hrgn, &test_rect);
891 DeleteObject(hrgn);
893 status = GdipGetRegionHRgn(region2, graphics, &hrgn);
894 ok(status == Ok, "status %08x\n", status);
895 verify_region(hrgn, &scaled_rect);
896 DeleteObject(hrgn);
898 status = GdipSetInfinite(region);
899 ok(status == Ok, "status %08x\n", status);
900 status = GdipCombineRegionRect(region, &test_rectF, CombineModeIntersect);
901 ok(status == Ok, "status %08x\n", status);
902 status = GdipGetRegionHRgn(region, NULL, &hrgn);
903 ok(status == Ok, "status %08x\n", status);
904 verify_region(hrgn, &test_rect);
905 DeleteObject(hrgn);
907 status = GdipCombineRegionRect(region, &test_rectF, CombineModeReplace);
908 ok(status == Ok, "status %08x\n", status);
909 status = GdipCombineRegionRect(region, &test_rect2F, CombineModeUnion);
910 ok(status == Ok, "status %08x\n", status);
911 status = GdipGetRegionHRgn(region, NULL, &hrgn);
912 ok(status == Ok, "status %08x\n", status);
913 verify_region(hrgn, &test_rect3);
914 DeleteObject(hrgn);
916 status = GdipCombineRegionRect(region, &test_rect3F, CombineModeReplace);
917 ok(status == Ok, "status %08x\n", status);
918 status = GdipCombineRegionRect(region, &test_rect2F, CombineModeXor);
919 ok(status == Ok, "status %08x\n", status);
920 status = GdipGetRegionHRgn(region, NULL, &hrgn);
921 ok(status == Ok, "status %08x\n", status);
922 verify_region(hrgn, &test_rect);
923 DeleteObject(hrgn);
925 status = GdipCombineRegionRect(region, &test_rect3F, CombineModeReplace);
926 ok(status == Ok, "status %08x\n", status);
927 status = GdipCombineRegionRect(region, &test_rectF, CombineModeExclude);
928 ok(status == Ok, "status %08x\n", status);
929 status = GdipGetRegionHRgn(region, NULL, &hrgn);
930 ok(status == Ok, "status %08x\n", status);
931 verify_region(hrgn, &test_rect2);
932 DeleteObject(hrgn);
934 status = GdipCombineRegionRect(region, &test_rectF, CombineModeReplace);
935 ok(status == Ok, "status %08x\n", status);
936 status = GdipCombineRegionRect(region, &test_rect3F, CombineModeComplement);
937 ok(status == Ok, "status %08x\n", status);
938 status = GdipGetRegionHRgn(region, NULL, &hrgn);
939 ok(status == Ok, "status %08x\n", status);
940 verify_region(hrgn, &test_rect2);
941 DeleteObject(hrgn);
943 status = GdipDeletePath(path);
944 ok(status == Ok, "status %08x\n", status);
945 status = GdipDeleteRegion(region);
946 ok(status == Ok, "status %08x\n", status);
947 status = GdipDeleteRegion(region2);
948 ok(status == Ok, "status %08x\n", status);
949 status = GdipDeleteGraphics(graphics);
950 ok(status == Ok, "status %08x\n", status);
951 ReleaseDC(0, hdc);
954 static void test_isequal(void)
956 GpRegion *region1, *region2;
957 GpGraphics *graphics;
958 GpRectF rectf;
959 GpStatus status;
960 HDC hdc = GetDC(0);
961 BOOL res;
963 status = GdipCreateFromHDC(hdc, &graphics);
964 ok(status == Ok, "status %08x\n", status);
966 status = GdipCreateRegion(&region1);
967 ok(status == Ok, "status %08x\n", status);
968 status = GdipCreateRegion(&region2);
969 ok(status == Ok, "status %08x\n", status);
971 /* NULL */
972 status = GdipIsEqualRegion(NULL, NULL, NULL, NULL);
973 ok(status == InvalidParameter, "status %08x\n", status);
974 status = GdipIsEqualRegion(region1, region2, NULL, NULL);
975 ok(status == InvalidParameter, "status %08x\n", status);
976 status = GdipIsEqualRegion(region1, region2, graphics, NULL);
977 ok(status == InvalidParameter, "status %08x\n", status);
978 status = GdipIsEqualRegion(region1, region2, NULL, &res);
979 ok(status == InvalidParameter, "status %08x\n", status);
981 /* infinite regions */
982 res = FALSE;
983 status = GdipIsEqualRegion(region1, region2, graphics, &res);
984 ok(status == Ok, "status %08x\n", status);
985 ok(res, "Expected to be equal.\n");
986 /* empty regions */
987 status = GdipSetEmpty(region1);
988 ok(status == Ok, "status %08x\n", status);
989 status = GdipSetEmpty(region2);
990 ok(status == Ok, "status %08x\n", status);
991 res = FALSE;
992 status = GdipIsEqualRegion(region1, region2, graphics, &res);
993 ok(status == Ok, "status %08x\n", status);
994 ok(res, "Expected to be equal.\n");
995 /* empty & infinite */
996 status = GdipSetInfinite(region1);
997 ok(status == Ok, "status %08x\n", status);
998 res = TRUE;
999 status = GdipIsEqualRegion(region1, region2, graphics, &res);
1000 ok(status == Ok, "status %08x\n", status);
1001 ok(!res, "Expected to be unequal.\n");
1002 /* rect & (inf/empty) */
1003 rectf.X = rectf.Y = 0.0;
1004 rectf.Width = rectf.Height = 100.0;
1005 status = GdipCombineRegionRect(region1, &rectf, CombineModeReplace);
1006 ok(status == Ok, "status %08x\n", status);
1007 res = TRUE;
1008 status = GdipIsEqualRegion(region1, region2, graphics, &res);
1009 ok(status == Ok, "status %08x\n", status);
1010 ok(!res, "Expected to be unequal.\n");
1011 status = GdipSetInfinite(region2);
1012 ok(status == Ok, "status %08x\n", status);
1013 res = TRUE;
1014 status = GdipIsEqualRegion(region1, region2, graphics, &res);
1015 ok(status == Ok, "status %08x\n", status);
1016 ok(!res, "Expected to be unequal.\n");
1017 /* roughly equal rectangles */
1018 rectf.X = rectf.Y = 0.0;
1019 rectf.Width = rectf.Height = 100.001;
1020 status = GdipCombineRegionRect(region2, &rectf, CombineModeReplace);
1021 ok(status == Ok, "status %08x\n", status);
1022 res = FALSE;
1023 status = GdipIsEqualRegion(region1, region2, graphics, &res);
1024 ok(status == Ok, "status %08x\n", status);
1025 ok(res, "Expected to be equal.\n");
1026 /* equal rectangles */
1027 rectf.X = rectf.Y = 0.0;
1028 rectf.Width = rectf.Height = 100.0;
1029 status = GdipCombineRegionRect(region2, &rectf, CombineModeReplace);
1030 ok(status == Ok, "status %08x\n", status);
1031 res = FALSE;
1032 status = GdipIsEqualRegion(region1, region2, graphics, &res);
1033 ok(status == Ok, "status %08x\n", status);
1034 ok(res, "Expected to be equal.\n");
1036 /* cleanup */
1037 status = GdipDeleteRegion(region1);
1038 ok(status == Ok, "status %08x\n", status);
1039 status = GdipDeleteRegion(region2);
1040 ok(status == Ok, "status %08x\n", status);
1041 status = GdipDeleteGraphics(graphics);
1042 ok(status == Ok, "status %08x\n", status);
1043 ReleaseDC(0, hdc);
1046 static void test_translate(void)
1048 GpRegion *region, *region2;
1049 GpGraphics *graphics;
1050 GpPath *path;
1051 GpRectF rectf;
1052 GpStatus status;
1053 HDC hdc = GetDC(0);
1054 BOOL res;
1056 status = GdipCreateFromHDC(hdc, &graphics);
1057 ok(status == Ok, "status %08x\n", status);
1059 status = GdipCreatePath(FillModeAlternate, &path);
1060 ok(status == Ok, "status %08x\n", status);
1062 status = GdipCreateRegion(&region);
1063 ok(status == Ok, "status %08x\n", status);
1064 status = GdipCreateRegion(&region2);
1065 ok(status == Ok, "status %08x\n", status);
1067 /* NULL */
1068 status = GdipTranslateRegion(NULL, 0.0, 0.0);
1069 ok(status == InvalidParameter, "status %08x\n", status);
1071 /* infinite */
1072 status = GdipTranslateRegion(region, 10.0, 10.0);
1073 ok(status == Ok, "status %08x\n", status);
1074 /* empty */
1075 status = GdipSetEmpty(region);
1076 ok(status == Ok, "status %08x\n", status);
1077 status = GdipTranslateRegion(region, 10.0, 10.0);
1078 ok(status == Ok, "status %08x\n", status);
1079 /* rect */
1080 rectf.X = 10.0; rectf.Y = 0.0;
1081 rectf.Width = rectf.Height = 100.0;
1082 status = GdipCombineRegionRect(region, &rectf, CombineModeReplace);
1083 ok(status == Ok, "status %08x\n", status);
1084 rectf.X = 15.0; rectf.Y = -2.0;
1085 rectf.Width = rectf.Height = 100.0;
1086 status = GdipCombineRegionRect(region2, &rectf, CombineModeReplace);
1087 ok(status == Ok, "status %08x\n", status);
1088 status = GdipTranslateRegion(region, 5.0, -2.0);
1089 ok(status == Ok, "status %08x\n", status);
1090 res = FALSE;
1091 status = GdipIsEqualRegion(region, region2, graphics, &res);
1092 ok(status == Ok, "status %08x\n", status);
1093 ok(res, "Expected to be equal.\n");
1094 /* path */
1095 status = GdipAddPathEllipse(path, 0.0, 10.0, 100.0, 150.0);
1096 ok(status == Ok, "status %08x\n", status);
1097 status = GdipCombineRegionPath(region, path, CombineModeReplace);
1098 ok(status == Ok, "status %08x\n", status);
1099 status = GdipResetPath(path);
1100 ok(status == Ok, "status %08x\n", status);
1101 status = GdipAddPathEllipse(path, 10.0, 21.0, 100.0, 150.0);
1102 ok(status == Ok, "status %08x\n", status);
1103 status = GdipCombineRegionPath(region2, path, CombineModeReplace);
1104 ok(status == Ok, "status %08x\n", status);
1105 status = GdipTranslateRegion(region, 10.0, 11.0);
1106 ok(status == Ok, "status %08x\n", status);
1107 res = FALSE;
1108 status = GdipIsEqualRegion(region, region2, graphics, &res);
1109 ok(status == Ok, "status %08x\n", status);
1110 ok(res, "Expected to be equal.\n");
1112 status = GdipDeleteRegion(region);
1113 ok(status == Ok, "status %08x\n", status);
1114 status = GdipDeleteRegion(region2);
1115 ok(status == Ok, "status %08x\n", status);
1116 status = GdipDeleteGraphics(graphics);
1117 ok(status == Ok, "status %08x\n", status);
1118 status = GdipDeletePath(path);
1119 ok(status == Ok, "status %08x\n", status);
1120 ReleaseDC(0, hdc);
1123 static void test_getbounds(void)
1125 GpRegion *region;
1126 GpGraphics *graphics;
1127 GpStatus status;
1128 GpRectF rectf;
1129 HDC hdc = GetDC(0);
1131 status = GdipCreateFromHDC(hdc, &graphics);
1132 ok(status == Ok, "status %08x\n", status);
1133 status = GdipCreateRegion(&region);
1134 ok(status == Ok, "status %08x\n", status);
1136 /* NULL */
1137 status = GdipGetRegionBounds(NULL, NULL, NULL);
1138 ok(status == InvalidParameter, "status %08x\n", status);
1139 status = GdipGetRegionBounds(region, NULL, NULL);
1140 ok(status == InvalidParameter, "status %08x\n", status);
1141 status = GdipGetRegionBounds(region, graphics, NULL);
1142 ok(status == InvalidParameter, "status %08x\n", status);
1143 /* infinite */
1144 rectf.X = rectf.Y = 0.0;
1145 rectf.Height = rectf.Width = 100.0;
1146 status = GdipGetRegionBounds(region, graphics, &rectf);
1147 ok(status == Ok, "status %08x\n", status);
1148 ok(rectf.X == -(REAL)(1 << 22), "Expected X = %.2f, got %.2f\n", -(REAL)(1 << 22), rectf.X);
1149 ok(rectf.Y == -(REAL)(1 << 22), "Expected Y = %.2f, got %.2f\n", -(REAL)(1 << 22), rectf.Y);
1150 ok(rectf.Width == (REAL)(1 << 23), "Expected width = %.2f, got %.2f\n", (REAL)(1 << 23), rectf.Width);
1151 ok(rectf.Height == (REAL)(1 << 23), "Expected height = %.2f, got %.2f\n",(REAL)(1 << 23), rectf.Height);
1152 /* empty */
1153 rectf.X = rectf.Y = 0.0;
1154 rectf.Height = rectf.Width = 100.0;
1155 status = GdipSetEmpty(region);
1156 ok(status == Ok, "status %08x\n", status);
1157 status = GdipGetRegionBounds(region, graphics, &rectf);
1158 ok(status == Ok, "status %08x\n", status);
1159 ok(rectf.X == 0.0, "Expected X = 0.0, got %.2f\n", rectf.X);
1160 ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
1161 ok(rectf.Width == 0.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
1162 ok(rectf.Height == 0.0, "Expected height = 0.0, got %.2f\n", rectf.Height);
1163 /* rect */
1164 rectf.X = 10.0; rectf.Y = 0.0;
1165 rectf.Width = rectf.Height = 100.0;
1166 status = GdipCombineRegionRect(region, &rectf, CombineModeReplace);
1167 ok(status == Ok, "status %08x\n", status);
1168 rectf.X = rectf.Y = 0.0;
1169 rectf.Height = rectf.Width = 0.0;
1170 status = GdipGetRegionBounds(region, graphics, &rectf);
1171 ok(status == Ok, "status %08x\n", status);
1172 ok(rectf.X == 10.0, "Expected X = 0.0, got %.2f\n", rectf.X);
1173 ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
1174 ok(rectf.Width == 100.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
1175 ok(rectf.Height == 100.0, "Expected height = 0.0, got %.2f\n", rectf.Height);
1177 /* the world and page transforms are ignored */
1178 GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
1179 GdipSetPageUnit(graphics, UnitInch);
1180 GdipSetPageScale(graphics, 2.0);
1181 status = GdipGetRegionBounds(region, graphics, &rectf);
1182 ok(status == Ok, "status %08x\n", status);
1183 ok(rectf.X == 10.0, "Expected X = 0.0, got %.2f\n", rectf.X);
1184 ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
1185 ok(rectf.Width == 100.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
1187 rectf.X = 10.0; rectf.Y = 0.0;
1188 rectf.Width = rectf.Height = 100.0;
1189 status = GdipCombineRegionRect(region, &rectf, CombineModeReplace);
1190 ok(status == Ok, "status %08x\n", status);
1191 rectf.X = rectf.Y = 0.0;
1192 rectf.Height = rectf.Width = 0.0;
1193 status = GdipGetRegionBounds(region, graphics, &rectf);
1194 ok(status == Ok, "status %08x\n", status);
1195 ok(rectf.X == 10.0, "Expected X = 0.0, got %.2f\n", rectf.X);
1196 ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
1197 ok(rectf.Width == 100.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
1198 ok(rectf.Height == 100.0, "Expected height = 0.0, got %.2f\n", rectf.Height);
1200 status = GdipDeleteRegion(region);
1201 ok(status == Ok, "status %08x\n", status);
1202 status = GdipDeleteGraphics(graphics);
1203 ok(status == Ok, "status %08x\n", status);
1204 ReleaseDC(0, hdc);
1207 static void test_isvisiblepoint(void)
1209 HDC hdc = GetDC(0);
1210 GpGraphics* graphics;
1211 GpRegion* region;
1212 GpPath* path;
1213 GpRectF rectf;
1214 GpStatus status;
1215 BOOL res;
1216 REAL x, y;
1218 status = GdipCreateFromHDC(hdc, &graphics);
1219 expect(Ok, status);
1221 status = GdipCreateRegion(&region);
1222 expect(Ok, status);
1224 /* null parameters */
1225 status = GdipIsVisibleRegionPoint(NULL, 0, 0, graphics, &res);
1226 expect(InvalidParameter, status);
1227 status = GdipIsVisibleRegionPointI(NULL, 0, 0, graphics, &res);
1228 expect(InvalidParameter, status);
1230 status = GdipIsVisibleRegionPoint(region, 0, 0, NULL, &res);
1231 expect(Ok, status);
1232 status = GdipIsVisibleRegionPointI(region, 0, 0, NULL, &res);
1233 expect(Ok, status);
1235 status = GdipIsVisibleRegionPoint(region, 0, 0, graphics, NULL);
1236 expect(InvalidParameter, status);
1237 status = GdipIsVisibleRegionPointI(region, 0, 0, graphics, NULL);
1238 expect(InvalidParameter, status);
1240 /* infinite region */
1241 status = GdipIsInfiniteRegion(region, graphics, &res);
1242 expect(Ok, status);
1243 ok(res == TRUE, "Region should be infinite\n");
1245 x = 10;
1246 y = 10;
1247 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1248 expect(Ok, status);
1249 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1250 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1251 expect(Ok, status);
1252 ok(res == TRUE, "Expected (%d, %d) to be visible\n", (INT)x, (INT)y);
1254 x = -10;
1255 y = -10;
1256 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1257 expect(Ok, status);
1258 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1259 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1260 expect(Ok, status);
1261 ok(res == TRUE, "Expected (%d, %d) to be visible\n", (INT)x, (INT)y);
1263 /* rectangular region */
1264 rectf.X = 10;
1265 rectf.Y = 20;
1266 rectf.Width = 30;
1267 rectf.Height = 40;
1269 status = GdipCombineRegionRect(region, &rectf, CombineModeReplace);
1270 expect(Ok, status);
1272 x = 0;
1273 y = 0;
1274 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1275 expect(Ok, status);
1276 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1277 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1278 expect(Ok, status);
1279 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1281 x = 9;
1282 y = 19;
1283 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1284 expect(Ok, status);
1285 ok(res == FALSE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1287 x = 9.25;
1288 y = 19.25;
1289 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1290 expect(Ok, status);
1291 ok(res == FALSE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1293 x = 9.5;
1294 y = 19.5;
1295 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1296 expect(Ok, status);
1297 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1299 x = 9.75;
1300 y = 19.75;
1301 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1302 expect(Ok, status);
1303 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1305 x = 10;
1306 y = 20;
1307 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1308 expect(Ok, status);
1309 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1311 x = 25;
1312 y = 40;
1313 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1314 expect(Ok, status);
1315 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1316 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1317 expect(Ok, status);
1318 ok(res == TRUE, "Expected (%d, %d) to be visible\n", (INT)x, (INT)y);
1320 x = 40;
1321 y = 60;
1322 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1323 expect(Ok, status);
1324 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1325 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1326 expect(Ok, status);
1327 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1329 /* translate into the center of the rectangle */
1330 status = GdipTranslateWorldTransform(graphics, 25, 40, MatrixOrderAppend);
1331 expect(Ok, status);
1333 /* native ignores the world transform, so treat these as if
1334 * no transform exists */
1335 x = -20;
1336 y = -30;
1337 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1338 expect(Ok, status);
1339 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1340 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1341 expect(Ok, status);
1342 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1344 x = 0;
1345 y = 0;
1346 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1347 expect(Ok, status);
1348 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1349 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1350 expect(Ok, status);
1351 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1353 x = 25;
1354 y = 40;
1355 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1356 expect(Ok, status);
1357 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1358 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1359 expect(Ok, status);
1360 ok(res == TRUE, "Expected (%d, %d) to be visible\n", (INT)x, (INT)y);
1362 /* translate back to origin */
1363 status = GdipTranslateWorldTransform(graphics, -25, -40, MatrixOrderAppend);
1364 expect(Ok, status);
1366 /* region from path */
1367 status = GdipCreatePath(FillModeAlternate, &path);
1368 expect(Ok, status);
1370 status = GdipAddPathEllipse(path, 10, 20, 30, 40);
1371 expect(Ok, status);
1373 status = GdipCombineRegionPath(region, path, CombineModeReplace);
1374 expect(Ok, status);
1376 x = 11;
1377 y = 21;
1378 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1379 expect(Ok, status);
1380 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1381 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1382 expect(Ok, status);
1383 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1385 x = 25;
1386 y = 40;
1387 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1388 expect(Ok, status);
1389 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1390 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1391 expect(Ok, status);
1392 ok(res == TRUE, "Expected (%d, %d) to be visible\n", (INT)x, (INT)y);
1394 x = 40;
1395 y = 60;
1396 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1397 expect(Ok, status);
1398 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1399 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1400 expect(Ok, status);
1401 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1403 GdipDeletePath(path);
1405 GdipDeleteRegion(region);
1406 GdipDeleteGraphics(graphics);
1407 ReleaseDC(0, hdc);
1410 static void test_isvisiblerect(void)
1412 HDC hdc = GetDC(0);
1413 GpGraphics* graphics;
1414 GpRegion* region;
1415 GpPath* path;
1416 GpRectF rectf;
1417 GpStatus status;
1418 BOOL res;
1419 REAL x, y, w, h;
1421 status = GdipCreateFromHDC(hdc, &graphics);
1422 expect(Ok, status);
1424 status = GdipCreateRegion(&region);
1425 expect(Ok, status);
1427 /* null parameters */
1428 status = GdipIsVisibleRegionRect(NULL, 0, 0, 0, 0, graphics, &res);
1429 expect(InvalidParameter, status);
1430 status = GdipIsVisibleRegionRectI(NULL, 0, 0, 0, 0, graphics, &res);
1431 expect(InvalidParameter, status);
1433 status = GdipIsVisibleRegionRect(region, 0, 0, 0, 0, NULL, &res);
1434 expect(Ok, status);
1435 status = GdipIsVisibleRegionRectI(region, 0, 0, 0, 0, NULL, &res);
1436 expect(Ok, status);
1438 status = GdipIsVisibleRegionRect(region, 0, 0, 0, 0, graphics, NULL);
1439 expect(InvalidParameter, status);
1440 status = GdipIsVisibleRegionRectI(region, 0, 0, 0, 0, graphics, NULL);
1441 expect(InvalidParameter, status);
1443 /* infinite region */
1444 status = GdipIsInfiniteRegion(region, graphics, &res);
1445 expect(Ok, status);
1446 ok(res == TRUE, "Region should be infinite\n");
1448 x = 10; w = 10;
1449 y = 10; h = 10;
1450 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1451 expect(Ok, status);
1452 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1454 x = -10; w = 5;
1455 y = -10; h = 5;
1456 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1457 expect(Ok, status);
1458 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1460 /* rectangular region */
1461 rectf.X = 10;
1462 rectf.Y = 20;
1463 rectf.Width = 30;
1464 rectf.Height = 40;
1466 status = GdipCombineRegionRect(region, &rectf, CombineModeIntersect);
1467 expect(Ok, status);
1469 /* entirely within the region */
1470 x = 11; w = 10;
1471 y = 12; h = 10;
1472 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1473 expect(Ok, status);
1474 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1475 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1476 expect(Ok, status);
1477 ok(res == TRUE, "Expected (%d, %d, %d, %d) to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1479 /* entirely outside of the region */
1480 x = 0; w = 5;
1481 y = 0; h = 5;
1482 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1483 expect(Ok, status);
1484 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1485 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1486 expect(Ok, status);
1487 ok(res == FALSE, "Expected (%d, %d, %d, %d) not to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1489 /* corner cases */
1490 x = 0; w = 10;
1491 y = 0; h = 20;
1492 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1493 expect(Ok, status);
1494 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1496 x = 0; w = 10.25;
1497 y = 0; h = 20.25;
1498 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1499 expect(Ok, status);
1500 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1502 x = 39; w = 10;
1503 y = 59; h = 10;
1504 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1505 expect(Ok, status);
1506 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1508 x = 39.25; w = 10;
1509 y = 59.25; h = 10;
1510 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1511 expect(Ok, status);
1512 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1514 /* corners outside, but some intersection */
1515 x = 0; w = 100;
1516 y = 0; h = 100;
1517 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1518 expect(Ok, status);
1519 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1521 x = 0; w = 100;
1522 y = 0; h = 40;
1523 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1524 expect(Ok, status);
1525 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1527 x = 0; w = 25;
1528 y = 0; h = 100;
1529 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1530 expect(Ok, status);
1531 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1533 /* translate into the center of the rectangle */
1534 status = GdipTranslateWorldTransform(graphics, 25, 40, MatrixOrderAppend);
1535 expect(Ok, status);
1537 /* native ignores the world transform, so treat these as if
1538 * no transform exists */
1539 x = 0; w = 5;
1540 y = 0; h = 5;
1541 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1542 expect(Ok, status);
1543 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1544 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1545 expect(Ok, status);
1546 ok(res == FALSE, "Expected (%d, %d, %d, %d) not to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1548 x = 11; w = 10;
1549 y = 12; h = 10;
1550 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1551 expect(Ok, status);
1552 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1553 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1554 expect(Ok, status);
1555 ok(res == TRUE, "Expected (%d, %d, %d, %d) to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1557 /* translate back to origin */
1558 status = GdipTranslateWorldTransform(graphics, -25, -40, MatrixOrderAppend);
1559 expect(Ok, status);
1561 /* region from path */
1562 status = GdipCreatePath(FillModeAlternate, &path);
1563 expect(Ok, status);
1565 status = GdipAddPathEllipse(path, 10, 20, 30, 40);
1566 expect(Ok, status);
1568 status = GdipCombineRegionPath(region, path, CombineModeReplace);
1569 expect(Ok, status);
1571 x = 0; w = 12;
1572 y = 0; h = 22;
1573 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1574 expect(Ok, status);
1575 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1576 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1577 expect(Ok, status);
1578 ok(res == FALSE, "Expected (%d, %d, %d, %d) not to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1580 x = 0; w = 25;
1581 y = 0; h = 40;
1582 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1583 expect(Ok, status);
1584 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1585 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1586 expect(Ok, status);
1587 ok(res == TRUE, "Expected (%d, %d, %d, %d) to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1589 x = 38; w = 10;
1590 y = 55; h = 10;
1591 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1592 expect(Ok, status);
1593 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1594 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1595 expect(Ok, status);
1596 ok(res == FALSE, "Expected (%d, %d, %d, %d) not to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1598 x = 0; w = 100;
1599 y = 0; h = 100;
1600 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1601 expect(Ok, status);
1602 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1603 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1604 expect(Ok, status);
1605 ok(res == TRUE, "Expected (%d, %d, %d, %d) to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1607 GdipDeletePath(path);
1609 GdipDeleteRegion(region);
1610 GdipDeleteGraphics(graphics);
1611 ReleaseDC(0, hdc);
1614 START_TEST(region)
1616 struct GdiplusStartupInput gdiplusStartupInput;
1617 ULONG_PTR gdiplusToken;
1619 gdiplusStartupInput.GdiplusVersion = 1;
1620 gdiplusStartupInput.DebugEventCallback = NULL;
1621 gdiplusStartupInput.SuppressBackgroundThread = 0;
1622 gdiplusStartupInput.SuppressExternalCodecs = 0;
1624 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
1626 test_getregiondata();
1627 test_isinfinite();
1628 test_isempty();
1629 test_combinereplace();
1630 test_fromhrgn();
1631 test_gethrgn();
1632 test_isequal();
1633 test_translate();
1634 test_getbounds();
1635 test_isvisiblepoint();
1636 test_isvisiblerect();
1638 GdiplusShutdown(gdiplusToken);