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 "precomp.h"
9 
10 void Test_GetPixel_1bpp()
11 {
12     HDC hdc;
13     HBITMAP hbmp;
14     char buffer[] = {0x80, 0x0};
15     COLORREF color;
16 
17     hbmp = CreateBitmap(2,1,1,1,buffer);
18     ok(hbmp != NULL, "Failed to create a monochrom bitmap...\n");
19     hdc = CreateCompatibleDC(0);
20     hbmp = SelectObject(hdc, hbmp);
21     ok(hbmp != NULL, "Could not select the bitmap into the DC.\n");
22 
23     color = GetPixel(hdc, 0, 0);
24     ok(color == 0xFFFFFF, "Wrong color at 0,0 : 0x%08x\n", (UINT)color);
25     color = GetPixel(hdc, 1, 0);
26     ok(color == 0, "Wrong color at 1,0 : 0x%08x\n", (UINT)color);
27 
28     SetBkColor(hdc, 0x0000FF);
29     SetTextColor(hdc, 0x00FF00);
30     color = GetPixel(hdc, 0, 0);
31     ok(color == 0xFFFFFF, "Wrong color at 0,0 : 0x%08x\n", (UINT)color);
32     color = GetPixel(hdc, 1, 0);
33     ok(color == 0, "Wrong color at 1,0 : 0x%08x\n", (UINT)color);
34 
35     SetBkColor(hdc, 0x12345678);
36     SetTextColor(hdc, 0x87654321);
37     color = GetPixel(hdc, 0, 0);
38     ok(color == 0xFFFFFF, "Wrong color at 0,0 : 0x%08x\n", (UINT)color);
39     color = GetPixel(hdc, 1, 0);
40     ok(color == 0, "Wrong color at 1,0 : 0x%08x\n", (UINT)color);
41 
42     hbmp = SelectObject(hdc, hbmp);
43     DeleteObject(hbmp);
44     DeleteDC(hdc);
45 }
46 
47 START_TEST(GetPixel)
48 {
49     Test_GetPixel_1bpp();
50 }
51