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