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 #define WIN32_NO_STATUS
23 #define COM_NO_WINDOWS_H
25 //#include "windows.h"
26 #include <wine/test.h>
32 #define RGNDATA_RECT 0x10000000
33 #define RGNDATA_PATH 0x10000001
34 #define RGNDATA_EMPTY_RECT 0x10000002
35 #define RGNDATA_INFINITE_RECT 0x10000003
37 #define RGNDATA_MAGIC 0xdbc01001
38 #define RGNDATA_MAGIC2 0xdbc01002
40 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
42 #define expectf_(expected, got, precision) ok(fabs(expected - got) < precision, "Expected %.2f, got %.2f\n", expected, got)
43 #define expectf(expected, got) expectf_(expected, got, 0.0001)
45 #define expect_magic(value) ok(*value == RGNDATA_MAGIC || *value == RGNDATA_MAGIC2, "Expected a known magic value, got %8x\n", *value)
47 #define expect_dword(value, expected) ok(*(value) == expected, "expected %08x got %08x\n", expected, *(value))
49 static inline void expect_float(DWORD
*value
, FLOAT expected
)
51 FLOAT valuef
= *(FLOAT
*)value
;
52 ok(valuef
== expected
, "expected %f got %f\n", expected
, valuef
);
55 /* We get shorts back, not INTs like a GpPoint */
56 typedef struct RegionDataPoint
61 static void verify_region(HRGN hrgn
, const RECT
*rc
)
66 char buf
[sizeof(RGNDATAHEADER
) + sizeof(RECT
)];
71 ret
= GetRegionData(hrgn
, 0, NULL
);
73 ok(ret
== sizeof(rgn
.data
.rdh
), "expected sizeof(rdh), got %u\n", ret
);
75 ok(ret
== sizeof(rgn
.data
.rdh
) + sizeof(RECT
), "expected sizeof(rgn), got %u\n", ret
);
79 ret
= GetRegionData(hrgn
, sizeof(rgn
), &rgn
.data
);
81 ok(ret
== sizeof(rgn
.data
.rdh
), "expected sizeof(rdh), got %u\n", ret
);
83 ok(ret
== sizeof(rgn
.data
.rdh
) + sizeof(RECT
), "expected sizeof(rgn), got %u\n", ret
);
85 trace("size %u, type %u, count %u, rgn size %u, bound (%d,%d-%d,%d)\n",
86 rgn
.data
.rdh
.dwSize
, rgn
.data
.rdh
.iType
,
87 rgn
.data
.rdh
.nCount
, rgn
.data
.rdh
.nRgnSize
,
88 rgn
.data
.rdh
.rcBound
.left
, rgn
.data
.rdh
.rcBound
.top
,
89 rgn
.data
.rdh
.rcBound
.right
, rgn
.data
.rdh
.rcBound
.bottom
);
90 if (rgn
.data
.rdh
.nCount
!= 0)
92 rect
= (const RECT
*)rgn
.data
.Buffer
;
93 trace("rect (%d,%d-%d,%d)\n", rect
->left
, rect
->top
, rect
->right
, rect
->bottom
);
94 ok(EqualRect(rect
, rc
), "rects don't match\n");
97 ok(rgn
.data
.rdh
.dwSize
== sizeof(rgn
.data
.rdh
), "expected sizeof(rdh), got %u\n", rgn
.data
.rdh
.dwSize
);
98 ok(rgn
.data
.rdh
.iType
== RDH_RECTANGLES
, "expected RDH_RECTANGLES, got %u\n", rgn
.data
.rdh
.iType
);
101 ok(rgn
.data
.rdh
.nCount
== 0, "expected 0, got %u\n", rgn
.data
.rdh
.nCount
);
102 ok(rgn
.data
.rdh
.nRgnSize
== 0, "expected 0, got %u\n", rgn
.data
.rdh
.nRgnSize
);
106 ok(rgn
.data
.rdh
.nCount
== 1, "expected 1, got %u\n", rgn
.data
.rdh
.nCount
);
107 ok(rgn
.data
.rdh
.nRgnSize
== sizeof(RECT
), "expected sizeof(RECT), got %u\n", rgn
.data
.rdh
.nRgnSize
);
109 ok(EqualRect(&rgn
.data
.rdh
.rcBound
, rc
), "rects don't match\n");
112 static void test_getregiondata(void)
115 GpRegion
*region
, *region2
;
116 RegionDataPoint
*point
;
122 memset(buf
, 0xee, sizeof(buf
));
124 status
= GdipCreateRegion(®ion
);
125 ok(status
== Ok
, "status %08x\n", status
);
127 status
= GdipGetRegionDataSize(region
, &needed
);
128 ok(status
== Ok
, "status %08x\n", status
);
130 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
131 ok(status
== Ok
, "status %08x\n", status
);
133 expect_dword(buf
, 12);
134 trace("buf[1] = %08x\n", buf
[1]);
135 expect_magic((DWORD
*)(buf
+ 2));
136 expect_dword(buf
+ 3, 0);
137 expect_dword(buf
+ 4, RGNDATA_INFINITE_RECT
);
139 status
= GdipSetEmpty(region
);
140 ok(status
== Ok
, "status %08x\n", status
);
141 status
= GdipGetRegionDataSize(region
, &needed
);
142 ok(status
== Ok
, "status %08x\n", status
);
144 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
145 ok(status
== Ok
, "status %08x\n", status
);
147 expect_dword(buf
, 12);
148 trace("buf[1] = %08x\n", buf
[1]);
149 expect_magic((DWORD
*)(buf
+ 2));
150 expect_dword(buf
+ 3, 0);
151 expect_dword(buf
+ 4, RGNDATA_EMPTY_RECT
);
153 status
= GdipSetInfinite(region
);
154 ok(status
== Ok
, "status %08x\n", status
);
155 status
= GdipGetRegionDataSize(region
, &needed
);
156 ok(status
== Ok
, "status %08x\n", status
);
158 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
159 ok(status
== Ok
, "status %08x\n", status
);
161 expect_dword(buf
, 12);
162 trace("buf[1] = %08x\n", buf
[1]);
163 expect_magic((DWORD
*)(buf
+ 2));
164 expect_dword(buf
+ 3, 0);
165 expect_dword(buf
+ 4, RGNDATA_INFINITE_RECT
);
167 status
= GdipDeleteRegion(region
);
168 ok(status
== Ok
, "status %08x\n", status
);
174 status
= GdipCreateRegionRectI(&rect
, ®ion
);
175 ok(status
== Ok
, "status %08x\n", status
);
176 status
= GdipGetRegionDataSize(region
, &needed
);
177 ok(status
== Ok
, "status %08x\n", status
);
179 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
180 ok(status
== Ok
, "status %08x\n", status
);
182 expect_dword(buf
, 28);
183 trace("buf[1] = %08x\n", buf
[1]);
184 expect_magic((DWORD
*)(buf
+ 2));
185 expect_dword(buf
+ 3, 0);
186 expect_dword(buf
+ 4, RGNDATA_RECT
);
187 expect_float(buf
+ 5, 10.0);
188 expect_float(buf
+ 6, 20.0);
189 expect_float(buf
+ 7, 100.0);
190 expect_float(buf
+ 8, 200.0);
196 status
= GdipCombineRegionRectI(region
, &rect
, CombineModeIntersect
);
197 ok(status
== Ok
, "status %08x\n", status
);
202 status
= GdipCombineRegionRectI(region
, &rect
, CombineModeXor
);
203 ok(status
== Ok
, "status %08x\n", status
);
209 status
= GdipCreateRegionRectI(&rect
, ®ion2
);
210 ok(status
== Ok
, "status %08x\n", status
);
215 status
= GdipCombineRegionRectI(region2
, &rect
, CombineModeUnion
);
216 ok(status
== Ok
, "status %08x\n", status
);
218 status
= GdipCombineRegionRegion(region
, region2
, CombineModeComplement
);
219 ok(status
== Ok
, "status %08x\n", status
);
225 status
= GdipCombineRegionRectI(region
, &rect
, CombineModeExclude
);
226 ok(status
== Ok
, "status %08x\n", status
);
228 status
= GdipGetRegionDataSize(region
, &needed
);
229 ok(status
== Ok
, "status %08x\n", status
);
231 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
232 ok(status
== Ok
, "status %08x\n", status
);
234 expect_dword(buf
, 148);
235 trace("buf[1] = %08x\n", buf
[1]);
236 expect_magic((DWORD
*)(buf
+ 2));
237 expect_dword(buf
+ 3, 10);
238 expect_dword(buf
+ 4, CombineModeExclude
);
239 expect_dword(buf
+ 5, CombineModeComplement
);
240 expect_dword(buf
+ 6, CombineModeXor
);
241 expect_dword(buf
+ 7, CombineModeIntersect
);
242 expect_dword(buf
+ 8, RGNDATA_RECT
);
243 expect_float(buf
+ 9, 10.0);
244 expect_float(buf
+ 10, 20.0);
245 expect_float(buf
+ 11, 100.0);
246 expect_float(buf
+ 12, 200.0);
247 expect_dword(buf
+ 13, RGNDATA_RECT
);
248 expect_float(buf
+ 14, 50.0);
249 expect_float(buf
+ 15, 30.0);
250 expect_float(buf
+ 16, 10.0);
251 expect_float(buf
+ 17, 20.0);
252 expect_dword(buf
+ 18, RGNDATA_RECT
);
253 expect_float(buf
+ 19, 100.0);
254 expect_float(buf
+ 20, 300.0);
255 expect_float(buf
+ 21, 30.0);
256 expect_float(buf
+ 22, 50.0);
257 expect_dword(buf
+ 23, CombineModeUnion
);
258 expect_dword(buf
+ 24, RGNDATA_RECT
);
259 expect_float(buf
+ 25, 200.0);
260 expect_float(buf
+ 26, 100.0);
261 expect_float(buf
+ 27, 133.0);
262 expect_float(buf
+ 28, 266.0);
263 expect_dword(buf
+ 29, RGNDATA_RECT
);
264 expect_float(buf
+ 30, 20.0);
265 expect_float(buf
+ 31, 10.0);
266 expect_float(buf
+ 32, 40.0);
267 expect_float(buf
+ 33, 66.0);
268 expect_dword(buf
+ 34, RGNDATA_RECT
);
269 expect_float(buf
+ 35, 400.0);
270 expect_float(buf
+ 36, 500.0);
271 expect_float(buf
+ 37, 22.0);
272 expect_float(buf
+ 38, 55.0);
274 status
= GdipDeleteRegion(region2
);
275 ok(status
== Ok
, "status %08x\n", status
);
276 status
= GdipDeleteRegion(region
);
277 ok(status
== Ok
, "status %08x\n", status
);
281 status
= GdipCreatePath(FillModeAlternate
, &path
);
282 ok(status
== Ok
, "status %08x\n", status
);
283 GdipAddPathRectangle(path
, 12.5, 13.0, 14.0, 15.0);
285 status
= GdipCreateRegionPath(path
, ®ion
);
286 ok(status
== Ok
, "status %08x\n", status
);
287 status
= GdipGetRegionDataSize(region
, &needed
);
288 ok(status
== Ok
, "status %08x\n", status
);
290 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
291 ok(status
== Ok
, "status %08x\n", status
);
293 expect_dword(buf
, 64);
294 trace("buf[1] = %08x\n", buf
[1]);
295 expect_magic((DWORD
*)(buf
+ 2));
296 expect_dword(buf
+ 3, 0);
297 expect_dword(buf
+ 4, RGNDATA_PATH
);
298 expect_dword(buf
+ 5, 0x00000030);
299 expect_magic((DWORD
*)(buf
+ 6));
300 expect_dword(buf
+ 7, 0x00000004);
301 expect_dword(buf
+ 8, 0x00000000);
302 expect_float(buf
+ 9, 12.5);
303 expect_float(buf
+ 10, 13.0);
304 expect_float(buf
+ 11, 26.5);
305 expect_float(buf
+ 12, 13.0);
306 expect_float(buf
+ 13, 26.5);
307 expect_float(buf
+ 14, 28.0);
308 expect_float(buf
+ 15, 12.5);
309 expect_float(buf
+ 16, 28.0);
310 expect_dword(buf
+ 17, 0x81010100);
317 status
= GdipCombineRegionRectI(region
, &rect
, CombineModeIntersect
);
318 ok(status
== Ok
, "status %08x\n", status
);
319 status
= GdipGetRegionDataSize(region
, &needed
);
320 ok(status
== Ok
, "status %08x\n", status
);
322 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
323 ok(status
== Ok
, "status %08x\n", status
);
325 expect_dword(buf
, 88);
326 trace("buf[1] = %08x\n", buf
[1]);
327 expect_magic((DWORD
*)(buf
+ 2));
328 expect_dword(buf
+ 3, 2);
329 expect_dword(buf
+ 4, CombineModeIntersect
);
330 expect_dword(buf
+ 5, RGNDATA_PATH
);
331 expect_dword(buf
+ 6, 0x00000030);
332 expect_magic((DWORD
*)(buf
+ 7));
333 expect_dword(buf
+ 8, 0x00000004);
334 expect_dword(buf
+ 9, 0x00000000);
335 expect_float(buf
+ 10, 12.5);
336 expect_float(buf
+ 11, 13.0);
337 expect_float(buf
+ 12, 26.5);
338 expect_float(buf
+ 13, 13.0);
339 expect_float(buf
+ 14, 26.5);
340 expect_float(buf
+ 15, 28.0);
341 expect_float(buf
+ 16, 12.5);
342 expect_float(buf
+ 17, 28.0);
343 expect_dword(buf
+ 18, 0x81010100);
344 expect_dword(buf
+ 19, RGNDATA_RECT
);
345 expect_float(buf
+ 20, 50.0);
346 expect_float(buf
+ 21, 30.0);
347 expect_float(buf
+ 22, 10.0);
348 expect_float(buf
+ 23, 20.0);
350 status
= GdipDeleteRegion(region
);
351 ok(status
== Ok
, "status %08x\n", status
);
352 status
= GdipDeletePath(path
);
353 ok(status
== Ok
, "status %08x\n", status
);
355 /* Test an empty path */
356 status
= GdipCreatePath(FillModeAlternate
, &path
);
358 status
= GdipCreateRegionPath(path
, ®ion
);
360 status
= GdipGetRegionDataSize(region
, &needed
);
363 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
366 expect_dword(buf
, 28);
367 trace("buf[1] = %08x\n", buf
[1]);
368 expect_magic((DWORD
*)(buf
+ 2));
369 expect_dword(buf
+ 3, 0);
370 expect_dword(buf
+ 4, RGNDATA_PATH
);
372 /* Second signature for pathdata */
373 expect_dword(buf
+ 5, 12);
374 expect_magic((DWORD
*)(buf
+ 6));
375 expect_dword(buf
+ 7, 0);
376 /* flags 0x4000 means its a path of shorts instead of FLOAT */
377 ok((*(buf
+ 8) & (~ 0x00004000)) == 0x00000000,
378 "expected 00000000 got %08x\n", *(buf
+ 8) & (~ 0x00004000));
380 status
= GdipDeleteRegion(region
);
383 /* Test a simple triangle of INTs */
384 status
= GdipAddPathLine(path
, 5, 6, 7, 8);
386 status
= GdipAddPathLine(path
, 8, 1, 5, 6);
388 status
= GdipClosePathFigure(path
);
390 status
= GdipCreateRegionPath(path
, ®ion
);
392 status
= GdipGetRegionDataSize(region
, &needed
);
395 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
398 expect_dword(buf
, 48);
399 trace("buf[1] = %08x\n", buf
[1]);
400 expect_magic((DWORD
*)(buf
+ 2));
401 expect_dword(buf
+ 3 , 0);
402 expect_dword(buf
+ 4 , RGNDATA_PATH
);
404 expect_dword(buf
+ 5, 32);
405 expect_magic((DWORD
*)(buf
+ 6));
406 expect_dword(buf
+ 7, 4);
407 expect_dword(buf
+ 8, 0x00004000); /* ?? */
409 point
= (RegionDataPoint
*)buf
+ 9;
410 expect(5, point
[0].X
);
411 expect(6, point
[0].Y
);
412 expect(7, point
[1].X
); /* buf + 10 */
413 expect(8, point
[1].Y
);
414 expect(8, point
[2].X
); /* buf + 11 */
415 expect(1, point
[2].Y
);
416 expect(5, point
[3].X
); /* buf + 12 */
417 expect(6, point
[3].Y
);
418 expect_dword(buf
+ 13, 0x81010100); /* 0x01010100 if we don't close the path */
420 status
= GdipDeletePath(path
);
422 status
= GdipDeleteRegion(region
);
425 /* Test a floating-point triangle */
426 status
= GdipCreatePath(FillModeAlternate
, &path
);
428 status
= GdipAddPathLine(path
, 5.6, 6.2, 7.2, 8.9);
430 status
= GdipAddPathLine(path
, 8.1, 1.6, 5.6, 6.2);
432 status
= GdipCreateRegionPath(path
, ®ion
);
434 status
= GdipGetRegionDataSize(region
, &needed
);
437 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
440 expect_dword(buf
, 64);
441 trace("buf[1] = %08x\n", buf
[1]);
442 expect_magic((DWORD
*)(buf
+ 2));
443 expect_dword(buf
+ 3, 0);
444 expect_dword(buf
+ 4, RGNDATA_PATH
);
446 expect_dword(buf
+ 5, 48);
447 expect_magic((DWORD
*)(buf
+ 6));
448 expect_dword(buf
+ 7, 4);
449 expect_dword(buf
+ 8, 0);
450 expect_float(buf
+ 9, 5.6);
451 expect_float(buf
+ 10, 6.2);
452 expect_float(buf
+ 11, 7.2);
453 expect_float(buf
+ 12, 8.9);
454 expect_float(buf
+ 13, 8.1);
455 expect_float(buf
+ 14, 1.6);
456 expect_float(buf
+ 15, 5.6);
457 expect_float(buf
+ 16, 6.2);
459 status
= GdipDeletePath(path
);
461 status
= GdipDeleteRegion(region
);
464 /* Test for a path with > 4 points, and CombineRegionPath */
465 GdipCreatePath(FillModeAlternate
, &path
);
466 status
= GdipAddPathLine(path
, 50, 70.2, 60, 102.8);
468 status
= GdipAddPathLine(path
, 55.4, 122.4, 40.4, 60.2);
470 status
= GdipAddPathLine(path
, 45.6, 20.2, 50, 70.2);
476 status
= GdipCreateRegionRectI(&rect
, ®ion
);
478 status
= GdipCombineRegionPath(region
, path
, CombineModeUnion
);
481 status
= GdipGetRegionDataSize(region
, &needed
);
484 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
487 expect_dword(buf
, 108);
488 trace("buf[1] = %08x\n", buf
[1]);
489 expect_magic((DWORD
*)(buf
+ 2));
490 expect_dword(buf
+ 3, 2);
491 expect_dword(buf
+ 4, CombineModeUnion
);
492 expect_dword(buf
+ 5, RGNDATA_RECT
);
493 expect_float(buf
+ 6, 20);
494 expect_float(buf
+ 7, 25);
495 expect_float(buf
+ 8, 60);
496 expect_float(buf
+ 9, 120);
497 expect_dword(buf
+ 10, RGNDATA_PATH
);
499 expect_dword(buf
+ 11, 68);
500 expect_magic((DWORD
*)(buf
+ 12));
501 expect_dword(buf
+ 13, 6);
502 expect_float(buf
+ 14, 0x0);
504 expect_float(buf
+ 15, 50);
505 expect_float(buf
+ 16, 70.2);
506 expect_float(buf
+ 17, 60);
507 expect_float(buf
+ 18, 102.8);
508 expect_float(buf
+ 19, 55.4);
509 expect_float(buf
+ 20, 122.4);
510 expect_float(buf
+ 21, 40.4);
511 expect_float(buf
+ 22, 60.2);
512 expect_float(buf
+ 23, 45.6);
513 expect_float(buf
+ 24, 20.2);
514 expect_float(buf
+ 25, 50);
515 expect_float(buf
+ 26, 70.2);
516 expect_dword(buf
+ 27, 0x01010100);
517 ok(*(buf
+ 28) == 0x00000101 || *(buf
+ 28) == 0x43050101 /* Win 7 */,
518 "expected 00000101 or 43050101 got %08x\n", *(buf
+ 28));
520 status
= GdipDeletePath(path
);
522 status
= GdipDeleteRegion(region
);
526 static void test_isinfinite(void)
530 GpGraphics
*graphics
= NULL
;
535 status
= GdipCreateFromHDC(hdc
, &graphics
);
537 GdipCreateRegion(®ion
);
539 GdipCreateMatrix2(3.0, 0.0, 0.0, 1.0, 20.0, 30.0, &m
);
542 status
= GdipIsInfiniteRegion(NULL
, NULL
, NULL
);
543 expect(InvalidParameter
, status
);
544 status
= GdipIsInfiniteRegion(region
, NULL
, NULL
);
545 expect(InvalidParameter
, status
);
546 status
= GdipIsInfiniteRegion(NULL
, graphics
, NULL
);
547 expect(InvalidParameter
, status
);
548 status
= GdipIsInfiniteRegion(NULL
, NULL
, &res
);
549 expect(InvalidParameter
, status
);
550 status
= GdipIsInfiniteRegion(region
, NULL
, &res
);
551 expect(InvalidParameter
, status
);
554 status
= GdipIsInfiniteRegion(region
, graphics
, &res
);
558 /* after world transform */
559 status
= GdipSetWorldTransform(graphics
, m
);
563 status
= GdipIsInfiniteRegion(region
, graphics
, &res
);
568 GdipDeleteRegion(region
);
569 GdipDeleteGraphics(graphics
);
573 static void test_isempty(void)
577 GpGraphics
*graphics
= NULL
;
581 status
= GdipCreateFromHDC(hdc
, &graphics
);
583 GdipCreateRegion(®ion
);
586 status
= GdipIsEmptyRegion(NULL
, NULL
, NULL
);
587 expect(InvalidParameter
, status
);
588 status
= GdipIsEmptyRegion(region
, NULL
, NULL
);
589 expect(InvalidParameter
, status
);
590 status
= GdipIsEmptyRegion(NULL
, graphics
, NULL
);
591 expect(InvalidParameter
, status
);
592 status
= GdipIsEmptyRegion(NULL
, NULL
, &res
);
593 expect(InvalidParameter
, status
);
594 status
= GdipIsEmptyRegion(region
, NULL
, &res
);
595 expect(InvalidParameter
, status
);
597 /* default is infinite */
599 status
= GdipIsEmptyRegion(region
, graphics
, &res
);
603 status
= GdipSetEmpty(region
);
607 status
= GdipIsEmptyRegion(region
, graphics
, &res
);
611 GdipDeleteRegion(region
);
612 GdipDeleteGraphics(graphics
);
616 static void test_combinereplace(void)
619 GpRegion
*region
, *region2
;
625 rectf
.X
= rectf
.Y
= 0.0;
626 rectf
.Width
= rectf
.Height
= 100.0;
628 status
= GdipCreateRegionRect(&rectf
, ®ion
);
631 /* replace with the same rectangle */
632 status
= GdipCombineRegionRect(region
, &rectf
,CombineModeReplace
);
635 status
= GdipGetRegionDataSize(region
, &needed
);
638 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
641 expect_dword(buf
, 28);
642 trace("buf[1] = %08x\n", buf
[1]);
643 expect_magic((DWORD
*)(buf
+ 2));
644 expect_dword(buf
+ 3, 0);
645 expect_dword(buf
+ 4, RGNDATA_RECT
);
647 /* replace with path */
648 status
= GdipCreatePath(FillModeAlternate
, &path
);
650 status
= GdipAddPathEllipse(path
, 0.0, 0.0, 100.0, 250.0);
652 status
= GdipCombineRegionPath(region
, path
, CombineModeReplace
);
655 status
= GdipGetRegionDataSize(region
, &needed
);
658 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
661 expect_dword(buf
, 148);
662 trace("buf[1] = %08x\n", buf
[1]);
663 expect_magic((DWORD
*)(buf
+ 2));
664 expect_dword(buf
+ 3, 0);
665 expect_dword(buf
+ 4, RGNDATA_PATH
);
666 GdipDeletePath(path
);
668 /* replace with infinite rect */
669 status
= GdipCreateRegion(®ion2
);
671 status
= GdipCombineRegionRegion(region
, region2
, CombineModeReplace
);
674 status
= GdipGetRegionDataSize(region
, &needed
);
677 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
680 expect_dword(buf
, 12);
681 trace("buf[1] = %08x\n", buf
[1]);
682 expect_magic((DWORD
*)(buf
+ 2));
683 expect_dword(buf
+ 3, 0);
684 expect_dword(buf
+ 4, RGNDATA_INFINITE_RECT
);
685 GdipDeleteRegion(region2
);
687 /* more complex case : replace with a combined region */
688 status
= GdipCreateRegionRect(&rectf
, ®ion2
);
690 status
= GdipCreatePath(FillModeAlternate
, &path
);
692 status
= GdipAddPathEllipse(path
, 0.0, 0.0, 100.0, 250.0);
694 status
= GdipCombineRegionPath(region2
, path
, CombineModeUnion
);
696 GdipDeletePath(path
);
697 status
= GdipCombineRegionRegion(region
, region2
, CombineModeReplace
);
699 GdipDeleteRegion(region2
);
701 status
= GdipGetRegionDataSize(region
, &needed
);
704 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
707 expect_dword(buf
, 172);
708 trace("buf[1] = %08x\n", buf
[1]);
709 expect_magic((DWORD
*)(buf
+ 2));
710 expect_dword(buf
+ 3, 2);
711 expect_dword(buf
+ 4, CombineModeUnion
);
713 GdipDeleteRegion(region
);
716 static void test_fromhrgn(void)
719 GpRegion
*region
= (GpRegion
*)0xabcdef01;
723 RegionDataPoint
*point
;
724 GpGraphics
*graphics
= NULL
;
729 status
= GdipCreateRegionHrgn(NULL
, NULL
);
730 expect(InvalidParameter
, status
);
731 status
= GdipCreateRegionHrgn(NULL
, ®ion
);
732 expect(InvalidParameter
, status
);
733 status
= GdipCreateRegionHrgn((HRGN
)0xdeadbeef, ®ion
);
734 expect(InvalidParameter
, status
);
735 ok(region
== (GpRegion
*)0xabcdef01, "Expected region not to be created\n");
737 /* empty rectangle */
738 hrgn
= CreateRectRgn(0, 0, 0, 0);
739 status
= GdipCreateRegionHrgn(hrgn
, ®ion
);
744 status
= GdipCreateFromHDC(hdc
, &graphics
);
747 status
= GdipIsEmptyRegion(region
, graphics
, &res
);
750 GdipDeleteGraphics(graphics
);
752 GdipDeleteRegion(region
);
758 hrgn
= CreateRectRgn(0, 0, 100, 10);
759 status
= GdipCreateRegionHrgn(hrgn
, ®ion
);
762 status
= GdipGetRegionDataSize(region
, &needed
);
766 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
772 expect_dword(buf
, 48);
773 expect_magic((DWORD
*)(buf
+ 2));
774 expect_dword(buf
+ 3, 0);
775 expect_dword(buf
+ 4, RGNDATA_PATH
);
776 expect_dword(buf
+ 5, 0x00000020);
777 expect_magic((DWORD
*)(buf
+ 6));
778 expect_dword(buf
+ 7, 0x00000004);
779 todo_wine
expect_dword(buf
+ 8, 0x00006000); /* ?? */
781 point
= (RegionDataPoint
*)buf
+ 9;
783 expect(0, point
[0].X
);
784 expect(0, point
[0].Y
);
786 expect(100,point
[1].X
); /* buf + 10 */
787 expect(0, point
[1].Y
);
788 expect(100,point
[2].X
); /* buf + 11 */
789 expect(10, point
[2].Y
);
791 expect(0, point
[3].X
); /* buf + 12 */
793 expect(10, point
[3].Y
);
794 expect_dword(buf
+ 13, 0x81010100); /* closed */
798 GdipDeleteRegion(region
);
802 hrgn
= CreateEllipticRgn(0, 0, 100, 10);
803 status
= GdipCreateRegionHrgn(hrgn
, ®ion
);
806 status
= GdipGetRegionDataSize(region
, &needed
);
809 needed
== 196, /* win98 */
810 "Got %.8x\n", needed
);
812 status
= GdipGetRegionData(region
, (BYTE
*)buf
, sizeof(buf
), &needed
);
815 if(status
== Ok
&& needed
== 216) /* Don't try to test win98 layout */
819 expect_dword(buf
, 208);
820 expect_magic((DWORD
*)(buf
+ 2));
821 expect_dword(buf
+ 3, 0);
822 expect_dword(buf
+ 4, RGNDATA_PATH
);
823 expect_dword(buf
+ 5, 0x000000C0);
824 expect_magic((DWORD
*)(buf
+ 6));
825 expect_dword(buf
+ 7, 0x00000024);
826 todo_wine
expect_dword(buf
+ 8, 0x00006000); /* ?? */
829 GdipDeleteRegion(region
);
833 static void test_gethrgn(void)
836 GpRegion
*region
, *region2
;
838 GpGraphics
*graphics
;
841 static const RECT empty_rect
= {0,0,0,0};
842 static const RECT test_rect
= {10, 11, 20, 21};
843 static const GpRectF test_rectF
= {10.0, 11.0, 10.0, 10.0};
844 static const RECT scaled_rect
= {20, 22, 40, 42};
845 static const RECT test_rect2
= {10, 21, 20, 31};
846 static const GpRectF test_rect2F
= {10.0, 21.0, 10.0, 10.0};
847 static const RECT test_rect3
= {10, 11, 20, 31};
848 static const GpRectF test_rect3F
= {10.0, 11.0, 10.0, 20.0};
850 status
= GdipCreateFromHDC(hdc
, &graphics
);
851 ok(status
== Ok
, "status %08x\n", status
);
853 status
= GdipCreateRegion(®ion
);
854 ok(status
== Ok
, "status %08x\n", status
);
856 status
= GdipGetRegionHRgn(NULL
, graphics
, &hrgn
);
857 ok(status
== InvalidParameter
, "status %08x\n", status
);
858 status
= GdipGetRegionHRgn(region
, graphics
, NULL
);
859 ok(status
== InvalidParameter
, "status %08x\n", status
);
861 status
= GdipGetRegionHRgn(region
, NULL
, &hrgn
);
862 ok(status
== Ok
, "status %08x\n", status
);
863 ok(hrgn
== NULL
, "hrgn=%p\n", hrgn
);
866 status
= GdipGetRegionHRgn(region
, graphics
, &hrgn
);
867 ok(status
== Ok
, "status %08x\n", status
);
868 ok(hrgn
== NULL
, "hrgn=%p\n", hrgn
);
871 status
= GdipSetEmpty(region
);
872 ok(status
== Ok
, "status %08x\n", status
);
873 status
= GdipGetRegionHRgn(region
, NULL
, &hrgn
);
874 ok(status
== Ok
, "status %08x\n", status
);
875 verify_region(hrgn
, &empty_rect
);
878 status
= GdipCreatePath(FillModeAlternate
, &path
);
879 ok(status
== Ok
, "status %08x\n", status
);
880 status
= GdipAddPathRectangle(path
, 10.0, 11.0, 10.0, 10.0);
881 ok(status
== Ok
, "status %08x\n", status
);
883 status
= GdipCreateRegionPath(path
, ®ion2
);
884 ok(status
== Ok
, "status %08x\n", status
);
885 status
= GdipGetRegionHRgn(region2
, NULL
, &hrgn
);
886 ok(status
== Ok
, "status %08x\n", status
);
887 verify_region(hrgn
, &test_rect
);
890 /* resulting HRGN is in device coordinates */
891 status
= GdipScaleWorldTransform(graphics
, 2.0, 2.0, MatrixOrderPrepend
);
892 ok(status
== Ok
, "status %08x\n", status
);
893 status
= GdipGetRegionHRgn(region2
, graphics
, &hrgn
);
894 ok(status
== Ok
, "status %08x\n", status
);
895 verify_region(hrgn
, &scaled_rect
);
898 status
= GdipCombineRegionRect(region2
, &test_rectF
, CombineModeReplace
);
899 ok(status
== Ok
, "status %08x\n", status
);
900 status
= GdipGetRegionHRgn(region2
, NULL
, &hrgn
);
901 ok(status
== Ok
, "status %08x\n", status
);
902 verify_region(hrgn
, &test_rect
);
905 status
= GdipGetRegionHRgn(region2
, graphics
, &hrgn
);
906 ok(status
== Ok
, "status %08x\n", status
);
907 verify_region(hrgn
, &scaled_rect
);
910 status
= GdipSetInfinite(region
);
911 ok(status
== Ok
, "status %08x\n", status
);
912 status
= GdipCombineRegionRect(region
, &test_rectF
, CombineModeIntersect
);
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_rect
);
919 status
= GdipCombineRegionRect(region
, &test_rectF
, CombineModeReplace
);
920 ok(status
== Ok
, "status %08x\n", status
);
921 status
= GdipCombineRegionRect(region
, &test_rect2F
, CombineModeUnion
);
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_rect3
);
928 status
= GdipCombineRegionRect(region
, &test_rect3F
, CombineModeReplace
);
929 ok(status
== Ok
, "status %08x\n", status
);
930 status
= GdipCombineRegionRect(region
, &test_rect2F
, CombineModeXor
);
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_rect
);
937 status
= GdipCombineRegionRect(region
, &test_rect3F
, CombineModeReplace
);
938 ok(status
== Ok
, "status %08x\n", status
);
939 status
= GdipCombineRegionRect(region
, &test_rectF
, CombineModeExclude
);
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
);
946 status
= GdipCombineRegionRect(region
, &test_rectF
, CombineModeReplace
);
947 ok(status
== Ok
, "status %08x\n", status
);
948 status
= GdipCombineRegionRect(region
, &test_rect3F
, CombineModeComplement
);
949 ok(status
== Ok
, "status %08x\n", status
);
950 status
= GdipGetRegionHRgn(region
, NULL
, &hrgn
);
951 ok(status
== Ok
, "status %08x\n", status
);
952 verify_region(hrgn
, &test_rect2
);
955 status
= GdipDeletePath(path
);
956 ok(status
== Ok
, "status %08x\n", status
);
957 status
= GdipDeleteRegion(region
);
958 ok(status
== Ok
, "status %08x\n", status
);
959 status
= GdipDeleteRegion(region2
);
960 ok(status
== Ok
, "status %08x\n", status
);
961 status
= GdipDeleteGraphics(graphics
);
962 ok(status
== Ok
, "status %08x\n", status
);
966 static void test_isequal(void)
968 GpRegion
*region1
, *region2
;
969 GpGraphics
*graphics
;
975 status
= GdipCreateFromHDC(hdc
, &graphics
);
976 ok(status
== Ok
, "status %08x\n", status
);
978 status
= GdipCreateRegion(®ion1
);
979 ok(status
== Ok
, "status %08x\n", status
);
980 status
= GdipCreateRegion(®ion2
);
981 ok(status
== Ok
, "status %08x\n", status
);
984 status
= GdipIsEqualRegion(NULL
, NULL
, NULL
, NULL
);
985 ok(status
== InvalidParameter
, "status %08x\n", status
);
986 status
= GdipIsEqualRegion(region1
, region2
, NULL
, NULL
);
987 ok(status
== InvalidParameter
, "status %08x\n", status
);
988 status
= GdipIsEqualRegion(region1
, region2
, graphics
, NULL
);
989 ok(status
== InvalidParameter
, "status %08x\n", status
);
990 status
= GdipIsEqualRegion(region1
, region2
, NULL
, &res
);
991 ok(status
== InvalidParameter
, "status %08x\n", status
);
993 /* infinite regions */
995 status
= GdipIsEqualRegion(region1
, region2
, graphics
, &res
);
996 ok(status
== Ok
, "status %08x\n", status
);
997 ok(res
, "Expected to be equal.\n");
999 status
= GdipSetEmpty(region1
);
1000 ok(status
== Ok
, "status %08x\n", status
);
1001 status
= GdipSetEmpty(region2
);
1002 ok(status
== Ok
, "status %08x\n", status
);
1004 status
= GdipIsEqualRegion(region1
, region2
, graphics
, &res
);
1005 ok(status
== Ok
, "status %08x\n", status
);
1006 ok(res
, "Expected to be equal.\n");
1007 /* empty & infinite */
1008 status
= GdipSetInfinite(region1
);
1009 ok(status
== Ok
, "status %08x\n", status
);
1011 status
= GdipIsEqualRegion(region1
, region2
, graphics
, &res
);
1012 ok(status
== Ok
, "status %08x\n", status
);
1013 ok(!res
, "Expected to be unequal.\n");
1014 /* rect & (inf/empty) */
1015 rectf
.X
= rectf
.Y
= 0.0;
1016 rectf
.Width
= rectf
.Height
= 100.0;
1017 status
= GdipCombineRegionRect(region1
, &rectf
, CombineModeReplace
);
1018 ok(status
== Ok
, "status %08x\n", status
);
1020 status
= GdipIsEqualRegion(region1
, region2
, graphics
, &res
);
1021 ok(status
== Ok
, "status %08x\n", status
);
1022 ok(!res
, "Expected to be unequal.\n");
1023 status
= GdipSetInfinite(region2
);
1024 ok(status
== Ok
, "status %08x\n", status
);
1026 status
= GdipIsEqualRegion(region1
, region2
, graphics
, &res
);
1027 ok(status
== Ok
, "status %08x\n", status
);
1028 ok(!res
, "Expected to be unequal.\n");
1029 /* roughly equal rectangles */
1030 rectf
.X
= rectf
.Y
= 0.0;
1031 rectf
.Width
= rectf
.Height
= 100.001;
1032 status
= GdipCombineRegionRect(region2
, &rectf
, CombineModeReplace
);
1033 ok(status
== Ok
, "status %08x\n", status
);
1035 status
= GdipIsEqualRegion(region1
, region2
, graphics
, &res
);
1036 ok(status
== Ok
, "status %08x\n", status
);
1037 ok(res
, "Expected to be equal.\n");
1038 /* equal rectangles */
1039 rectf
.X
= rectf
.Y
= 0.0;
1040 rectf
.Width
= rectf
.Height
= 100.0;
1041 status
= GdipCombineRegionRect(region2
, &rectf
, CombineModeReplace
);
1042 ok(status
== Ok
, "status %08x\n", status
);
1044 status
= GdipIsEqualRegion(region1
, region2
, graphics
, &res
);
1045 ok(status
== Ok
, "status %08x\n", status
);
1046 ok(res
, "Expected to be equal.\n");
1049 status
= GdipDeleteRegion(region1
);
1050 ok(status
== Ok
, "status %08x\n", status
);
1051 status
= GdipDeleteRegion(region2
);
1052 ok(status
== Ok
, "status %08x\n", status
);
1053 status
= GdipDeleteGraphics(graphics
);
1054 ok(status
== Ok
, "status %08x\n", status
);
1058 static void test_translate(void)
1060 GpRegion
*region
, *region2
;
1061 GpGraphics
*graphics
;
1068 status
= GdipCreateFromHDC(hdc
, &graphics
);
1069 ok(status
== Ok
, "status %08x\n", status
);
1071 status
= GdipCreatePath(FillModeAlternate
, &path
);
1072 ok(status
== Ok
, "status %08x\n", status
);
1074 status
= GdipCreateRegion(®ion
);
1075 ok(status
== Ok
, "status %08x\n", status
);
1076 status
= GdipCreateRegion(®ion2
);
1077 ok(status
== Ok
, "status %08x\n", status
);
1080 status
= GdipTranslateRegion(NULL
, 0.0, 0.0);
1081 ok(status
== InvalidParameter
, "status %08x\n", status
);
1084 status
= GdipTranslateRegion(region
, 10.0, 10.0);
1085 ok(status
== Ok
, "status %08x\n", status
);
1087 status
= GdipSetEmpty(region
);
1088 ok(status
== Ok
, "status %08x\n", status
);
1089 status
= GdipTranslateRegion(region
, 10.0, 10.0);
1090 ok(status
== Ok
, "status %08x\n", status
);
1092 rectf
.X
= 10.0; rectf
.Y
= 0.0;
1093 rectf
.Width
= rectf
.Height
= 100.0;
1094 status
= GdipCombineRegionRect(region
, &rectf
, CombineModeReplace
);
1095 ok(status
== Ok
, "status %08x\n", status
);
1096 rectf
.X
= 15.0; rectf
.Y
= -2.0;
1097 rectf
.Width
= rectf
.Height
= 100.0;
1098 status
= GdipCombineRegionRect(region2
, &rectf
, CombineModeReplace
);
1099 ok(status
== Ok
, "status %08x\n", status
);
1100 status
= GdipTranslateRegion(region
, 5.0, -2.0);
1101 ok(status
== Ok
, "status %08x\n", status
);
1103 status
= GdipIsEqualRegion(region
, region2
, graphics
, &res
);
1104 ok(status
== Ok
, "status %08x\n", status
);
1105 ok(res
, "Expected to be equal.\n");
1107 status
= GdipAddPathEllipse(path
, 0.0, 10.0, 100.0, 150.0);
1108 ok(status
== Ok
, "status %08x\n", status
);
1109 status
= GdipCombineRegionPath(region
, path
, CombineModeReplace
);
1110 ok(status
== Ok
, "status %08x\n", status
);
1111 status
= GdipResetPath(path
);
1112 ok(status
== Ok
, "status %08x\n", status
);
1113 status
= GdipAddPathEllipse(path
, 10.0, 21.0, 100.0, 150.0);
1114 ok(status
== Ok
, "status %08x\n", status
);
1115 status
= GdipCombineRegionPath(region2
, path
, CombineModeReplace
);
1116 ok(status
== Ok
, "status %08x\n", status
);
1117 status
= GdipTranslateRegion(region
, 10.0, 11.0);
1118 ok(status
== Ok
, "status %08x\n", status
);
1120 status
= GdipIsEqualRegion(region
, region2
, graphics
, &res
);
1121 ok(status
== Ok
, "status %08x\n", status
);
1122 ok(res
, "Expected to be equal.\n");
1124 status
= GdipDeleteRegion(region
);
1125 ok(status
== Ok
, "status %08x\n", status
);
1126 status
= GdipDeleteRegion(region2
);
1127 ok(status
== Ok
, "status %08x\n", status
);
1128 status
= GdipDeleteGraphics(graphics
);
1129 ok(status
== Ok
, "status %08x\n", status
);
1130 status
= GdipDeletePath(path
);
1131 ok(status
== Ok
, "status %08x\n", status
);
1135 static void test_transform(void)
1137 GpRegion
*region
, *region2
;
1139 GpGraphics
*graphics
;
1146 status
= GdipCreateFromHDC(hdc
, &graphics
);
1149 status
= GdipCreatePath(FillModeAlternate
, &path
);
1152 status
= GdipCreateRegion(®ion
);
1154 status
= GdipCreateRegion(®ion2
);
1157 status
= GdipCreateMatrix(&matrix
);
1159 status
= GdipScaleMatrix(matrix
, 2.0, 3.0, MatrixOrderAppend
);
1163 status
= GdipTransformRegion(NULL
, matrix
);
1164 expect(InvalidParameter
, status
);
1166 status
= GdipTransformRegion(region
, NULL
);
1167 expect(InvalidParameter
, status
);
1170 status
= GdipTransformRegion(region
, matrix
);
1174 status
= GdipIsEqualRegion(region
, region2
, graphics
, &res
);
1176 ok(res
, "Expected to be equal.\n");
1179 status
= GdipSetEmpty(region
);
1181 status
= GdipTransformRegion(region
, matrix
);
1184 status
= GdipSetEmpty(region2
);
1188 status
= GdipIsEqualRegion(region
, region2
, graphics
, &res
);
1190 ok(res
, "Expected to be equal.\n");
1195 rectf
.Width
= rectf
.Height
= 100.0;
1196 status
= GdipCombineRegionRect(region
, &rectf
, CombineModeReplace
);
1200 rectf
.Width
= 200.0;
1201 rectf
.Height
= 300.0;
1202 status
= GdipCombineRegionRect(region2
, &rectf
, CombineModeReplace
);
1204 status
= GdipTransformRegion(region
, matrix
);
1207 status
= GdipIsEqualRegion(region
, region2
, graphics
, &res
);
1209 ok(res
, "Expected to be equal.\n");
1212 status
= GdipAddPathEllipse(path
, 0.0, 10.0, 100.0, 150.0);
1214 status
= GdipCombineRegionPath(region
, path
, CombineModeReplace
);
1216 status
= GdipResetPath(path
);
1218 status
= GdipAddPathEllipse(path
, 0.0, 30.0, 200.0, 450.0);
1220 status
= GdipCombineRegionPath(region2
, path
, CombineModeReplace
);
1222 status
= GdipTransformRegion(region
, matrix
);
1225 status
= GdipIsEqualRegion(region
, region2
, graphics
, &res
);
1227 ok(res
, "Expected to be equal.\n");
1229 status
= GdipDeleteRegion(region
);
1231 status
= GdipDeleteRegion(region2
);
1233 status
= GdipDeleteGraphics(graphics
);
1235 status
= GdipDeletePath(path
);
1237 status
= GdipDeleteMatrix(matrix
);
1242 static void test_scans(void)
1253 status
= GdipCreateRegion(®ion
);
1256 status
= GdipCreateMatrix(&matrix
);
1259 /* test NULL values */
1260 status
= GdipGetRegionScansCount(NULL
, &count
, matrix
);
1261 expect(InvalidParameter
, status
);
1263 status
= GdipGetRegionScansCount(region
, NULL
, matrix
);
1264 expect(InvalidParameter
, status
);
1266 status
= GdipGetRegionScansCount(region
, &count
, NULL
);
1267 expect(InvalidParameter
, status
);
1269 status
= GdipGetRegionScans(NULL
, scans
, &icount
, matrix
);
1270 expect(InvalidParameter
, status
);
1272 status
= GdipGetRegionScans(region
, scans
, NULL
, matrix
);
1273 expect(InvalidParameter
, status
);
1275 status
= GdipGetRegionScans(region
, scans
, &icount
, NULL
);
1276 expect(InvalidParameter
, status
);
1279 status
= GdipGetRegionScansCount(region
, &count
, matrix
);
1283 status
= GdipGetRegionScans(region
, NULL
, &icount
, matrix
);
1287 status
= GdipGetRegionScans(region
, scans
, &icount
, matrix
);
1291 status
= GdipGetRegionScansI(region
, scansi
, &icount
, matrix
);
1294 expect(-0x400000, scansi
[0].X
);
1295 expect(-0x400000, scansi
[0].Y
);
1296 expect(0x800000, scansi
[0].Width
);
1297 expect(0x800000, scansi
[0].Height
);
1299 status
= GdipGetRegionScans(region
, scans
, &icount
, matrix
);
1302 expectf((double)-0x400000, scans
[0].X
);
1303 expectf((double)-0x400000, scans
[0].Y
);
1304 expectf((double)0x800000, scans
[0].Width
);
1305 expectf((double)0x800000, scans
[0].Height
);
1308 status
= GdipSetEmpty(region
);
1311 status
= GdipGetRegionScansCount(region
, &count
, matrix
);
1315 status
= GdipGetRegionScans(region
, scans
, &icount
, matrix
);
1319 /* single rectangle */
1320 rectf
.X
= rectf
.Y
= 0.0;
1321 rectf
.Width
= rectf
.Height
= 5.0;
1322 status
= GdipCombineRegionRect(region
, &rectf
, CombineModeReplace
);
1325 status
= GdipGetRegionScansCount(region
, &count
, matrix
);
1329 status
= GdipGetRegionScans(region
, scans
, &icount
, matrix
);
1332 expectf(0.0, scans
[0].X
);
1333 expectf(0.0, scans
[0].Y
);
1334 expectf(5.0, scans
[0].Width
);
1335 expectf(5.0, scans
[0].Height
);
1337 /* two rectangles */
1338 rectf
.X
= rectf
.Y
= 5.0;
1339 rectf
.Width
= rectf
.Height
= 5.0;
1340 status
= GdipCombineRegionRect(region
, &rectf
, CombineModeUnion
);
1343 status
= GdipGetRegionScansCount(region
, &count
, matrix
);
1347 /* Native ignores the initial value of count */
1348 scans
[1].X
= scans
[1].Y
= scans
[1].Width
= scans
[1].Height
= 8.0;
1350 status
= GdipGetRegionScans(region
, scans
, &icount
, matrix
);
1353 expectf(0.0, scans
[0].X
);
1354 expectf(0.0, scans
[0].Y
);
1355 expectf(5.0, scans
[0].Width
);
1356 expectf(5.0, scans
[0].Height
);
1357 expectf(5.0, scans
[1].X
);
1358 expectf(5.0, scans
[1].Y
);
1359 expectf(5.0, scans
[1].Width
);
1360 expectf(5.0, scans
[1].Height
);
1362 status
= GdipGetRegionScansI(region
, scansi
, &icount
, matrix
);
1365 expect(0, scansi
[0].X
);
1366 expect(0, scansi
[0].Y
);
1367 expect(5, scansi
[0].Width
);
1368 expect(5, scansi
[0].Height
);
1369 expect(5, scansi
[1].X
);
1370 expect(5, scansi
[1].Y
);
1371 expect(5, scansi
[1].Width
);
1372 expect(5, scansi
[1].Height
);
1374 status
= GdipDeleteRegion(region
);
1376 status
= GdipDeleteMatrix(matrix
);
1380 static void test_getbounds(void)
1383 GpGraphics
*graphics
;
1388 status
= GdipCreateFromHDC(hdc
, &graphics
);
1389 ok(status
== Ok
, "status %08x\n", status
);
1390 status
= GdipCreateRegion(®ion
);
1391 ok(status
== Ok
, "status %08x\n", status
);
1394 status
= GdipGetRegionBounds(NULL
, NULL
, NULL
);
1395 ok(status
== InvalidParameter
, "status %08x\n", status
);
1396 status
= GdipGetRegionBounds(region
, NULL
, NULL
);
1397 ok(status
== InvalidParameter
, "status %08x\n", status
);
1398 status
= GdipGetRegionBounds(region
, graphics
, NULL
);
1399 ok(status
== InvalidParameter
, "status %08x\n", status
);
1401 rectf
.X
= rectf
.Y
= 0.0;
1402 rectf
.Height
= rectf
.Width
= 100.0;
1403 status
= GdipGetRegionBounds(region
, graphics
, &rectf
);
1404 ok(status
== Ok
, "status %08x\n", status
);
1405 ok(rectf
.X
== -(REAL
)(1 << 22), "Expected X = %.2f, got %.2f\n", -(REAL
)(1 << 22), rectf
.X
);
1406 ok(rectf
.Y
== -(REAL
)(1 << 22), "Expected Y = %.2f, got %.2f\n", -(REAL
)(1 << 22), rectf
.Y
);
1407 ok(rectf
.Width
== (REAL
)(1 << 23), "Expected width = %.2f, got %.2f\n", (REAL
)(1 << 23), rectf
.Width
);
1408 ok(rectf
.Height
== (REAL
)(1 << 23), "Expected height = %.2f, got %.2f\n",(REAL
)(1 << 23), rectf
.Height
);
1410 rectf
.X
= rectf
.Y
= 0.0;
1411 rectf
.Height
= rectf
.Width
= 100.0;
1412 status
= GdipSetEmpty(region
);
1413 ok(status
== Ok
, "status %08x\n", status
);
1414 status
= GdipGetRegionBounds(region
, graphics
, &rectf
);
1415 ok(status
== Ok
, "status %08x\n", status
);
1416 ok(rectf
.X
== 0.0, "Expected X = 0.0, got %.2f\n", rectf
.X
);
1417 ok(rectf
.Y
== 0.0, "Expected Y = 0.0, got %.2f\n", rectf
.Y
);
1418 ok(rectf
.Width
== 0.0, "Expected width = 0.0, got %.2f\n", rectf
.Width
);
1419 ok(rectf
.Height
== 0.0, "Expected height = 0.0, got %.2f\n", rectf
.Height
);
1421 rectf
.X
= 10.0; rectf
.Y
= 0.0;
1422 rectf
.Width
= rectf
.Height
= 100.0;
1423 status
= GdipCombineRegionRect(region
, &rectf
, CombineModeReplace
);
1424 ok(status
== Ok
, "status %08x\n", status
);
1425 rectf
.X
= rectf
.Y
= 0.0;
1426 rectf
.Height
= rectf
.Width
= 0.0;
1427 status
= GdipGetRegionBounds(region
, graphics
, &rectf
);
1428 ok(status
== Ok
, "status %08x\n", status
);
1429 ok(rectf
.X
== 10.0, "Expected X = 0.0, got %.2f\n", rectf
.X
);
1430 ok(rectf
.Y
== 0.0, "Expected Y = 0.0, got %.2f\n", rectf
.Y
);
1431 ok(rectf
.Width
== 100.0, "Expected width = 0.0, got %.2f\n", rectf
.Width
);
1432 ok(rectf
.Height
== 100.0, "Expected height = 0.0, got %.2f\n", rectf
.Height
);
1434 /* the world and page transforms are ignored */
1435 GdipScaleWorldTransform(graphics
, 2.0, 2.0, MatrixOrderPrepend
);
1436 GdipSetPageUnit(graphics
, UnitInch
);
1437 GdipSetPageScale(graphics
, 2.0);
1438 status
= GdipGetRegionBounds(region
, graphics
, &rectf
);
1439 ok(status
== Ok
, "status %08x\n", status
);
1440 ok(rectf
.X
== 10.0, "Expected X = 0.0, got %.2f\n", rectf
.X
);
1441 ok(rectf
.Y
== 0.0, "Expected Y = 0.0, got %.2f\n", rectf
.Y
);
1442 ok(rectf
.Width
== 100.0, "Expected width = 0.0, got %.2f\n", rectf
.Width
);
1444 rectf
.X
= 10.0; rectf
.Y
= 0.0;
1445 rectf
.Width
= rectf
.Height
= 100.0;
1446 status
= GdipCombineRegionRect(region
, &rectf
, CombineModeReplace
);
1447 ok(status
== Ok
, "status %08x\n", status
);
1448 rectf
.X
= rectf
.Y
= 0.0;
1449 rectf
.Height
= rectf
.Width
= 0.0;
1450 status
= GdipGetRegionBounds(region
, graphics
, &rectf
);
1451 ok(status
== Ok
, "status %08x\n", status
);
1452 ok(rectf
.X
== 10.0, "Expected X = 0.0, got %.2f\n", rectf
.X
);
1453 ok(rectf
.Y
== 0.0, "Expected Y = 0.0, got %.2f\n", rectf
.Y
);
1454 ok(rectf
.Width
== 100.0, "Expected width = 0.0, got %.2f\n", rectf
.Width
);
1455 ok(rectf
.Height
== 100.0, "Expected height = 0.0, got %.2f\n", rectf
.Height
);
1457 status
= GdipDeleteRegion(region
);
1458 ok(status
== Ok
, "status %08x\n", status
);
1459 status
= GdipDeleteGraphics(graphics
);
1460 ok(status
== Ok
, "status %08x\n", status
);
1464 static void test_isvisiblepoint(void)
1467 GpGraphics
* graphics
;
1475 status
= GdipCreateFromHDC(hdc
, &graphics
);
1478 status
= GdipCreateRegion(®ion
);
1481 /* null parameters */
1482 status
= GdipIsVisibleRegionPoint(NULL
, 0, 0, graphics
, &res
);
1483 expect(InvalidParameter
, status
);
1484 status
= GdipIsVisibleRegionPointI(NULL
, 0, 0, graphics
, &res
);
1485 expect(InvalidParameter
, status
);
1487 status
= GdipIsVisibleRegionPoint(region
, 0, 0, NULL
, &res
);
1489 status
= GdipIsVisibleRegionPointI(region
, 0, 0, NULL
, &res
);
1492 status
= GdipIsVisibleRegionPoint(region
, 0, 0, graphics
, NULL
);
1493 expect(InvalidParameter
, status
);
1494 status
= GdipIsVisibleRegionPointI(region
, 0, 0, graphics
, NULL
);
1495 expect(InvalidParameter
, status
);
1497 /* infinite region */
1498 status
= GdipIsInfiniteRegion(region
, graphics
, &res
);
1500 ok(res
== TRUE
, "Region should be infinite\n");
1504 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1506 ok(res
== TRUE
, "Expected (%.2f, %.2f) to be visible\n", x
, y
);
1507 status
= GdipIsVisibleRegionPointI(region
, (INT
)x
, (INT
)y
, graphics
, &res
);
1509 ok(res
== TRUE
, "Expected (%d, %d) to be visible\n", (INT
)x
, (INT
)y
);
1513 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1515 ok(res
== TRUE
, "Expected (%.2f, %.2f) to be visible\n", x
, y
);
1516 status
= GdipIsVisibleRegionPointI(region
, (INT
)x
, (INT
)y
, graphics
, &res
);
1518 ok(res
== TRUE
, "Expected (%d, %d) to be visible\n", (INT
)x
, (INT
)y
);
1520 /* rectangular region */
1526 status
= GdipCombineRegionRect(region
, &rectf
, CombineModeReplace
);
1531 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1533 ok(res
== FALSE
, "Expected (%.2f, %.2f) not to be visible\n", x
, y
);
1534 status
= GdipIsVisibleRegionPointI(region
, (INT
)x
, (INT
)y
, graphics
, &res
);
1536 ok(res
== FALSE
, "Expected (%d, %d) not to be visible\n", (INT
)x
, (INT
)y
);
1540 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1542 ok(res
== FALSE
, "Expected (%.2f, %.2f) to be visible\n", x
, y
);
1546 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1548 ok(res
== FALSE
, "Expected (%.2f, %.2f) to be visible\n", x
, y
);
1552 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1554 ok(res
== TRUE
, "Expected (%.2f, %.2f) to be visible\n", x
, y
);
1558 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1560 ok(res
== TRUE
, "Expected (%.2f, %.2f) to be visible\n", x
, y
);
1564 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1566 ok(res
== TRUE
, "Expected (%.2f, %.2f) to be visible\n", x
, y
);
1570 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1572 ok(res
== TRUE
, "Expected (%.2f, %.2f) to be visible\n", x
, y
);
1573 status
= GdipIsVisibleRegionPointI(region
, (INT
)x
, (INT
)y
, graphics
, &res
);
1575 ok(res
== TRUE
, "Expected (%d, %d) to be visible\n", (INT
)x
, (INT
)y
);
1579 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1581 ok(res
== FALSE
, "Expected (%.2f, %.2f) not to be visible\n", x
, y
);
1582 status
= GdipIsVisibleRegionPointI(region
, (INT
)x
, (INT
)y
, graphics
, &res
);
1584 ok(res
== FALSE
, "Expected (%d, %d) not to be visible\n", (INT
)x
, (INT
)y
);
1586 /* translate into the center of the rectangle */
1587 status
= GdipTranslateWorldTransform(graphics
, 25, 40, MatrixOrderAppend
);
1590 /* native ignores the world transform, so treat these as if
1591 * no transform exists */
1594 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1596 ok(res
== FALSE
, "Expected (%.2f, %.2f) not to be visible\n", x
, y
);
1597 status
= GdipIsVisibleRegionPointI(region
, (INT
)x
, (INT
)y
, graphics
, &res
);
1599 ok(res
== FALSE
, "Expected (%d, %d) not to be visible\n", (INT
)x
, (INT
)y
);
1603 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1605 ok(res
== FALSE
, "Expected (%.2f, %.2f) not to be visible\n", x
, y
);
1606 status
= GdipIsVisibleRegionPointI(region
, (INT
)x
, (INT
)y
, graphics
, &res
);
1608 ok(res
== FALSE
, "Expected (%d, %d) not to be visible\n", (INT
)x
, (INT
)y
);
1612 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1614 ok(res
== TRUE
, "Expected (%.2f, %.2f) to be visible\n", x
, y
);
1615 status
= GdipIsVisibleRegionPointI(region
, (INT
)x
, (INT
)y
, graphics
, &res
);
1617 ok(res
== TRUE
, "Expected (%d, %d) to be visible\n", (INT
)x
, (INT
)y
);
1619 /* translate back to origin */
1620 status
= GdipTranslateWorldTransform(graphics
, -25, -40, MatrixOrderAppend
);
1623 /* region from path */
1624 status
= GdipCreatePath(FillModeAlternate
, &path
);
1627 status
= GdipAddPathEllipse(path
, 10, 20, 30, 40);
1630 status
= GdipCombineRegionPath(region
, path
, CombineModeReplace
);
1635 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1637 ok(res
== FALSE
, "Expected (%.2f, %.2f) not to be visible\n", x
, y
);
1638 status
= GdipIsVisibleRegionPointI(region
, (INT
)x
, (INT
)y
, graphics
, &res
);
1640 ok(res
== FALSE
, "Expected (%d, %d) not to be visible\n", (INT
)x
, (INT
)y
);
1644 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1646 ok(res
== TRUE
, "Expected (%.2f, %.2f) to be visible\n", x
, y
);
1647 status
= GdipIsVisibleRegionPointI(region
, (INT
)x
, (INT
)y
, graphics
, &res
);
1649 ok(res
== TRUE
, "Expected (%d, %d) to be visible\n", (INT
)x
, (INT
)y
);
1653 status
= GdipIsVisibleRegionPoint(region
, x
, y
, graphics
, &res
);
1655 ok(res
== FALSE
, "Expected (%.2f, %.2f) not to be visible\n", x
, y
);
1656 status
= GdipIsVisibleRegionPointI(region
, (INT
)x
, (INT
)y
, graphics
, &res
);
1658 ok(res
== FALSE
, "Expected (%d, %d) not to be visible\n", (INT
)x
, (INT
)y
);
1660 GdipDeletePath(path
);
1662 GdipDeleteRegion(region
);
1663 GdipDeleteGraphics(graphics
);
1667 static void test_isvisiblerect(void)
1670 GpGraphics
* graphics
;
1678 status
= GdipCreateFromHDC(hdc
, &graphics
);
1681 status
= GdipCreateRegion(®ion
);
1684 /* null parameters */
1685 status
= GdipIsVisibleRegionRect(NULL
, 0, 0, 0, 0, graphics
, &res
);
1686 expect(InvalidParameter
, status
);
1687 status
= GdipIsVisibleRegionRectI(NULL
, 0, 0, 0, 0, graphics
, &res
);
1688 expect(InvalidParameter
, status
);
1690 status
= GdipIsVisibleRegionRect(region
, 0, 0, 0, 0, NULL
, &res
);
1692 status
= GdipIsVisibleRegionRectI(region
, 0, 0, 0, 0, NULL
, &res
);
1695 status
= GdipIsVisibleRegionRect(region
, 0, 0, 0, 0, graphics
, NULL
);
1696 expect(InvalidParameter
, status
);
1697 status
= GdipIsVisibleRegionRectI(region
, 0, 0, 0, 0, graphics
, NULL
);
1698 expect(InvalidParameter
, status
);
1700 /* infinite region */
1701 status
= GdipIsInfiniteRegion(region
, graphics
, &res
);
1703 ok(res
== TRUE
, "Region should be infinite\n");
1707 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1709 ok(res
== TRUE
, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x
, y
, w
, h
);
1713 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1715 ok(res
== TRUE
, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x
, y
, w
, h
);
1717 /* rectangular region */
1723 status
= GdipCombineRegionRect(region
, &rectf
, CombineModeIntersect
);
1726 /* entirely within the region */
1729 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1731 ok(res
== TRUE
, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x
, y
, w
, h
);
1732 status
= GdipIsVisibleRegionRectI(region
, (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
, graphics
, &res
);
1734 ok(res
== TRUE
, "Expected (%d, %d, %d, %d) to be visible\n", (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
);
1736 /* entirely outside of the region */
1739 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1741 ok(res
== FALSE
, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x
, y
, w
, h
);
1742 status
= GdipIsVisibleRegionRectI(region
, (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
, graphics
, &res
);
1744 ok(res
== FALSE
, "Expected (%d, %d, %d, %d) not to be visible\n", (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
);
1749 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1751 ok(res
== FALSE
, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x
, y
, w
, h
);
1755 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1757 ok(res
== TRUE
, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x
, y
, w
, h
);
1761 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1763 ok(res
== TRUE
, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x
, y
, w
, h
);
1767 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1769 ok(res
== FALSE
, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x
, y
, w
, h
);
1771 /* corners outside, but some intersection */
1774 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1776 ok(res
== TRUE
, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x
, y
, w
, h
);
1780 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1782 ok(res
== TRUE
, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x
, y
, w
, h
);
1786 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1788 ok(res
== TRUE
, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x
, y
, w
, h
);
1790 /* translate into the center of the rectangle */
1791 status
= GdipTranslateWorldTransform(graphics
, 25, 40, MatrixOrderAppend
);
1794 /* native ignores the world transform, so treat these as if
1795 * no transform exists */
1798 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1800 ok(res
== FALSE
, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x
, y
, w
, h
);
1801 status
= GdipIsVisibleRegionRectI(region
, (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
, graphics
, &res
);
1803 ok(res
== FALSE
, "Expected (%d, %d, %d, %d) not to be visible\n", (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
);
1807 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1809 ok(res
== TRUE
, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x
, y
, w
, h
);
1810 status
= GdipIsVisibleRegionRectI(region
, (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
, graphics
, &res
);
1812 ok(res
== TRUE
, "Expected (%d, %d, %d, %d) to be visible\n", (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
);
1814 /* translate back to origin */
1815 status
= GdipTranslateWorldTransform(graphics
, -25, -40, MatrixOrderAppend
);
1818 /* region from path */
1819 status
= GdipCreatePath(FillModeAlternate
, &path
);
1822 status
= GdipAddPathEllipse(path
, 10, 20, 30, 40);
1825 status
= GdipCombineRegionPath(region
, path
, CombineModeReplace
);
1830 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1832 ok(res
== FALSE
, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x
, y
, w
, h
);
1833 status
= GdipIsVisibleRegionRectI(region
, (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
, graphics
, &res
);
1835 ok(res
== FALSE
, "Expected (%d, %d, %d, %d) not to be visible\n", (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
);
1839 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1841 ok(res
== TRUE
, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x
, y
, w
, h
);
1842 status
= GdipIsVisibleRegionRectI(region
, (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
, graphics
, &res
);
1844 ok(res
== TRUE
, "Expected (%d, %d, %d, %d) to be visible\n", (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
);
1848 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1850 ok(res
== FALSE
, "Expected (%.2f, %.2f, %.2f, %.2f) not to be visible\n", x
, y
, w
, h
);
1851 status
= GdipIsVisibleRegionRectI(region
, (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
, graphics
, &res
);
1853 ok(res
== FALSE
, "Expected (%d, %d, %d, %d) not to be visible\n", (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
);
1857 status
= GdipIsVisibleRegionRect(region
, x
, y
, w
, h
, graphics
, &res
);
1859 ok(res
== TRUE
, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x
, y
, w
, h
);
1860 status
= GdipIsVisibleRegionRectI(region
, (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
, graphics
, &res
);
1862 ok(res
== TRUE
, "Expected (%d, %d, %d, %d) to be visible\n", (INT
)x
, (INT
)y
, (INT
)w
, (INT
)h
);
1864 GdipDeletePath(path
);
1866 GdipDeleteRegion(region
);
1867 GdipDeleteGraphics(graphics
);
1873 struct GdiplusStartupInput gdiplusStartupInput
;
1874 ULONG_PTR gdiplusToken
;
1876 gdiplusStartupInput
.GdiplusVersion
= 1;
1877 gdiplusStartupInput
.DebugEventCallback
= NULL
;
1878 gdiplusStartupInput
.SuppressBackgroundThread
= 0;
1879 gdiplusStartupInput
.SuppressExternalCodecs
= 0;
1881 GdiplusStartup(&gdiplusToken
, &gdiplusStartupInput
, NULL
);
1883 test_getregiondata();
1886 test_combinereplace();
1894 test_isvisiblepoint();
1895 test_isvisiblerect();
1897 GdiplusShutdown(gdiplusToken
);