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