2 Test_NtGdiGetBitmapBits(PTESTINFO pti
)
4 BYTE Bits
[50] = {0,1,2,3,4,5,6,7,8,9};
7 SetLastError(ERROR_SUCCESS
);
8 RTEST(NtGdiGetBitmapBits(0, 0, 0) == 0);
9 RTEST(GetLastError() == ERROR_INVALID_HANDLE
);
11 /* Test NULL bitmap handle */
12 SetLastError(ERROR_SUCCESS
);
13 RTEST(NtGdiGetBitmapBits(0, 5, Bits
) == 0);
14 RTEST(GetLastError() == ERROR_INVALID_HANDLE
);
16 /* Test invalid bitmap handle */
17 hBitmap
= (HBITMAP
)CreatePen(PS_SOLID
, 1, RGB(1,2,3));
18 SetLastError(ERROR_SUCCESS
);
19 RTEST(NtGdiGetBitmapBits(hBitmap
, 5, Bits
) == 0);
20 RTEST(GetLastError() == ERROR_INVALID_HANDLE
);
21 DeleteObject(hBitmap
);
23 hBitmap
= CreateBitmap(3, 3, 1, 8, NULL
);
24 SetLastError(ERROR_SUCCESS
);
26 /* test NULL pointer and count buffer size != 0 */
27 RTEST(NtGdiGetBitmapBits(hBitmap
, 5, NULL
) == 12);
29 /* test NULL pointer and buffer size == 0*/
30 RTEST(NtGdiGetBitmapBits(hBitmap
, 0, NULL
) == 12);
32 /* test bad pointer */
33 RTEST(NtGdiGetBitmapBits(hBitmap
, 5, (PBYTE
)0x500) == 0);
35 /* Test if we can set a number of bytes between lines */
36 RTEST(NtGdiGetBitmapBits(hBitmap
, 5, Bits
) == 5);
39 RTEST(NtGdiGetBitmapBits(hBitmap
, 4, Bits
+1) == 4);
41 /* Test 1 byte too much */
42 RTEST(NtGdiGetBitmapBits(hBitmap
, 10, Bits
) == 10);
44 /* Test one row too much */
45 RTEST(NtGdiGetBitmapBits(hBitmap
, 12, Bits
) == 12);
47 RTEST(NtGdiGetBitmapBits(hBitmap
, 13, Bits
) == 12);
49 RTEST(NtGdiGetBitmapBits(hBitmap
, 100, Bits
) == 12);
51 /* Test huge bytes count */
52 RTEST(NtGdiGetBitmapBits(hBitmap
, 12345678, Bits
) == 12);
54 /* Test negative bytes count */
55 RTEST(NtGdiGetBitmapBits(hBitmap
, -5, Bits
) == 12);
57 RTEST(GetLastError() == ERROR_SUCCESS
);
59 DeleteObject(hBitmap
);
61 return APISTATUS_NORMAL
;