ReactOS  0.4.14-dev-342-gdc047f9
NtGdiPolyPolyDraw.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS api tests
3  * LICENSE: GPL - See COPYING in the top level directory
4  * PURPOSE: Test for NtGdiPolyPolyDraw
5  * PROGRAMMERS:
6  */
7 
8 #include <win32nt.h>
9 
10 
11 static
12 void
14 {
15  ULONG_PTR ret;
16  ULONG Count1[4] = {3, 2, 4, 3};
17  ULONG Count2[2] = {0, 3};
18  ULONG Count3[2] = {0, 0};
19  ULONG Count4[2] = {1, 3};
20  ULONG Count5[2] = {0x80000001, 0x80000001};
21  POINT Points[6] = {{0,0}, {1,1}, {3,-3}, {-2,2}, {4,2}, {2,4}};
22  HDC hDC;
23 
24  SetLastError(0);
25  ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 0);
26  TEST(ret == 0);
27  TEST(GetLastError() == 0);
28 
29  SetLastError(0);
30  ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 1);
31  TEST(ret == 0);
32  TEST(GetLastError() == 0);
33 
34  SetLastError(0);
35  ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 2);
36  TEST(ret == 0);
37  TEST(GetLastError() == 0);
38 
39  SetLastError(0);
40  ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 3);
41  TEST(ret == 0);
42  TEST(GetLastError() == 0);
43 
44  SetLastError(0);
45  ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 4);
46  TEST(ret == 0);
47  TEST(GetLastError() == 0);
48 
49  SetLastError(0);
50  ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 5);
51  TEST(ret == 0);
52  TEST(GetLastError() == 0);
53 
54  SetLastError(0);
55  ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 6);
56  TEST(ret == 0);
57  TEST(GetLastError() == 0);
58 
60 
61  /* Test with an invalid DC */
62 
63  SetLastError(0);
64  ret = NtGdiPolyPolyDraw(0, Points, Count1, 2, 1);
65  TEST(ret == 0);
67 
68  hDC = (HDC)0x12345;
69 
70  SetLastError(0);
71  ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 0);
72  TEST(ret == 0);
73  TEST(GetLastError() == 0);
74 
75  SetLastError(0);
76  ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 1);
77  TEST(ret == 0);
79 
80  SetLastError(0);
81  ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 2);
82  TEST(ret == 0);
84 
85  SetLastError(0);
86  ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 3);
87  TEST(ret == 0);
89 
90  SetLastError(0);
91  ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 4);
92  TEST(ret == 0);
94 
95  SetLastError(0);
96  ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 5);
97  TEST(ret == 0);
99 
100  SetLastError(0);
101  ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 6);
102  TEST(ret == 0);
103  TEST(GetLastError() == 0);
104 
105  SetLastError(0);
106  ret = NtGdiPolyPolyDraw((HDC)1, Points, Count1, 1, 6);
108  TEST(GetLastError() == 0);
109 
110  SetLastError(0);
111  ret = NtGdiPolyPolyDraw((HDC)0, Points, Count1, 1, 6);
112  TEST(ret == 0);
113  TEST(GetLastError() == 0);
114 
115  SetLastError(0);
116  ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 0, 1);
117  TEST(ret == 0);
118  TEST(GetLastError() == 0);
119 
120  SetLastError(0);
121  ret = NtGdiPolyPolyDraw(hDC, Points, Count2, 2, 1);
122  TEST(ret == 0);
124 
125  SetLastError(0);
126  ret = NtGdiPolyPolyDraw(hDC, Points, NULL, 2, 1);
127  TEST(ret == 0);
128  TEST(GetLastError() == 0);
129 
130  SetLastError(0);
131  ret = NtGdiPolyPolyDraw(hDC, Points, (PVOID)0x81000000, 2, 1);
132  TEST(ret == 0);
133  TEST(GetLastError() == 0);
134 
135  SetLastError(0);
136  ret = NtGdiPolyPolyDraw(hDC, NULL, Count1, 2, 1);
137  TEST(ret == 0);
138  TEST(GetLastError() == 0);
139 
140  SetLastError(0);
141  ret = NtGdiPolyPolyDraw(hDC, (PVOID)0x81000000, Count1, 2, 1);
142  TEST(ret == 0);
143  TEST(GetLastError() == 0);
144 
145 
147 
148  /* Test with a valid DC */
149 
151  ASSERT(hDC);
152 
153  SetLastError(0);
154  ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 0);
155  TEST(ret == 0);
156  TEST(GetLastError() == 0);
157 
158  SetLastError(0);
159  ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 1);
160  TEST(ret == 1);
161  TEST(GetLastError() == 0);
162 
163  SetLastError(0);
164  ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 2);
165  TEST(ret == 1);
166  TEST(GetLastError() == 0);
167 
168 #if 0
169  SetLastError(0);
170  // better don't do this on win xp!!! (random crashes)
171 // ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 3);
172  TEST(ret == 0);
174 
175  SetLastError(0);
176  // better don't do this on win xp!!! (random crashes)
177 // ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 4);
178  TEST(ret == 0);
180 
181 #endif
182 
183  SetLastError(0);
184  ret = NtGdiPolyPolyDraw(hDC, Points, Count2, 2, 1);
185  TEST(ret == 0);
187 
188  SetLastError(0);
189  ret = NtGdiPolyPolyDraw(hDC, Points, Count3, 2, 1);
190  TEST(ret == 0);
191  TEST(GetLastError() == 0);
192 
193  SetLastError(0);
194  ret = NtGdiPolyPolyDraw(hDC, Points, Count4, 2, 1);
195  TEST(ret == 0);
197 
198  SetLastError(0);
199  ret = NtGdiPolyPolyDraw(hDC, Points, Count5, 2, 1);
200  TEST(ret == 0);
201  TEST(GetLastError() == 87);
202 
203 }
204 
205 
206 
208 {
209  Test_Params();
210 
211 }
212 
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
static HDC
Definition: imagelist.c:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define GDI_OBJECT_TYPE_REGION
Definition: gdi.h:47
#define GDI_HANDLE_BASETYPE_MASK
Definition: gdi.h:18
uint32_t ULONG_PTR
Definition: typedefs.h:63
START_TEST(NtGdiPolyPolyDraw)
__kernel_entry W32KAPI ULONG_PTR APIENTRY NtGdiPolyPolyDraw(_In_ HDC hdc, _In_ PPOINT ppt, _In_reads_(ccpt) PULONG pcpt, _In_ ULONG ccpt, _In_ INT iFunc)
smooth NULL
Definition: ftsmooth.c:416
#define TEST(x)
Definition: precomp.h:20
#define SetLastError(x)
Definition: compat.h:417
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static void Test_Params(void)
int ret
static HDC hDC
Definition: 3dtext.c:33
unsigned int ULONG
Definition: retypes.h:1