ReactOS  0.4.14-dev-376-gaedba84
GetPixel.c
Go to the documentation of this file.
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 
11 {
12  HDC hdc;
13  HBITMAP hbmp;
14  char buffer[] = {0x80, 0x0};
16 
17  hbmp = CreateBitmap(2,1,1,1,buffer);
18  ok(hbmp != NULL, "Failed to create a monochrom bitmap...\n");
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 
44  DeleteDC(hdc);
45 }
46 
48 {
50 }
static HDC
Definition: imagelist.c:92
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLuint buffer
Definition: glext.h:5915
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
GLuint color
Definition: glext.h:6243
smooth NULL
Definition: ftsmooth.c:416
HBITMAP hbmp
DWORD COLORREF
Definition: windef.h:285
HDC hdc
Definition: main.c:9
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
BOOL WINAPI DeleteDC(_In_ HDC)
#define ok(value,...)
Definition: atltest.h:57
unsigned int UINT
Definition: ndis.h:50
static HBITMAP
Definition: button.c:44
START_TEST(GetPixel)
Definition: GetPixel.c:47
void Test_GetPixel_1bpp()
Definition: GetPixel.c:10
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)