configure: Changes from running autconf after previous patch.
[wine/hacks.git] / dlls / gdiplus / tests / region.c
blobefd2115df1a86424baf1364386c7bfcd96d24939
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 /* flags 0x4000 means its a path of shorts instead of FLOAT */
368 ok((*(buf + 8) & (~ 0x00004000)) == 0x00000000,
369 "expected 00000000 got %08x\n", *(buf + 8) & (~ 0x00004000));
371 status = GdipDeleteRegion(region);
372 expect(Ok, status);
374 /* Test a simple triangle of INTs */
375 status = GdipAddPathLine(path, 5, 6, 7, 8);
376 expect(Ok, status);
377 status = GdipAddPathLine(path, 8, 1, 5, 6);
378 expect(Ok, status);
379 status = GdipClosePathFigure(path);
380 expect(Ok, status);
381 status = GdipCreateRegionPath(path, &region);
382 expect(Ok, status);
383 status = GdipGetRegionDataSize(region, &needed);
384 expect(Ok, status);
385 expect(56, needed);
386 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
387 expect(Ok, status);
388 expect(56, needed);
389 expect_dword(buf, 48);
390 trace("buf[1] = %08x\n", buf[1]);
391 expect_magic((DWORD*)(buf + 2));
392 expect_dword(buf + 3 , 0);
393 expect_dword(buf + 4 , RGNDATA_PATH);
395 expect_dword(buf + 5, 32);
396 expect_magic((DWORD*)(buf + 6));
397 expect_dword(buf + 7, 4);
398 expect_dword(buf + 8, 0x00004000); /* ?? */
400 point = (RegionDataPoint*)buf + 9;
401 expect(5, point[0].X);
402 expect(6, point[0].Y);
403 expect(7, point[1].X); /* buf + 10 */
404 expect(8, point[1].Y);
405 expect(8, point[2].X); /* buf + 11 */
406 expect(1, point[2].Y);
407 expect(5, point[3].X); /* buf + 12 */
408 expect(6, point[3].Y);
409 expect_dword(buf + 13, 0x81010100); /* 0x01010100 if we don't close the path */
411 status = GdipDeletePath(path);
412 expect(Ok, status);
413 status = GdipDeleteRegion(region);
414 expect(Ok, status);
416 /* Test a floating-point triangle */
417 status = GdipCreatePath(FillModeAlternate, &path);
418 expect(Ok, status);
419 status = GdipAddPathLine(path, 5.6, 6.2, 7.2, 8.9);
420 expect(Ok, status);
421 status = GdipAddPathLine(path, 8.1, 1.6, 5.6, 6.2);
422 expect(Ok, status);
423 status = GdipCreateRegionPath(path, &region);
424 expect(Ok, status);
425 status = GdipGetRegionDataSize(region, &needed);
426 expect(Ok, status);
427 expect(72, needed);
428 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
429 expect(Ok, status);
430 expect(72, needed);
431 expect_dword(buf, 64);
432 trace("buf[1] = %08x\n", buf[1]);
433 expect_magic((DWORD*)(buf + 2));
434 expect_dword(buf + 3, 0);
435 expect_dword(buf + 4, RGNDATA_PATH);
437 expect_dword(buf + 5, 48);
438 expect_magic((DWORD*)(buf + 6));
439 expect_dword(buf + 7, 4);
440 expect_dword(buf + 8, 0);
441 expect_float(buf + 9, 5.6);
442 expect_float(buf + 10, 6.2);
443 expect_float(buf + 11, 7.2);
444 expect_float(buf + 12, 8.9);
445 expect_float(buf + 13, 8.1);
446 expect_float(buf + 14, 1.6);
447 expect_float(buf + 15, 5.6);
448 expect_float(buf + 16, 6.2);
450 status = GdipDeletePath(path);
451 expect(Ok, status);
452 status = GdipDeleteRegion(region);
453 expect(Ok, status);
455 /* Test for a path with > 4 points, and CombineRegionPath */
456 GdipCreatePath(FillModeAlternate, &path);
457 status = GdipAddPathLine(path, 50, 70.2, 60, 102.8);
458 expect(Ok, status);
459 status = GdipAddPathLine(path, 55.4, 122.4, 40.4, 60.2);
460 expect(Ok, status);
461 status = GdipAddPathLine(path, 45.6, 20.2, 50, 70.2);
462 expect(Ok, status);
463 rect.X = 20;
464 rect.Y = 25;
465 rect.Width = 60;
466 rect.Height = 120;
467 status = GdipCreateRegionRectI(&rect, &region);
468 expect(Ok, status);
469 status = GdipCombineRegionPath(region, path, CombineModeUnion);
470 expect(Ok, status);
472 status = GdipGetRegionDataSize(region, &needed);
473 expect(Ok, status);
474 expect(116, needed);
475 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
476 expect(Ok, status);
477 expect(116, needed);
478 expect_dword(buf, 108);
479 trace("buf[1] = %08x\n", buf[1]);
480 expect_magic((DWORD*)(buf + 2));
481 expect_dword(buf + 3, 2);
482 expect_dword(buf + 4, CombineModeUnion);
483 expect_dword(buf + 5, RGNDATA_RECT);
484 expect_float(buf + 6, 20);
485 expect_float(buf + 7, 25);
486 expect_float(buf + 8, 60);
487 expect_float(buf + 9, 120);
488 expect_dword(buf + 10, RGNDATA_PATH);
490 expect_dword(buf + 11, 68);
491 expect_magic((DWORD*)(buf + 12));
492 expect_dword(buf + 13, 6);
493 expect_float(buf + 14, 0x0);
495 expect_float(buf + 15, 50);
496 expect_float(buf + 16, 70.2);
497 expect_float(buf + 17, 60);
498 expect_float(buf + 18, 102.8);
499 expect_float(buf + 19, 55.4);
500 expect_float(buf + 20, 122.4);
501 expect_float(buf + 21, 40.4);
502 expect_float(buf + 22, 60.2);
503 expect_float(buf + 23, 45.6);
504 expect_float(buf + 24, 20.2);
505 expect_float(buf + 25, 50);
506 expect_float(buf + 26, 70.2);
507 expect_dword(buf + 27, 0x01010100);
508 ok(*(buf + 28) == 0x00000101 || *(buf + 28) == 0x43050101 /* Win 7 */,
509 "expected 00000101 or 43050101 got %08x\n", *(buf + 28));
511 status = GdipDeletePath(path);
512 expect(Ok, status);
513 status = GdipDeleteRegion(region);
514 expect(Ok, status);
517 static void test_isinfinite(void)
519 GpStatus status;
520 GpRegion *region;
521 GpGraphics *graphics = NULL;
522 GpMatrix *m;
523 HDC hdc = GetDC(0);
524 BOOL res;
526 status = GdipCreateFromHDC(hdc, &graphics);
527 expect(Ok, status);
528 GdipCreateRegion(&region);
530 GdipCreateMatrix2(3.0, 0.0, 0.0, 1.0, 20.0, 30.0, &m);
532 /* NULL arguments */
533 status = GdipIsInfiniteRegion(NULL, NULL, NULL);
534 expect(InvalidParameter, status);
535 status = GdipIsInfiniteRegion(region, NULL, NULL);
536 expect(InvalidParameter, status);
537 status = GdipIsInfiniteRegion(NULL, graphics, NULL);
538 expect(InvalidParameter, status);
539 status = GdipIsInfiniteRegion(NULL, NULL, &res);
540 expect(InvalidParameter, status);
541 status = GdipIsInfiniteRegion(region, NULL, &res);
542 expect(InvalidParameter, status);
544 res = FALSE;
545 status = GdipIsInfiniteRegion(region, graphics, &res);
546 expect(Ok, status);
547 expect(TRUE, res);
549 /* after world transform */
550 status = GdipSetWorldTransform(graphics, m);
551 expect(Ok, status);
553 res = FALSE;
554 status = GdipIsInfiniteRegion(region, graphics, &res);
555 expect(Ok, status);
556 expect(TRUE, res);
558 GdipDeleteMatrix(m);
559 GdipDeleteRegion(region);
560 GdipDeleteGraphics(graphics);
561 ReleaseDC(0, hdc);
564 static void test_isempty(void)
566 GpStatus status;
567 GpRegion *region;
568 GpGraphics *graphics = NULL;
569 HDC hdc = GetDC(0);
570 BOOL res;
572 status = GdipCreateFromHDC(hdc, &graphics);
573 expect(Ok, status);
574 GdipCreateRegion(&region);
576 /* NULL arguments */
577 status = GdipIsEmptyRegion(NULL, NULL, NULL);
578 expect(InvalidParameter, status);
579 status = GdipIsEmptyRegion(region, NULL, NULL);
580 expect(InvalidParameter, status);
581 status = GdipIsEmptyRegion(NULL, graphics, NULL);
582 expect(InvalidParameter, status);
583 status = GdipIsEmptyRegion(NULL, NULL, &res);
584 expect(InvalidParameter, status);
585 status = GdipIsEmptyRegion(region, NULL, &res);
586 expect(InvalidParameter, status);
588 /* default is infinite */
589 res = TRUE;
590 status = GdipIsEmptyRegion(region, graphics, &res);
591 expect(Ok, status);
592 expect(FALSE, res);
594 status = GdipSetEmpty(region);
595 expect(Ok, status);
597 res = FALSE;
598 status = GdipIsEmptyRegion(region, graphics, &res);
599 expect(Ok, status);
600 expect(TRUE, res);
602 GdipDeleteRegion(region);
603 GdipDeleteGraphics(graphics);
604 ReleaseDC(0, hdc);
607 static void test_combinereplace(void)
609 GpStatus status;
610 GpRegion *region, *region2;
611 GpPath *path;
612 GpRectF rectf;
613 UINT needed;
614 DWORD buf[50];
616 rectf.X = rectf.Y = 0.0;
617 rectf.Width = rectf.Height = 100.0;
619 status = GdipCreateRegionRect(&rectf, &region);
620 expect(Ok, status);
622 /* replace with the same rectangle */
623 status = GdipCombineRegionRect(region, &rectf,CombineModeReplace);
624 expect(Ok, status);
626 status = GdipGetRegionDataSize(region, &needed);
627 expect(Ok, status);
628 expect(36, needed);
629 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
630 expect(Ok, status);
631 expect(36, needed);
632 expect_dword(buf, 28);
633 trace("buf[1] = %08x\n", buf[1]);
634 expect_magic((DWORD*)(buf + 2));
635 expect_dword(buf + 3, 0);
636 expect_dword(buf + 4, RGNDATA_RECT);
638 /* replace with path */
639 status = GdipCreatePath(FillModeAlternate, &path);
640 expect(Ok, status);
641 status = GdipAddPathEllipse(path, 0.0, 0.0, 100.0, 250.0);
642 expect(Ok, status);
643 status = GdipCombineRegionPath(region, path, CombineModeReplace);
644 expect(Ok, status);
646 status = GdipGetRegionDataSize(region, &needed);
647 expect(Ok, status);
648 expect(156, needed);
649 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
650 expect(Ok, status);
651 expect(156, needed);
652 expect_dword(buf, 148);
653 trace("buf[1] = %08x\n", buf[1]);
654 expect_magic((DWORD*)(buf + 2));
655 expect_dword(buf + 3, 0);
656 expect_dword(buf + 4, RGNDATA_PATH);
657 GdipDeletePath(path);
659 /* replace with infinite rect */
660 status = GdipCreateRegion(&region2);
661 expect(Ok, status);
662 status = GdipCombineRegionRegion(region, region2, CombineModeReplace);
663 expect(Ok, status);
665 status = GdipGetRegionDataSize(region, &needed);
666 expect(Ok, status);
667 expect(20, needed);
668 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
669 expect(Ok, status);
670 expect(20, needed);
671 expect_dword(buf, 12);
672 trace("buf[1] = %08x\n", buf[1]);
673 expect_magic((DWORD*)(buf + 2));
674 expect_dword(buf + 3, 0);
675 expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
676 GdipDeleteRegion(region2);
678 /* more complex case : replace with a combined region */
679 status = GdipCreateRegionRect(&rectf, &region2);
680 expect(Ok, status);
681 status = GdipCreatePath(FillModeAlternate, &path);
682 expect(Ok, status);
683 status = GdipAddPathEllipse(path, 0.0, 0.0, 100.0, 250.0);
684 expect(Ok, status);
685 status = GdipCombineRegionPath(region2, path, CombineModeUnion);
686 expect(Ok, status);
687 GdipDeletePath(path);
688 status = GdipCombineRegionRegion(region, region2, CombineModeReplace);
689 expect(Ok, status);
690 GdipDeleteRegion(region2);
692 status = GdipGetRegionDataSize(region, &needed);
693 expect(Ok, status);
694 expect(180, needed);
695 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
696 expect(Ok, status);
697 expect(180, needed);
698 expect_dword(buf, 172);
699 trace("buf[1] = %08x\n", buf[1]);
700 expect_magic((DWORD*)(buf + 2));
701 expect_dword(buf + 3, 2);
702 expect_dword(buf + 4, CombineModeUnion);
704 GdipDeleteRegion(region);
707 static void test_fromhrgn(void)
709 GpStatus status;
710 GpRegion *region = (GpRegion*)0xabcdef01;
711 HRGN hrgn;
712 UINT needed;
713 DWORD buf[220];
714 RegionDataPoint *point;
715 GpGraphics *graphics = NULL;
716 HDC hdc;
717 BOOL res;
719 /* NULL */
720 status = GdipCreateRegionHrgn(NULL, NULL);
721 expect(InvalidParameter, status);
722 status = GdipCreateRegionHrgn(NULL, &region);
723 expect(InvalidParameter, status);
724 status = GdipCreateRegionHrgn((HRGN)0xdeadbeef, &region);
725 expect(InvalidParameter, status);
726 ok(region == (GpRegion*)0xabcdef01, "Expected region not to be created\n");
728 /* empty rectangle */
729 hrgn = CreateRectRgn(0, 0, 0, 0);
730 status = GdipCreateRegionHrgn(hrgn, &region);
731 expect(Ok, status);
732 if(status == Ok) {
734 hdc = GetDC(0);
735 status = GdipCreateFromHDC(hdc, &graphics);
736 expect(Ok, status);
737 res = FALSE;
738 status = GdipIsEmptyRegion(region, graphics, &res);
739 expect(Ok, status);
740 expect(TRUE, res);
741 GdipDeleteGraphics(graphics);
742 ReleaseDC(0, hdc);
743 GdipDeleteRegion(region);
746 DeleteObject(hrgn);
748 /* rectangle */
749 hrgn = CreateRectRgn(0, 0, 100, 10);
750 status = GdipCreateRegionHrgn(hrgn, &region);
751 expect(Ok, status);
753 status = GdipGetRegionDataSize(region, &needed);
754 expect(Ok, status);
755 expect(56, needed);
757 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
758 expect(Ok, status);
760 if(status == Ok){
762 expect(56, needed);
763 expect_dword(buf, 48);
764 expect_magic((DWORD*)(buf + 2));
765 expect_dword(buf + 3, 0);
766 expect_dword(buf + 4, RGNDATA_PATH);
767 expect_dword(buf + 5, 0x00000020);
768 expect_magic((DWORD*)(buf + 6));
769 expect_dword(buf + 7, 0x00000004);
770 todo_wine expect_dword(buf + 8, 0x00006000); /* ?? */
772 point = (RegionDataPoint*)buf + 9;
774 expect(0, point[0].X);
775 expect(0, point[0].Y);
777 expect(100,point[1].X); /* buf + 10 */
778 expect(0, point[1].Y);
779 expect(100,point[2].X); /* buf + 11 */
780 expect(10, point[2].Y);
782 expect(0, point[3].X); /* buf + 12 */
784 expect(10, point[3].Y);
785 expect_dword(buf + 13, 0x81010100); /* closed */
789 GdipDeleteRegion(region);
790 DeleteObject(hrgn);
792 /* ellipse */
793 hrgn = CreateEllipticRgn(0, 0, 100, 10);
794 status = GdipCreateRegionHrgn(hrgn, &region);
795 expect(Ok, status);
797 status = GdipGetRegionDataSize(region, &needed);
798 expect(Ok, status);
799 ok(needed == 216 ||
800 needed == 196, /* win98 */
801 "Got %.8x\n", needed);
803 status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
804 expect(Ok, status);
806 if(status == Ok && needed == 216) /* Don't try to test win98 layout */
808 expect(Ok, status);
809 expect(216, needed);
810 expect_dword(buf, 208);
811 expect_magic((DWORD*)(buf + 2));
812 expect_dword(buf + 3, 0);
813 expect_dword(buf + 4, RGNDATA_PATH);
814 expect_dword(buf + 5, 0x000000C0);
815 expect_magic((DWORD*)(buf + 6));
816 expect_dword(buf + 7, 0x00000024);
817 todo_wine expect_dword(buf + 8, 0x00006000); /* ?? */
820 GdipDeleteRegion(region);
821 DeleteObject(hrgn);
824 static void test_gethrgn(void)
826 GpStatus status;
827 GpRegion *region, *region2;
828 GpPath *path;
829 GpGraphics *graphics;
830 HRGN hrgn;
831 HDC hdc=GetDC(0);
832 static const RECT empty_rect = {0,0,0,0};
833 static const RECT test_rect = {10, 11, 20, 21};
834 static const GpRectF test_rectF = {10.0, 11.0, 10.0, 10.0};
835 static const RECT scaled_rect = {20, 22, 40, 42};
836 static const RECT test_rect2 = {10, 21, 20, 31};
837 static const GpRectF test_rect2F = {10.0, 21.0, 10.0, 10.0};
838 static const RECT test_rect3 = {10, 11, 20, 31};
839 static const GpRectF test_rect3F = {10.0, 11.0, 10.0, 20.0};
841 status = GdipCreateFromHDC(hdc, &graphics);
842 ok(status == Ok, "status %08x\n", status);
844 status = GdipCreateRegion(&region);
845 ok(status == Ok, "status %08x\n", status);
847 status = GdipGetRegionHRgn(NULL, graphics, &hrgn);
848 ok(status == InvalidParameter, "status %08x\n", status);
849 status = GdipGetRegionHRgn(region, graphics, NULL);
850 ok(status == InvalidParameter, "status %08x\n", status);
852 status = GdipGetRegionHRgn(region, NULL, &hrgn);
853 ok(status == Ok, "status %08x\n", status);
854 ok(hrgn == NULL, "hrgn=%p\n", hrgn);
855 DeleteObject(hrgn);
857 status = GdipGetRegionHRgn(region, graphics, &hrgn);
858 ok(status == Ok, "status %08x\n", status);
859 ok(hrgn == NULL, "hrgn=%p\n", hrgn);
860 DeleteObject(hrgn);
862 status = GdipSetEmpty(region);
863 ok(status == Ok, "status %08x\n", status);
864 status = GdipGetRegionHRgn(region, NULL, &hrgn);
865 ok(status == Ok, "status %08x\n", status);
866 verify_region(hrgn, &empty_rect);
867 DeleteObject(hrgn);
869 status = GdipCreatePath(FillModeAlternate, &path);
870 ok(status == Ok, "status %08x\n", status);
871 status = GdipAddPathRectangle(path, 10.0, 11.0, 10.0, 10.0);
872 ok(status == Ok, "status %08x\n", status);
874 status = GdipCreateRegionPath(path, &region2);
875 ok(status == Ok, "status %08x\n", status);
876 status = GdipGetRegionHRgn(region2, NULL, &hrgn);
877 ok(status == Ok, "status %08x\n", status);
878 verify_region(hrgn, &test_rect);
879 DeleteObject(hrgn);
881 /* resulting HRGN is in device coordinates */
882 status = GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
883 ok(status == Ok, "status %08x\n", status);
884 status = GdipGetRegionHRgn(region2, graphics, &hrgn);
885 ok(status == Ok, "status %08x\n", status);
886 verify_region(hrgn, &scaled_rect);
887 DeleteObject(hrgn);
889 status = GdipCombineRegionRect(region2, &test_rectF, CombineModeReplace);
890 ok(status == Ok, "status %08x\n", status);
891 status = GdipGetRegionHRgn(region2, NULL, &hrgn);
892 ok(status == Ok, "status %08x\n", status);
893 verify_region(hrgn, &test_rect);
894 DeleteObject(hrgn);
896 status = GdipGetRegionHRgn(region2, graphics, &hrgn);
897 ok(status == Ok, "status %08x\n", status);
898 verify_region(hrgn, &scaled_rect);
899 DeleteObject(hrgn);
901 status = GdipSetInfinite(region);
902 ok(status == Ok, "status %08x\n", status);
903 status = GdipCombineRegionRect(region, &test_rectF, CombineModeIntersect);
904 ok(status == Ok, "status %08x\n", status);
905 status = GdipGetRegionHRgn(region, NULL, &hrgn);
906 ok(status == Ok, "status %08x\n", status);
907 verify_region(hrgn, &test_rect);
908 DeleteObject(hrgn);
910 status = GdipCombineRegionRect(region, &test_rectF, CombineModeReplace);
911 ok(status == Ok, "status %08x\n", status);
912 status = GdipCombineRegionRect(region, &test_rect2F, CombineModeUnion);
913 ok(status == Ok, "status %08x\n", status);
914 status = GdipGetRegionHRgn(region, NULL, &hrgn);
915 ok(status == Ok, "status %08x\n", status);
916 verify_region(hrgn, &test_rect3);
917 DeleteObject(hrgn);
919 status = GdipCombineRegionRect(region, &test_rect3F, CombineModeReplace);
920 ok(status == Ok, "status %08x\n", status);
921 status = GdipCombineRegionRect(region, &test_rect2F, CombineModeXor);
922 ok(status == Ok, "status %08x\n", status);
923 status = GdipGetRegionHRgn(region, NULL, &hrgn);
924 ok(status == Ok, "status %08x\n", status);
925 verify_region(hrgn, &test_rect);
926 DeleteObject(hrgn);
928 status = GdipCombineRegionRect(region, &test_rect3F, CombineModeReplace);
929 ok(status == Ok, "status %08x\n", status);
930 status = GdipCombineRegionRect(region, &test_rectF, CombineModeExclude);
931 ok(status == Ok, "status %08x\n", status);
932 status = GdipGetRegionHRgn(region, NULL, &hrgn);
933 ok(status == Ok, "status %08x\n", status);
934 verify_region(hrgn, &test_rect2);
935 DeleteObject(hrgn);
937 status = GdipCombineRegionRect(region, &test_rectF, CombineModeReplace);
938 ok(status == Ok, "status %08x\n", status);
939 status = GdipCombineRegionRect(region, &test_rect3F, CombineModeComplement);
940 ok(status == Ok, "status %08x\n", status);
941 status = GdipGetRegionHRgn(region, NULL, &hrgn);
942 ok(status == Ok, "status %08x\n", status);
943 verify_region(hrgn, &test_rect2);
944 DeleteObject(hrgn);
946 status = GdipDeletePath(path);
947 ok(status == Ok, "status %08x\n", status);
948 status = GdipDeleteRegion(region);
949 ok(status == Ok, "status %08x\n", status);
950 status = GdipDeleteRegion(region2);
951 ok(status == Ok, "status %08x\n", status);
952 status = GdipDeleteGraphics(graphics);
953 ok(status == Ok, "status %08x\n", status);
954 ReleaseDC(0, hdc);
957 static void test_isequal(void)
959 GpRegion *region1, *region2;
960 GpGraphics *graphics;
961 GpRectF rectf;
962 GpStatus status;
963 HDC hdc = GetDC(0);
964 BOOL res;
966 status = GdipCreateFromHDC(hdc, &graphics);
967 ok(status == Ok, "status %08x\n", status);
969 status = GdipCreateRegion(&region1);
970 ok(status == Ok, "status %08x\n", status);
971 status = GdipCreateRegion(&region2);
972 ok(status == Ok, "status %08x\n", status);
974 /* NULL */
975 status = GdipIsEqualRegion(NULL, NULL, NULL, NULL);
976 ok(status == InvalidParameter, "status %08x\n", status);
977 status = GdipIsEqualRegion(region1, region2, NULL, NULL);
978 ok(status == InvalidParameter, "status %08x\n", status);
979 status = GdipIsEqualRegion(region1, region2, graphics, NULL);
980 ok(status == InvalidParameter, "status %08x\n", status);
981 status = GdipIsEqualRegion(region1, region2, NULL, &res);
982 ok(status == InvalidParameter, "status %08x\n", status);
984 /* infinite regions */
985 res = FALSE;
986 status = GdipIsEqualRegion(region1, region2, graphics, &res);
987 ok(status == Ok, "status %08x\n", status);
988 ok(res, "Expected to be equal.\n");
989 /* empty regions */
990 status = GdipSetEmpty(region1);
991 ok(status == Ok, "status %08x\n", status);
992 status = GdipSetEmpty(region2);
993 ok(status == Ok, "status %08x\n", status);
994 res = FALSE;
995 status = GdipIsEqualRegion(region1, region2, graphics, &res);
996 ok(status == Ok, "status %08x\n", status);
997 ok(res, "Expected to be equal.\n");
998 /* empty & infinite */
999 status = GdipSetInfinite(region1);
1000 ok(status == Ok, "status %08x\n", status);
1001 res = TRUE;
1002 status = GdipIsEqualRegion(region1, region2, graphics, &res);
1003 ok(status == Ok, "status %08x\n", status);
1004 ok(!res, "Expected to be unequal.\n");
1005 /* rect & (inf/empty) */
1006 rectf.X = rectf.Y = 0.0;
1007 rectf.Width = rectf.Height = 100.0;
1008 status = GdipCombineRegionRect(region1, &rectf, CombineModeReplace);
1009 ok(status == Ok, "status %08x\n", status);
1010 res = TRUE;
1011 status = GdipIsEqualRegion(region1, region2, graphics, &res);
1012 ok(status == Ok, "status %08x\n", status);
1013 ok(!res, "Expected to be unequal.\n");
1014 status = GdipSetInfinite(region2);
1015 ok(status == Ok, "status %08x\n", status);
1016 res = TRUE;
1017 status = GdipIsEqualRegion(region1, region2, graphics, &res);
1018 ok(status == Ok, "status %08x\n", status);
1019 ok(!res, "Expected to be unequal.\n");
1020 /* roughly equal rectangles */
1021 rectf.X = rectf.Y = 0.0;
1022 rectf.Width = rectf.Height = 100.001;
1023 status = GdipCombineRegionRect(region2, &rectf, CombineModeReplace);
1024 ok(status == Ok, "status %08x\n", status);
1025 res = FALSE;
1026 status = GdipIsEqualRegion(region1, region2, graphics, &res);
1027 ok(status == Ok, "status %08x\n", status);
1028 ok(res, "Expected to be equal.\n");
1029 /* equal rectangles */
1030 rectf.X = rectf.Y = 0.0;
1031 rectf.Width = rectf.Height = 100.0;
1032 status = GdipCombineRegionRect(region2, &rectf, CombineModeReplace);
1033 ok(status == Ok, "status %08x\n", status);
1034 res = FALSE;
1035 status = GdipIsEqualRegion(region1, region2, graphics, &res);
1036 ok(status == Ok, "status %08x\n", status);
1037 ok(res, "Expected to be equal.\n");
1039 /* cleanup */
1040 status = GdipDeleteRegion(region1);
1041 ok(status == Ok, "status %08x\n", status);
1042 status = GdipDeleteRegion(region2);
1043 ok(status == Ok, "status %08x\n", status);
1044 status = GdipDeleteGraphics(graphics);
1045 ok(status == Ok, "status %08x\n", status);
1046 ReleaseDC(0, hdc);
1049 static void test_translate(void)
1051 GpRegion *region, *region2;
1052 GpGraphics *graphics;
1053 GpPath *path;
1054 GpRectF rectf;
1055 GpStatus status;
1056 HDC hdc = GetDC(0);
1057 BOOL res;
1059 status = GdipCreateFromHDC(hdc, &graphics);
1060 ok(status == Ok, "status %08x\n", status);
1062 status = GdipCreatePath(FillModeAlternate, &path);
1063 ok(status == Ok, "status %08x\n", status);
1065 status = GdipCreateRegion(&region);
1066 ok(status == Ok, "status %08x\n", status);
1067 status = GdipCreateRegion(&region2);
1068 ok(status == Ok, "status %08x\n", status);
1070 /* NULL */
1071 status = GdipTranslateRegion(NULL, 0.0, 0.0);
1072 ok(status == InvalidParameter, "status %08x\n", status);
1074 /* infinite */
1075 status = GdipTranslateRegion(region, 10.0, 10.0);
1076 ok(status == Ok, "status %08x\n", status);
1077 /* empty */
1078 status = GdipSetEmpty(region);
1079 ok(status == Ok, "status %08x\n", status);
1080 status = GdipTranslateRegion(region, 10.0, 10.0);
1081 ok(status == Ok, "status %08x\n", status);
1082 /* rect */
1083 rectf.X = 10.0; rectf.Y = 0.0;
1084 rectf.Width = rectf.Height = 100.0;
1085 status = GdipCombineRegionRect(region, &rectf, CombineModeReplace);
1086 ok(status == Ok, "status %08x\n", status);
1087 rectf.X = 15.0; rectf.Y = -2.0;
1088 rectf.Width = rectf.Height = 100.0;
1089 status = GdipCombineRegionRect(region2, &rectf, CombineModeReplace);
1090 ok(status == Ok, "status %08x\n", status);
1091 status = GdipTranslateRegion(region, 5.0, -2.0);
1092 ok(status == Ok, "status %08x\n", status);
1093 res = FALSE;
1094 status = GdipIsEqualRegion(region, region2, graphics, &res);
1095 ok(status == Ok, "status %08x\n", status);
1096 ok(res, "Expected to be equal.\n");
1097 /* path */
1098 status = GdipAddPathEllipse(path, 0.0, 10.0, 100.0, 150.0);
1099 ok(status == Ok, "status %08x\n", status);
1100 status = GdipCombineRegionPath(region, path, CombineModeReplace);
1101 ok(status == Ok, "status %08x\n", status);
1102 status = GdipResetPath(path);
1103 ok(status == Ok, "status %08x\n", status);
1104 status = GdipAddPathEllipse(path, 10.0, 21.0, 100.0, 150.0);
1105 ok(status == Ok, "status %08x\n", status);
1106 status = GdipCombineRegionPath(region2, path, CombineModeReplace);
1107 ok(status == Ok, "status %08x\n", status);
1108 status = GdipTranslateRegion(region, 10.0, 11.0);
1109 ok(status == Ok, "status %08x\n", status);
1110 res = FALSE;
1111 status = GdipIsEqualRegion(region, region2, graphics, &res);
1112 ok(status == Ok, "status %08x\n", status);
1113 ok(res, "Expected to be equal.\n");
1115 status = GdipDeleteRegion(region);
1116 ok(status == Ok, "status %08x\n", status);
1117 status = GdipDeleteRegion(region2);
1118 ok(status == Ok, "status %08x\n", status);
1119 status = GdipDeleteGraphics(graphics);
1120 ok(status == Ok, "status %08x\n", status);
1121 status = GdipDeletePath(path);
1122 ok(status == Ok, "status %08x\n", status);
1123 ReleaseDC(0, hdc);
1126 static void test_getbounds(void)
1128 GpRegion *region;
1129 GpGraphics *graphics;
1130 GpStatus status;
1131 GpRectF rectf;
1132 HDC hdc = GetDC(0);
1134 status = GdipCreateFromHDC(hdc, &graphics);
1135 ok(status == Ok, "status %08x\n", status);
1136 status = GdipCreateRegion(&region);
1137 ok(status == Ok, "status %08x\n", status);
1139 /* NULL */
1140 status = GdipGetRegionBounds(NULL, NULL, NULL);
1141 ok(status == InvalidParameter, "status %08x\n", status);
1142 status = GdipGetRegionBounds(region, NULL, NULL);
1143 ok(status == InvalidParameter, "status %08x\n", status);
1144 status = GdipGetRegionBounds(region, graphics, NULL);
1145 ok(status == InvalidParameter, "status %08x\n", status);
1146 /* infinite */
1147 rectf.X = rectf.Y = 0.0;
1148 rectf.Height = rectf.Width = 100.0;
1149 status = GdipGetRegionBounds(region, graphics, &rectf);
1150 ok(status == Ok, "status %08x\n", status);
1151 ok(rectf.X == -(REAL)(1 << 22), "Expected X = %.2f, got %.2f\n", -(REAL)(1 << 22), rectf.X);
1152 ok(rectf.Y == -(REAL)(1 << 22), "Expected Y = %.2f, got %.2f\n", -(REAL)(1 << 22), rectf.Y);
1153 ok(rectf.Width == (REAL)(1 << 23), "Expected width = %.2f, got %.2f\n", (REAL)(1 << 23), rectf.Width);
1154 ok(rectf.Height == (REAL)(1 << 23), "Expected height = %.2f, got %.2f\n",(REAL)(1 << 23), rectf.Height);
1155 /* empty */
1156 rectf.X = rectf.Y = 0.0;
1157 rectf.Height = rectf.Width = 100.0;
1158 status = GdipSetEmpty(region);
1159 ok(status == Ok, "status %08x\n", status);
1160 status = GdipGetRegionBounds(region, graphics, &rectf);
1161 ok(status == Ok, "status %08x\n", status);
1162 ok(rectf.X == 0.0, "Expected X = 0.0, got %.2f\n", rectf.X);
1163 ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
1164 ok(rectf.Width == 0.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
1165 ok(rectf.Height == 0.0, "Expected height = 0.0, got %.2f\n", rectf.Height);
1166 /* rect */
1167 rectf.X = 10.0; rectf.Y = 0.0;
1168 rectf.Width = rectf.Height = 100.0;
1169 status = GdipCombineRegionRect(region, &rectf, CombineModeReplace);
1170 ok(status == Ok, "status %08x\n", status);
1171 rectf.X = rectf.Y = 0.0;
1172 rectf.Height = rectf.Width = 0.0;
1173 status = GdipGetRegionBounds(region, graphics, &rectf);
1174 ok(status == Ok, "status %08x\n", status);
1175 ok(rectf.X == 10.0, "Expected X = 0.0, got %.2f\n", rectf.X);
1176 ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
1177 ok(rectf.Width == 100.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
1178 ok(rectf.Height == 100.0, "Expected height = 0.0, got %.2f\n", rectf.Height);
1180 /* the world and page transforms are ignored */
1181 GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
1182 GdipSetPageUnit(graphics, UnitInch);
1183 GdipSetPageScale(graphics, 2.0);
1184 status = GdipGetRegionBounds(region, graphics, &rectf);
1185 ok(status == Ok, "status %08x\n", status);
1186 ok(rectf.X == 10.0, "Expected X = 0.0, got %.2f\n", rectf.X);
1187 ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
1188 ok(rectf.Width == 100.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
1190 rectf.X = 10.0; rectf.Y = 0.0;
1191 rectf.Width = rectf.Height = 100.0;
1192 status = GdipCombineRegionRect(region, &rectf, CombineModeReplace);
1193 ok(status == Ok, "status %08x\n", status);
1194 rectf.X = rectf.Y = 0.0;
1195 rectf.Height = rectf.Width = 0.0;
1196 status = GdipGetRegionBounds(region, graphics, &rectf);
1197 ok(status == Ok, "status %08x\n", status);
1198 ok(rectf.X == 10.0, "Expected X = 0.0, got %.2f\n", rectf.X);
1199 ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
1200 ok(rectf.Width == 100.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
1201 ok(rectf.Height == 100.0, "Expected height = 0.0, got %.2f\n", rectf.Height);
1203 status = GdipDeleteRegion(region);
1204 ok(status == Ok, "status %08x\n", status);
1205 status = GdipDeleteGraphics(graphics);
1206 ok(status == Ok, "status %08x\n", status);
1207 ReleaseDC(0, hdc);
1210 static void test_isvisiblepoint(void)
1212 HDC hdc = GetDC(0);
1213 GpGraphics* graphics;
1214 GpRegion* region;
1215 GpPath* path;
1216 GpRectF rectf;
1217 GpStatus status;
1218 BOOL res;
1219 REAL x, y;
1221 status = GdipCreateFromHDC(hdc, &graphics);
1222 expect(Ok, status);
1224 status = GdipCreateRegion(&region);
1225 expect(Ok, status);
1227 /* null parameters */
1228 status = GdipIsVisibleRegionPoint(NULL, 0, 0, graphics, &res);
1229 expect(InvalidParameter, status);
1230 status = GdipIsVisibleRegionPointI(NULL, 0, 0, graphics, &res);
1231 expect(InvalidParameter, status);
1233 status = GdipIsVisibleRegionPoint(region, 0, 0, NULL, &res);
1234 expect(Ok, status);
1235 status = GdipIsVisibleRegionPointI(region, 0, 0, NULL, &res);
1236 expect(Ok, status);
1238 status = GdipIsVisibleRegionPoint(region, 0, 0, graphics, NULL);
1239 expect(InvalidParameter, status);
1240 status = GdipIsVisibleRegionPointI(region, 0, 0, graphics, NULL);
1241 expect(InvalidParameter, status);
1243 /* infinite region */
1244 status = GdipIsInfiniteRegion(region, graphics, &res);
1245 expect(Ok, status);
1246 ok(res == TRUE, "Region should be infinite\n");
1248 x = 10;
1249 y = 10;
1250 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1251 expect(Ok, status);
1252 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1253 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1254 expect(Ok, status);
1255 ok(res == TRUE, "Expected (%d, %d) to be visible\n", (INT)x, (INT)y);
1257 x = -10;
1258 y = -10;
1259 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1260 expect(Ok, status);
1261 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1262 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1263 expect(Ok, status);
1264 ok(res == TRUE, "Expected (%d, %d) to be visible\n", (INT)x, (INT)y);
1266 /* rectangular region */
1267 rectf.X = 10;
1268 rectf.Y = 20;
1269 rectf.Width = 30;
1270 rectf.Height = 40;
1272 status = GdipCombineRegionRect(region, &rectf, CombineModeReplace);
1273 expect(Ok, status);
1275 x = 0;
1276 y = 0;
1277 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1278 expect(Ok, status);
1279 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1280 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1281 expect(Ok, status);
1282 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1284 x = 9;
1285 y = 19;
1286 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1287 expect(Ok, status);
1288 ok(res == FALSE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1290 x = 9.25;
1291 y = 19.25;
1292 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1293 expect(Ok, status);
1294 ok(res == FALSE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1296 x = 9.5;
1297 y = 19.5;
1298 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1299 expect(Ok, status);
1300 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1302 x = 9.75;
1303 y = 19.75;
1304 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1305 expect(Ok, status);
1306 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1308 x = 10;
1309 y = 20;
1310 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1311 expect(Ok, status);
1312 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1314 x = 25;
1315 y = 40;
1316 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1317 expect(Ok, status);
1318 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1319 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1320 expect(Ok, status);
1321 ok(res == TRUE, "Expected (%d, %d) to be visible\n", (INT)x, (INT)y);
1323 x = 40;
1324 y = 60;
1325 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1326 expect(Ok, status);
1327 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1328 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1329 expect(Ok, status);
1330 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1332 /* translate into the center of the rectangle */
1333 status = GdipTranslateWorldTransform(graphics, 25, 40, MatrixOrderAppend);
1334 expect(Ok, status);
1336 /* native ignores the world transform, so treat these as if
1337 * no transform exists */
1338 x = -20;
1339 y = -30;
1340 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1341 expect(Ok, status);
1342 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1343 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1344 expect(Ok, status);
1345 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1347 x = 0;
1348 y = 0;
1349 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1350 expect(Ok, status);
1351 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1352 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1353 expect(Ok, status);
1354 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1356 x = 25;
1357 y = 40;
1358 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1359 expect(Ok, status);
1360 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1361 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1362 expect(Ok, status);
1363 ok(res == TRUE, "Expected (%d, %d) to be visible\n", (INT)x, (INT)y);
1365 /* translate back to origin */
1366 status = GdipTranslateWorldTransform(graphics, -25, -40, MatrixOrderAppend);
1367 expect(Ok, status);
1369 /* region from path */
1370 status = GdipCreatePath(FillModeAlternate, &path);
1371 expect(Ok, status);
1373 status = GdipAddPathEllipse(path, 10, 20, 30, 40);
1374 expect(Ok, status);
1376 status = GdipCombineRegionPath(region, path, CombineModeReplace);
1377 expect(Ok, status);
1379 x = 11;
1380 y = 21;
1381 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1382 expect(Ok, status);
1383 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1384 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1385 expect(Ok, status);
1386 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1388 x = 25;
1389 y = 40;
1390 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1391 expect(Ok, status);
1392 ok(res == TRUE, "Expected (%.2f, %.2f) to be visible\n", x, y);
1393 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1394 expect(Ok, status);
1395 ok(res == TRUE, "Expected (%d, %d) to be visible\n", (INT)x, (INT)y);
1397 x = 40;
1398 y = 60;
1399 status = GdipIsVisibleRegionPoint(region, x, y, graphics, &res);
1400 expect(Ok, status);
1401 ok(res == FALSE, "Expected (%.2f, %.2f) not to be visible\n", x, y);
1402 status = GdipIsVisibleRegionPointI(region, (INT)x, (INT)y, graphics, &res);
1403 expect(Ok, status);
1404 ok(res == FALSE, "Expected (%d, %d) not to be visible\n", (INT)x, (INT)y);
1406 GdipDeletePath(path);
1408 GdipDeleteRegion(region);
1409 GdipDeleteGraphics(graphics);
1410 ReleaseDC(0, hdc);
1413 static void test_isvisiblerect(void)
1415 HDC hdc = GetDC(0);
1416 GpGraphics* graphics;
1417 GpRegion* region;
1418 GpPath* path;
1419 GpRectF rectf;
1420 GpStatus status;
1421 BOOL res;
1422 REAL x, y, w, h;
1424 status = GdipCreateFromHDC(hdc, &graphics);
1425 expect(Ok, status);
1427 status = GdipCreateRegion(&region);
1428 expect(Ok, status);
1430 /* null parameters */
1431 status = GdipIsVisibleRegionRect(NULL, 0, 0, 0, 0, graphics, &res);
1432 expect(InvalidParameter, status);
1433 status = GdipIsVisibleRegionRectI(NULL, 0, 0, 0, 0, graphics, &res);
1434 expect(InvalidParameter, status);
1436 status = GdipIsVisibleRegionRect(region, 0, 0, 0, 0, NULL, &res);
1437 expect(Ok, status);
1438 status = GdipIsVisibleRegionRectI(region, 0, 0, 0, 0, NULL, &res);
1439 expect(Ok, status);
1441 status = GdipIsVisibleRegionRect(region, 0, 0, 0, 0, graphics, NULL);
1442 expect(InvalidParameter, status);
1443 status = GdipIsVisibleRegionRectI(region, 0, 0, 0, 0, graphics, NULL);
1444 expect(InvalidParameter, status);
1446 /* infinite region */
1447 status = GdipIsInfiniteRegion(region, graphics, &res);
1448 expect(Ok, status);
1449 ok(res == TRUE, "Region should be infinite\n");
1451 x = 10; w = 10;
1452 y = 10; h = 10;
1453 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1454 expect(Ok, status);
1455 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1457 x = -10; w = 5;
1458 y = -10; h = 5;
1459 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1460 expect(Ok, status);
1461 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1463 /* rectangular region */
1464 rectf.X = 10;
1465 rectf.Y = 20;
1466 rectf.Width = 30;
1467 rectf.Height = 40;
1469 status = GdipCombineRegionRect(region, &rectf, CombineModeIntersect);
1470 expect(Ok, status);
1472 /* entirely within the region */
1473 x = 11; w = 10;
1474 y = 12; h = 10;
1475 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1476 expect(Ok, status);
1477 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1478 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1479 expect(Ok, status);
1480 ok(res == TRUE, "Expected (%d, %d, %d, %d) to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1482 /* entirely outside of the region */
1483 x = 0; w = 5;
1484 y = 0; h = 5;
1485 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1486 expect(Ok, status);
1487 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1488 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1489 expect(Ok, status);
1490 ok(res == FALSE, "Expected (%d, %d, %d, %d) not to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1492 /* corner cases */
1493 x = 0; w = 10;
1494 y = 0; h = 20;
1495 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1496 expect(Ok, status);
1497 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1499 x = 0; w = 10.25;
1500 y = 0; h = 20.25;
1501 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1502 expect(Ok, status);
1503 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1505 x = 39; w = 10;
1506 y = 59; h = 10;
1507 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1508 expect(Ok, status);
1509 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1511 x = 39.25; w = 10;
1512 y = 59.25; h = 10;
1513 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1514 expect(Ok, status);
1515 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1517 /* corners outside, but some intersection */
1518 x = 0; w = 100;
1519 y = 0; h = 100;
1520 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1521 expect(Ok, status);
1522 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1524 x = 0; w = 100;
1525 y = 0; h = 40;
1526 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1527 expect(Ok, status);
1528 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1530 x = 0; w = 25;
1531 y = 0; h = 100;
1532 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1533 expect(Ok, status);
1534 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1536 /* translate into the center of the rectangle */
1537 status = GdipTranslateWorldTransform(graphics, 25, 40, MatrixOrderAppend);
1538 expect(Ok, status);
1540 /* native ignores the world transform, so treat these as if
1541 * no transform exists */
1542 x = 0; w = 5;
1543 y = 0; h = 5;
1544 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1545 expect(Ok, status);
1546 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1547 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1548 expect(Ok, status);
1549 ok(res == FALSE, "Expected (%d, %d, %d, %d) not to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1551 x = 11; w = 10;
1552 y = 12; h = 10;
1553 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1554 expect(Ok, status);
1555 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1556 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1557 expect(Ok, status);
1558 ok(res == TRUE, "Expected (%d, %d, %d, %d) to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1560 /* translate back to origin */
1561 status = GdipTranslateWorldTransform(graphics, -25, -40, MatrixOrderAppend);
1562 expect(Ok, status);
1564 /* region from path */
1565 status = GdipCreatePath(FillModeAlternate, &path);
1566 expect(Ok, status);
1568 status = GdipAddPathEllipse(path, 10, 20, 30, 40);
1569 expect(Ok, status);
1571 status = GdipCombineRegionPath(region, path, CombineModeReplace);
1572 expect(Ok, status);
1574 x = 0; w = 12;
1575 y = 0; h = 22;
1576 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1577 expect(Ok, status);
1578 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1579 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1580 expect(Ok, status);
1581 ok(res == FALSE, "Expected (%d, %d, %d, %d) not to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1583 x = 0; w = 25;
1584 y = 0; h = 40;
1585 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1586 expect(Ok, status);
1587 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1588 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1589 expect(Ok, status);
1590 ok(res == TRUE, "Expected (%d, %d, %d, %d) to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1592 x = 38; w = 10;
1593 y = 55; h = 10;
1594 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1595 expect(Ok, status);
1596 ok(res == FALSE, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x, y, w, h);
1597 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1598 expect(Ok, status);
1599 ok(res == FALSE, "Expected (%d, %d, %d, %d) not to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1601 x = 0; w = 100;
1602 y = 0; h = 100;
1603 status = GdipIsVisibleRegionRect(region, x, y, w, h, graphics, &res);
1604 expect(Ok, status);
1605 ok(res == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, w, h);
1606 status = GdipIsVisibleRegionRectI(region, (INT)x, (INT)y, (INT)w, (INT)h, graphics, &res);
1607 expect(Ok, status);
1608 ok(res == TRUE, "Expected (%d, %d, %d, %d) to be visible\n", (INT)x, (INT)y, (INT)w, (INT)h);
1610 GdipDeletePath(path);
1612 GdipDeleteRegion(region);
1613 GdipDeleteGraphics(graphics);
1614 ReleaseDC(0, hdc);
1617 START_TEST(region)
1619 struct GdiplusStartupInput gdiplusStartupInput;
1620 ULONG_PTR gdiplusToken;
1622 gdiplusStartupInput.GdiplusVersion = 1;
1623 gdiplusStartupInput.DebugEventCallback = NULL;
1624 gdiplusStartupInput.SuppressBackgroundThread = 0;
1625 gdiplusStartupInput.SuppressExternalCodecs = 0;
1627 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
1629 test_getregiondata();
1630 test_isinfinite();
1631 test_isempty();
1632 test_combinereplace();
1633 test_fromhrgn();
1634 test_gethrgn();
1635 test_isequal();
1636 test_translate();
1637 test_getbounds();
1638 test_isvisiblepoint();
1639 test_isvisiblerect();
1641 GdiplusShutdown(gdiplusToken);