- Add test for AddFontResourceEx showing that the function accepts 0 as flags.
[reactos.git] / rostests / apitests / gdi32api / tests / SetDCPenColor.c
1 INT
2 Test_SetDCPenColor(PTESTINFO pti)
3 {
4 HDC hScreenDC, hDC;
5
6 // Test an incorrect DC
7 RTEST(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID);
8
9 // Get the Screen DC
10 hScreenDC = GetDC(NULL);
11 if (hScreenDC == NULL) return FALSE;
12
13 // Test the screen DC
14 SetDCPenColor(hScreenDC, RGB(1,2,3));
15 TEST(SetDCPenColor(hScreenDC, RGB(4,5,6)) == RGB(1,2,3));
16
17 // Create a new DC
18 hDC = CreateCompatibleDC(hScreenDC);
19 ReleaseDC(0, hScreenDC);
20 if (hDC == NULL)
21 {
22 return FALSE;
23 }
24
25 // Select the DC_PEN and check if the pen returned by a new call is DC_PEN
26 SelectObject(hDC, GetStockObject(DC_PEN));
27 TEST(SelectObject(hDC, GetStockObject(BLACK_PEN)) == GetStockObject(DC_PEN));
28
29 // Test an incorrect color, yes windows sets the color!
30 SetDCPenColor(hDC, 0x21123456);
31 TEST(SetDCPenColor(hDC, RGB(0,0,0)) == 0x21123456);
32
33 // Test CLR_INVALID, it sets CLR_INVALID!
34 SetDCPenColor(hDC, CLR_INVALID);
35 RTEST(SetDCPenColor(hDC, RGB(0,0,0)) == CLR_INVALID);
36
37 // Delete the DC
38 DeleteDC(hDC);
39
40 return APISTATUS_NORMAL;
41 }