2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for SetDCPenColor
5 * PROGRAMMERS: Timo Kreuzer
13 void Test_SetDCPenColor()
16 HBITMAP hbmp
, hbmpOld
;
18 // Test an incorrect DC
19 SetLastError(ERROR_SUCCESS
);
20 ok(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID
, "\n");
21 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "\n");
24 hScreenDC
= GetDC(NULL
);
25 ok(hScreenDC
!= 0, "GetDC failed, skipping tests\n");
26 if (hScreenDC
== NULL
) return;
29 SetDCPenColor(hScreenDC
, RGB(1,2,3));
30 ok(SetDCPenColor(hScreenDC
, RGB(4,5,6)) == RGB(1,2,3), "\n");
33 hDC
= CreateCompatibleDC(hScreenDC
);
34 ReleaseDC(0, hScreenDC
);
35 ok(hDC
!= 0, "CreateCompatibleDC failed, skipping tests\n");
38 // Select the DC_PEN and check if the pen returned by a new call is DC_PEN
39 SelectObject(hDC
, GetStockObject(DC_PEN
));
40 ok(SelectObject(hDC
, GetStockObject(BLACK_PEN
)) == GetStockObject(DC_PEN
), "\n");
42 // Test an incorrect color, yes windows sets the color!
43 SetDCPenColor(hDC
, 0x21123456);
44 ok(SetDCPenColor(hDC
, RGB(0,0,0)) == 0x21123456, "\n");
46 // Test CLR_INVALID, it sets CLR_INVALID!
47 SetDCPenColor(hDC
, CLR_INVALID
);
48 ok(SetDCPenColor(hDC
, RGB(0,0,0)) == CLR_INVALID
, "\n");
50 hbmp
= CreateBitmap(10, 10, 1, 32, NULL
);
51 ok(hbmp
!= 0, "CreateBitmap failed, skipping tests\n");
53 hbmpOld
= SelectObject(hDC
, hbmp
);
54 #if 0 // this only works on 32 bpp screen resolution
55 ok(hbmpOld
!= NULL
, "\n");
56 SelectObject(hDC
, GetStockObject(DC_PEN
));
57 SetDCPenColor(hDC
, 0x123456);
58 MoveToEx(hDC
, 0, 0, NULL
);
60 ok(GetPixel(hDC
, 5, 0) == 0x123456, "\n");
64 SelectObject(hDC
, hbmpOld
);
68 START_TEST(SetDCPenColor
)