- make apitest.c into a static lib to be used by different tests
[reactos.git] / rostests / win32 / gdi32 / tests / SetDCPenColor.c
1 #line 2 "SetDCPenColor.c"
2
3 #include "../gditest.h"
4
5 BOOL Test_SetDCPenColor(INT* passed, INT* failed)
6 {
7 HDC hScreenDC, hDC;
8
9 // Test an incorrect DC
10 TEST(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID);
11
12 // Get the Screen DC
13 hScreenDC = GetDC(NULL);
14 if (hScreenDC == NULL) return FALSE;
15
16 // Test the screen DC
17 SetDCPenColor(hScreenDC, RGB(1,2,3));
18 TEST(SetDCPenColor(hScreenDC, RGB(4,5,6)) == RGB(1,2,3));
19
20 // Create a new DC
21 hDC = CreateCompatibleDC(hScreenDC);
22 ReleaseDC(0, hScreenDC);
23 if (hDC == NULL)
24 {
25 return FALSE;
26 }
27
28 // Select the DC_PEN and check if the pen returned by a new call is DC_PEN
29 SelectObject(hDC, GetStockObject(DC_PEN));
30 TEST(SelectObject(hDC, GetStockObject(BLACK_PEN)) == GetStockObject(DC_PEN));
31
32 // Test an incorrect color, yes windows sets the color!
33 SetDCPenColor(hDC, 0x21123456);
34 TEST(SetDCPenColor(hDC, RGB(0,0,0)) == 0x21123456);
35
36 // Test CLR_INVALID, it sets CLR_INVALID!
37 SetDCPenColor(hDC, CLR_INVALID);
38 TEST(SetDCPenColor(hDC, RGB(0,0,0)) == CLR_INVALID);
39
40 // Delete the DC
41 DeleteDC(hDC);
42
43 return TRUE;
44 }