[KMTESTS:MM]
[reactos.git] / rostests / apitests / gdi32 / GetPixel.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for GetPixel
5 * PROGRAMMERS: Jérôme Gardou
6 */
7
8 #include <apitest.h>
9
10 #include <wingdi.h>
11
12 void Test_GetPixel_1bpp()
13 {
14 HDC hdc;
15 HBITMAP hbmp;
16 char buffer[] = {0x80, 0x0};
17 COLORREF color;
18
19 hbmp = CreateBitmap(2,1,1,1,buffer);
20 ok(hbmp != NULL, "Failed to create a monochrom bitmap...\n");
21 hdc = CreateCompatibleDC(0);
22 hbmp = SelectObject(hdc, hbmp);
23 ok(hbmp != NULL, "Could not select the bitmap into the DC.\n");
24
25 color = GetPixel(hdc, 0, 0);
26 ok(color == 0xFFFFFF, "Wrong color at 0,0 : 0x%08x\n", (UINT)color);
27 color = GetPixel(hdc, 1, 0);
28 ok(color == 0, "Wrong color at 1,0 : 0x%08x\n", (UINT)color);
29
30 SetBkColor(hdc, 0x0000FF);
31 SetTextColor(hdc, 0x00FF00);
32 color = GetPixel(hdc, 0, 0);
33 ok(color == 0xFFFFFF, "Wrong color at 0,0 : 0x%08x\n", (UINT)color);
34 color = GetPixel(hdc, 1, 0);
35 ok(color == 0, "Wrong color at 1,0 : 0x%08x\n", (UINT)color);
36
37 SetBkColor(hdc, 0x12345678);
38 SetTextColor(hdc, 0x87654321);
39 color = GetPixel(hdc, 0, 0);
40 ok(color == 0xFFFFFF, "Wrong color at 0,0 : 0x%08x\n", (UINT)color);
41 color = GetPixel(hdc, 1, 0);
42 ok(color == 0, "Wrong color at 1,0 : 0x%08x\n", (UINT)color);
43
44 hbmp = SelectObject(hdc, hbmp);
45 DeleteObject(hbmp);
46 DeleteDC(hdc);
47 }
48
49 START_TEST(GetPixel)
50 {
51 Test_GetPixel_1bpp();
52 }