1 /*
2  * PROJECT:         ReactOS api tests
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * PURPOSE:         Test for FrameRgn
5  * PROGRAMMERS:     Timo Kreuzer
6  */
7 
8 #include "precomp.h"
9 
10 void Test_OffsetRgn()
11 {
12     HRGN hrgn1, hrgn2;
13     HDC hdc;
14 
15     hrgn1 = CreateRectRgn(0, 0, 0, 0);
16     ok(hrgn1 != NULL, "CreateRectRgn failed\n");
17     ok_int(OffsetRgn(hrgn1, INT_MIN + 10, 10), NULLREGION);
18     ok_int(OffsetRgn(hrgn1, 0xF000000, 0xF000000), NULLREGION);
19     DeleteObject(hrgn1);
20 
21     hrgn1 = CreateRectRgn(0, 0, 100, 100);
22     ok(hrgn1 != NULL, "CreateRectRgn failed\n");
23     ok_int(OffsetRgn(hrgn1, 10, 10), SIMPLEREGION);
24     ok_int(OffsetRgn(hrgn1, 0x8000000 - 110, 10), ERROR);
25     ok_int(OffsetRgn(hrgn1, 0x8000000 - 111, 10), SIMPLEREGION);
26     DeleteObject(hrgn1);
27 
28     hrgn1 = CreateRectRgn(0, 0, 100, 100);
29     ok(hrgn1 != NULL, "CreateRectRgn failed\n");
30     ok_int(OffsetRgn(hrgn1, -10, 10), SIMPLEREGION);
31     ok_int(OffsetRgn(hrgn1, -(0x8000000 - 9), 10), ERROR);
32     ok_int(OffsetRgn(hrgn1, -(0x8000000 - 10), 10), SIMPLEREGION);
33     DeleteObject(hrgn1);
34 
35     hrgn1 = CreateRectRgn(0, 0, 10, 10);
36     hrgn2 = CreateRectRgn(1000, 20, 1010, 30);
37     ok_int(CombineRgn(hrgn1, hrgn1, hrgn2, RGN_OR), COMPLEXREGION);
38     ok_int(OffsetRgn(hrgn1, 0x8000000 - 100, 10), ERROR);
39     ok_int(CombineRgn(hrgn1, hrgn1, hrgn2, RGN_XOR), SIMPLEREGION);
40     DeleteObject(hrgn2);
41     hrgn2 = CreateRectRgn(0, 0, 10, 10);
42     ok_int(CombineRgn(hrgn1, hrgn1, hrgn2, RGN_XOR), NULLREGION);
43 
44     hrgn1 = CreateRectRgn(0, 0, 0, 0);
45     hdc = CreateCompatibleDC(NULL);
46     ok_int(GetClipRgn(hdc, hrgn1), 0);
47     ok_int(OffsetRgn(hrgn1, 10, 10), NULLREGION);
48 
49 }
50 
51 START_TEST(OffsetRgn)
52 {
53     Test_OffsetRgn();
54 }
55 
56