2007-08-05 03:32:24 +00:00
|
|
|
INT
|
|
|
|
Test_SetDCPenColor(PTESTINFO pti)
|
|
|
|
{
|
|
|
|
HDC hScreenDC, hDC;
|
|
|
|
|
|
|
|
// Test an incorrect DC
|
2008-03-22 03:21:52 +00:00
|
|
|
SetLastError(ERROR_SUCCESS);
|
2007-08-05 23:05:02 +00:00
|
|
|
RTEST(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID);
|
2008-03-22 03:21:52 +00:00
|
|
|
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
2007-08-05 03:32:24 +00:00
|
|
|
|
|
|
|
// Get the Screen DC
|
|
|
|
hScreenDC = GetDC(NULL);
|
|
|
|
if (hScreenDC == NULL) return FALSE;
|
|
|
|
|
|
|
|
// Test the screen DC
|
|
|
|
SetDCPenColor(hScreenDC, RGB(1,2,3));
|
|
|
|
TEST(SetDCPenColor(hScreenDC, RGB(4,5,6)) == RGB(1,2,3));
|
|
|
|
|
|
|
|
// Create a new DC
|
|
|
|
hDC = CreateCompatibleDC(hScreenDC);
|
|
|
|
ReleaseDC(0, hScreenDC);
|
|
|
|
if (hDC == NULL)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Select the DC_PEN and check if the pen returned by a new call is DC_PEN
|
|
|
|
SelectObject(hDC, GetStockObject(DC_PEN));
|
|
|
|
TEST(SelectObject(hDC, GetStockObject(BLACK_PEN)) == GetStockObject(DC_PEN));
|
|
|
|
|
|
|
|
// Test an incorrect color, yes windows sets the color!
|
|
|
|
SetDCPenColor(hDC, 0x21123456);
|
|
|
|
TEST(SetDCPenColor(hDC, RGB(0,0,0)) == 0x21123456);
|
|
|
|
|
|
|
|
// Test CLR_INVALID, it sets CLR_INVALID!
|
|
|
|
SetDCPenColor(hDC, CLR_INVALID);
|
2007-08-05 23:05:02 +00:00
|
|
|
RTEST(SetDCPenColor(hDC, RGB(0,0,0)) == CLR_INVALID);
|
2007-08-05 03:32:24 +00:00
|
|
|
|
|
|
|
// Delete the DC
|
|
|
|
DeleteDC(hDC);
|
|
|
|
|
|
|
|
return APISTATUS_NORMAL;
|
|
|
|
}
|