1 /*
2  * PROJECT:         ReactOS api tests
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * PURPOSE:         Test for NtGdiExtSelectClipRgn
5  * PROGRAMMERS:
6  */
7 
8 #include <win32nt.h>
9 
10 START_TEST(NtGdiExtSelectClipRgn)
11 {
12     HRGN hRgnDest, hRgn1, hRgn2;
13     HDC hdc;
14 // test what params are accepted for what operations
15 // 0? invalid? are params maybe ignored in some cases?
16 // LastError
17 
18     /* Preparation */
19     hRgnDest = CreateRectRgn(100, 100, 100, 100);
20     hRgn1 = CreateRectRgn(1,1,4,4);
21     hRgn2 = CreateRectRgn(2,2,6,3);
22 
23     hdc = GetDC(NULL);
24 
25     /* RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5 */
26 
27     SetLastError(0xDEADFACE);
28     ok_int(NtGdiExtSelectClipRgn(NULL, NULL, RGN_AND-1), ERROR);
29     ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
30     SetLastError(0xDEADFACE);
31     ok_int(NtGdiExtSelectClipRgn(NULL, NULL, RGN_COPY+1), ERROR);
32     ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
33     SetLastError(0xDEADFACE);
34     ok_int(NtGdiExtSelectClipRgn(NULL, NULL, RGN_COPY), ERROR);
35     ok_long(GetLastError(), ERROR_INVALID_HANDLE);
36     ok_int(NtGdiExtSelectClipRgn(hdc, hRgnDest, RGN_COPY), NULLREGION);
37     ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION);
38     ok_int(NtGdiExtSelectClipRgn(hdc, hRgnDest, RGN_DIFF), SIMPLEREGION);
39     ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_COPY), SIMPLEREGION);
40     ok_int(NtGdiExtSelectClipRgn(hdc, hRgn2, RGN_DIFF), COMPLEXREGION);
41     ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION);
42     ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION);
43     ok_int(NtGdiExtSelectClipRgn(hdc, hRgnDest, RGN_COPY), NULLREGION);
44     ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_AND), NULLREGION);
45     ok_int(NtGdiExtSelectClipRgn(hdc, hRgn2, RGN_AND), NULLREGION);
46     ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION);
47     ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_OR), SIMPLEREGION);
48     ok_int(NtGdiExtSelectClipRgn(hdc, hRgn2, RGN_OR), SIMPLEREGION);
49     ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_XOR), COMPLEXREGION);
50     SetLastError(0xDEADFACE);
51     ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_DIFF), ERROR);
52     ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_OR), ERROR);
53     ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_XOR), ERROR);
54     ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_AND), ERROR);
55     ok_long(GetLastError(), 0xDEADFACE);
56     ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION);
57 }
58