07f4010ec4d040982a81c75217127d928b884334
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for NtGdiGetBitmapBits
10 START_TEST(NtGdiGetBitmapBits
)
12 BYTE Bits
[50] = {0,1,2,3,4,5,6,7,8,9};
15 SetLastError(ERROR_SUCCESS
);
16 RTEST(NtGdiGetBitmapBits(0, 0, 0) == 0);
17 RTEST(GetLastError() == ERROR_INVALID_HANDLE
);
19 /* Test NULL bitmap handle */
20 SetLastError(ERROR_SUCCESS
);
21 RTEST(NtGdiGetBitmapBits(0, 5, Bits
) == 0);
22 RTEST(GetLastError() == ERROR_INVALID_HANDLE
);
24 /* Test invalid bitmap handle */
25 hBitmap
= (HBITMAP
)CreatePen(PS_SOLID
, 1, RGB(1,2,3));
26 SetLastError(ERROR_SUCCESS
);
27 RTEST(NtGdiGetBitmapBits(hBitmap
, 5, Bits
) == 0);
28 RTEST(GetLastError() == ERROR_INVALID_HANDLE
);
29 DeleteObject(hBitmap
);
31 hBitmap
= CreateBitmap(3, 3, 1, 8, NULL
);
32 SetLastError(ERROR_SUCCESS
);
34 /* test NULL pointer and count buffer size != 0 */
35 RTEST(NtGdiGetBitmapBits(hBitmap
, 5, NULL
) == 12);
37 /* test NULL pointer and buffer size == 0*/
38 RTEST(NtGdiGetBitmapBits(hBitmap
, 0, NULL
) == 12);
40 /* test bad pointer */
41 RTEST(NtGdiGetBitmapBits(hBitmap
, 5, (PBYTE
)0x500) == 0);
43 /* Test if we can set a number of bytes between lines */
44 RTEST(NtGdiGetBitmapBits(hBitmap
, 5, Bits
) == 5);
47 RTEST(NtGdiGetBitmapBits(hBitmap
, 4, Bits
+1) == 4);
49 /* Test 1 byte too much */
50 RTEST(NtGdiGetBitmapBits(hBitmap
, 10, Bits
) == 10);
52 /* Test one row too much */
53 RTEST(NtGdiGetBitmapBits(hBitmap
, 12, Bits
) == 12);
55 RTEST(NtGdiGetBitmapBits(hBitmap
, 13, Bits
) == 12);
57 RTEST(NtGdiGetBitmapBits(hBitmap
, 100, Bits
) == 12);
59 /* Test huge bytes count */
60 RTEST(NtGdiGetBitmapBits(hBitmap
, 12345678, Bits
) == 12);
62 /* Test negative bytes count */
63 RTEST(NtGdiGetBitmapBits(hBitmap
, -5, Bits
) == 12);
65 RTEST(GetLastError() == ERROR_SUCCESS
);
67 DeleteObject(hBitmap
);