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