Disable some misleading service tests because a test cannot determine wheter or not...
[reactos.git] / rostests / apitests / w32knapi / ntgdi / NtGdiGetBitmapBits.c
1 INT
2 Test_NtGdiGetBitmapBits(PTESTINFO pti)
3 {
4 BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
5 HBITMAP hBitmap;
6
7 SetLastError(ERROR_SUCCESS);
8 RTEST(NtGdiGetBitmapBits(0, 0, 0) == 0);
9 RTEST(GetLastError() == ERROR_INVALID_HANDLE);
10
11 /* Test NULL bitmap handle */
12 SetLastError(ERROR_SUCCESS);
13 RTEST(NtGdiGetBitmapBits(0, 5, Bits) == 0);
14 RTEST(GetLastError() == ERROR_INVALID_HANDLE);
15
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);
22
23 hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
24 SetLastError(ERROR_SUCCESS);
25
26 /* test NULL pointer and count buffer size != 0 */
27 RTEST(NtGdiGetBitmapBits(hBitmap, 5, NULL) == 12);
28
29 /* test NULL pointer and buffer size == 0*/
30 RTEST(NtGdiGetBitmapBits(hBitmap, 0, NULL) == 12);
31
32 /* test bad pointer */
33 RTEST(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500) == 0);
34
35 /* Test if we can set a number of bytes between lines */
36 RTEST(NtGdiGetBitmapBits(hBitmap, 5, Bits) == 5);
37
38 /* Test alignment */
39 RTEST(NtGdiGetBitmapBits(hBitmap, 4, Bits+1) == 4);
40
41 /* Test 1 byte too much */
42 RTEST(NtGdiGetBitmapBits(hBitmap, 10, Bits) == 10);
43
44 /* Test one row too much */
45 RTEST(NtGdiGetBitmapBits(hBitmap, 12, Bits) == 12);
46
47 RTEST(NtGdiGetBitmapBits(hBitmap, 13, Bits) == 12);
48
49 RTEST(NtGdiGetBitmapBits(hBitmap, 100, Bits) == 12);
50
51 /* Test huge bytes count */
52 RTEST(NtGdiGetBitmapBits(hBitmap, 12345678, Bits) == 12);
53
54 /* Test negative bytes count */
55 RTEST(NtGdiGetBitmapBits(hBitmap, -5, Bits) == 12);
56
57 RTEST(GetLastError() == ERROR_SUCCESS);
58
59 DeleteObject(hBitmap);
60
61 return APISTATUS_NORMAL;
62 }