ReactOS 0.4.15-dev-5672-gf73ac17
NtGdiCreateBitmap.c File Reference
#include <win32nt.h>
Include dependency graph for NtGdiCreateBitmap.c:

Go to the source code of this file.

Functions

void Test_NtGdiCreateBitmap_Params (void)
 
 START_TEST (NtGdiCreateBitmap)
 

Function Documentation

◆ START_TEST()

START_TEST ( NtGdiCreateBitmap  )

Definition at line 200 of file NtGdiCreateBitmap.c.

201{
202
204// Test_NtGdiCreateBitmap_Pixel();
205
206}
void Test_NtGdiCreateBitmap_Params(void)

◆ Test_NtGdiCreateBitmap_Params()

void Test_NtGdiCreateBitmap_Params ( void  )

Definition at line 10 of file NtGdiCreateBitmap.c.

11{
12 HBITMAP hBmp;
14 BYTE BitmapData[10] = {0x11, 0x22, 0x33};
15
16 /* Test simple params */
18 ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL, "hBmp was NULL.\n");
20 DeleteObject(hBmp);
21
22 /* Test all zero */
24 ok_ptr(NtGdiCreateBitmap(0, 0, 0, 0, NULL), NULL);
26
27 /* Test cx == 0 */
29 ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL);
31
32 /* Test negative cx */
34 ok_ptr(NtGdiCreateBitmap(-10, 1, 1, 1, NULL), NULL);
36
37 /* Test cy == 0 */
39 ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL);
41
42 /* Test negative cy */
44 ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, NULL), NULL);
46
47 /* Test negative cy and valid bits */
51
52 /* Test negative cy and invalid bits */
54 ok_ptr(NtGdiCreateBitmap(1, -2, 1, 1, (BYTE*)(LONG_PTR)0x80001234), NULL);
56
57 /* Test huge size */
59 ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL), NULL);
61
62 /* Test huge size and valid bits */
64 TEST(NtGdiCreateBitmap(1000, 1000, 1, 1, BitmapData) == NULL);
66
67 /* Test huge size and invalid bits */
69 ok_ptr(NtGdiCreateBitmap(100000, 100000, 1, 1, (BYTE*)(LONG_PTR)0x80001234), NULL);
71
72 /* Test cPlanes == 0 */
74 ok((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL, "hBmp was NULL.\n");
76 ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
77 ok_int(bitmap.bmType, 0);
78 ok_int(bitmap.bmWidth, 1);
79 ok_int(bitmap.bmHeight, 1);
80 ok_int(bitmap.bmWidthBytes, 2);
81 ok_int(bitmap.bmPlanes, 1);
82 ok_int(bitmap.bmBitsPixel, 1);
83 DeleteObject(hBmp);
84
85 /* Test big cPlanes */
87 ok((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL, "hBmp was NULL.\n");
89 DeleteObject(hBmp);
90
91 ok_ptr(NtGdiCreateBitmap(1, 1, 33, 1, NULL), NULL);
93
94 /* Test cBPP == 0 */
96 ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL, "hBmp was NULL.\n");
98 ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
99 ok_int(bitmap.bmType, 0);
100 ok_int(bitmap.bmWidth, 1);
101 ok_int(bitmap.bmHeight, 1);
102 ok_int(bitmap.bmWidthBytes, 2);
103 ok_int(bitmap.bmPlanes, 1);
104 ok_int(bitmap.bmBitsPixel, 1);
105 DeleteObject(hBmp);
106
107 /* Test negative cBPP */
109 ok_ptr(NtGdiCreateBitmap(1, 1, 1, -1, NULL), NULL);
111
112 /* Test bad cBPP */
114 ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 3, NULL)) != NULL, "hBmp was NULL.\n");
115 ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
116 ok_int(bitmap.bmBitsPixel, 4);
117 DeleteObject(hBmp);
118
119 ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL, "hBmp was NULL.\n");
120 ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
121 ok_int(bitmap.bmBitsPixel, 8);
122 DeleteObject(hBmp);
123
124 ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL, "hBmp was NULL.\n");
125 ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
126 ok_int(bitmap.bmBitsPixel, 16);
127 DeleteObject(hBmp);
128
129 ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL, "hBmp was NULL.\n");
130 ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
131 ok_int(bitmap.bmBitsPixel, 24);
132 DeleteObject(hBmp);
133
134 ok((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL, "hBmp was NULL.\n");
135 ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
136 ok_int(bitmap.bmBitsPixel, 24);
137 DeleteObject(hBmp);
138
139 ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL, "hBmp was NULL.\n");
140 ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
141 ok_int(bitmap.bmBitsPixel, 32);
142 DeleteObject(hBmp);
143
145
146 ok_ptr(NtGdiCreateBitmap(1, 1, 1, 33, NULL), NULL);
148
149 /* Test bad pointer */
151 ok_ptr(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)(LONG_PTR)0x80001234), NULL);
153
154 /* Test pointer alignment */
156 ok((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL, "hBmp was NULL.\n");
158 DeleteObject(hBmp);
159
160 /* Test normal params */
162 ok((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL, "hBmp was NULL.\n");
164 ok_int(GetObject(hBmp, sizeof(BITMAP), &bitmap), (int)sizeof(BITMAP));
165 ok_int(bitmap.bmType, 0);
166 ok_int(bitmap.bmWidth, 5);
167 ok_int(bitmap.bmHeight, 7);
168 ok_int(bitmap.bmWidthBytes, 6);
169 ok_int(bitmap.bmPlanes, 1);
170 ok_int(bitmap.bmBitsPixel, 8);
171 DeleteObject(hBmp);
172
173
174 /* Test height 0 params */
176 ok_ptr(NtGdiCreateBitmap(1, 0, 1, 1, NULL), NULL);
178
179 /* Test height -1 params */
181 ok_ptr(NtGdiCreateBitmap(1, -1, 1, 1, NULL), NULL);
183
184 /* Test witdth 0 params */
186 ok_ptr(NtGdiCreateBitmap(0, 1, 1, 1, NULL), NULL);
188
189 /* Test witdth -1 params */
191 ok_ptr(NtGdiCreateBitmap(-1, 0, 1, 1, NULL), NULL);
193
194 /* Test witdth -1 params */
196 ok_ptr(NtGdiCreateBitmap(0, 0, 1, 1, NULL), NULL);
198}
#define ok_long(expression, result)
Definition: atltest.h:133
#define ok(value,...)
Definition: atltest.h:57
#define ok_int(expression, result)
Definition: atltest.h:134
#define ok_ptr(expression, result)
Definition: atltest.h:108
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
pKey DeleteObject()
#define TEST(x)
Definition: precomp.h:20
static HBITMAP
Definition: button.c:44
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
__kernel_entry W32KAPI HBITMAP APIENTRY NtGdiCreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBPP, _In_opt_ LPBYTE pjInit)
Definition: bl.h:1331
Definition: uimain.c:89
DWORD WINAPI GetLastError(void)
Definition: except.c:1040
#define GetObject
Definition: wingdi.h:4468
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().