ReactOS 0.4.15-dev-7842-g558ab78
SetDCPenColor.c File Reference
#include "precomp.h"
Include dependency graph for SetDCPenColor.c:

Go to the source code of this file.

Functions

void Test_SetDCPenColor ()
 
 START_TEST (SetDCPenColor)
 

Function Documentation

◆ START_TEST()

START_TEST ( SetDCPenColor  )

Definition at line 65 of file SetDCPenColor.c.

66{
68}
void Test_SetDCPenColor()
Definition: SetDCPenColor.c:10

◆ Test_SetDCPenColor()

void Test_SetDCPenColor ( )

Definition at line 10 of file SetDCPenColor.c.

11{
12 HDC hScreenDC, hDC;
14
15 // Test an incorrect DC
17 ok(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID, "\n");
19
20 // Get the Screen DC
21 hScreenDC = GetDC(NULL);
22 ok(hScreenDC != 0, "GetDC failed, skipping tests\n");
23 if (hScreenDC == NULL) return;
24
25 // Test the screen DC
26 SetDCPenColor(hScreenDC, RGB(1,2,3));
27 ok(SetDCPenColor(hScreenDC, RGB(4,5,6)) == RGB(1,2,3), "\n");
28
29 // Create a new DC
30 hDC = CreateCompatibleDC(hScreenDC);
31 ReleaseDC(0, hScreenDC);
32 ok(hDC != 0, "CreateCompatibleDC failed, skipping tests\n");
33 if (!hDC) return;
34
35 // Select the DC_PEN and check if the pen returned by a new call is DC_PEN
38
39 // Test an incorrect color, yes windows sets the color!
40 SetDCPenColor(hDC, 0x21123456);
41 ok(SetDCPenColor(hDC, RGB(0,0,0)) == 0x21123456, "\n");
42
43 // Test CLR_INVALID, it sets CLR_INVALID!
45 ok(SetDCPenColor(hDC, RGB(0,0,0)) == CLR_INVALID, "\n");
46
47 hbmp = CreateBitmap(10, 10, 1, 32, NULL);
48 ok(hbmp != 0, "CreateBitmap failed, skipping tests\n");
49 if (!hbmp) return;
51#if 0 // this only works on 32 bpp screen resolution
52 ok(hbmpOld != NULL, "\n");
54 SetDCPenColor(hDC, 0x123456);
55 MoveToEx(hDC, 0, 0, NULL);
56 LineTo(hDC, 10, 0);
57 ok(GetPixel(hDC, 5, 0) == 0x123456, "\n");
58#endif
59
60 // Delete the DC
63}
static HDC hDC
Definition: 3dtext.c:33
#define ok(value,...)
Definition: atltest.h:57
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
HBITMAP hbmp
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define RGB(r, g, b)
Definition: precomp.h:71
HANDLE hbmpOld
Definition: magnifier.c:54
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:92
COLORREF WINAPI SetDCPenColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:941
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
HGDIOBJ WINAPI GetStockObject(_In_ int)
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define CLR_INVALID
Definition: wingdi.h:883
#define BLACK_PEN
Definition: wingdi.h:903
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

Referenced by START_TEST().