ReactOS  0.4.14-dev-323-g6fe6a88
NtGdiGetBitmapBits.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 NtGdiGetBitmapBits
5  * PROGRAMMERS:
6  */
7 
8 #include <win32nt.h>
9 
11 {
12  BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
14 
16  ok_long(NtGdiGetBitmapBits(0, 0, 0), 0);
18 
19  /* Test NULL bitmap handle */
21  ok_long(NtGdiGetBitmapBits(0, 5, Bits), 0);
23 
24  /* Test invalid bitmap handle */
25  hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
27  ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 0);
30 
31  hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
33 
34  /* test NULL pointer and count buffer size != 0 */
36 
37  /* test NULL pointer and buffer size == 0*/
39 
40  /* test bad pointer */
41  ok_long(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500), 0);
42 
43  /* Test if we can set a number of bytes between lines */
44  ok_long(NtGdiGetBitmapBits(hBitmap, 5, Bits), 5);
45 
46  /* Test alignment */
47  ok_long(NtGdiGetBitmapBits(hBitmap, 4, Bits+1), 4);
48 
49  /* Test 1 byte too much */
50  ok_long(NtGdiGetBitmapBits(hBitmap, 10, Bits), 10);
51 
52  /* Test one row too much */
53  ok_long(NtGdiGetBitmapBits(hBitmap, 12, Bits), 12);
54 
55  ok_long(NtGdiGetBitmapBits(hBitmap, 13, Bits), 12);
56 
57  ok_long(NtGdiGetBitmapBits(hBitmap, 100, Bits), 12);
58 
59  /* Test huge bytes count */
60  ok_long(NtGdiGetBitmapBits(hBitmap, 12345678, Bits), 12);
61 
62  /* Test negative bytes count */
63  ok_long(NtGdiGetBitmapBits(hBitmap, -5, Bits), 12);
64 
66 
68 }
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_INVALID_HANDLE
Definition: compat.h:88
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define ok_long(expression, result)
Definition: atltest.h:133
#define PS_SOLID
Definition: wingdi.h:585
__kernel_entry W32KAPI LONG APIENTRY NtGdiGetBitmapBits(_In_ HBITMAP hbm, _In_ ULONG cjMax, _Out_writes_bytes_opt_(cjMax) PBYTE pjOut)
START_TEST(NtGdiGetBitmapBits)
smooth NULL
Definition: ftsmooth.c:416
#define RGB(r, g, b)
Definition: wingdi.h:2935
#define SetLastError(x)
Definition: compat.h:409
unsigned char BYTE
Definition: mem.h:68
static HBITMAP
Definition: button.c:44
BYTE * PBYTE
Definition: pedump.c:66
static HBITMAP hBitmap
Definition: timezone.c:35
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)