mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
aa36da89c9
svn path=/trunk/; revision=33993
47 lines
1.2 KiB
C
47 lines
1.2 KiB
C
INT
|
|
Test_CreateCompatibleDC(PTESTINFO pti)
|
|
{
|
|
HDC hDCScreen, hOldDC, hDC, hDC2;
|
|
|
|
/* Get screen DC */
|
|
hDCScreen = GetDC(NULL);
|
|
ASSERT(hDCScreen != NULL);
|
|
|
|
/* Test NULL DC handle */
|
|
SetLastError(ERROR_SUCCESS);
|
|
hDC = CreateCompatibleDC(NULL);
|
|
RTEST(hDC != NULL);
|
|
RTEST(GetLastError() == ERROR_SUCCESS);
|
|
if(hDC) DeleteDC(hDC);
|
|
|
|
/* Test invalid DC handle */
|
|
SetLastError(ERROR_SUCCESS);
|
|
hDC = CreateCompatibleDC((HDC)0x123456);
|
|
RTEST(hDC == NULL);
|
|
RTEST(GetLastError() == ERROR_SUCCESS);
|
|
if(hDC) DeleteDC(hDC);
|
|
|
|
hDC = CreateCompatibleDC(hDCScreen);
|
|
RTEST(hDC != NULL);
|
|
|
|
// Test if first selected pen is BLACK_PEN (? or same as screen DC's pen?)
|
|
RTEST(SelectObject(hDC, GetStockObject(DC_PEN)) == GetStockObject(BLACK_PEN));
|
|
RTEST(SelectObject(hDC, GetStockObject(BLACK_PEN)) == GetStockObject(DC_PEN));
|
|
|
|
// Test for the starting Color == RGB(0,0,0)
|
|
RTEST(SetDCPenColor(hDC, RGB(1,2,3)) == RGB(0,0,0));
|
|
|
|
// Check for reuse counter
|
|
hOldDC = hDC;
|
|
DeleteDC(hDC);
|
|
hDC = CreateCompatibleDC(hDCScreen);
|
|
hDC2 = CreateCompatibleDC(hOldDC);
|
|
RTEST(hDC2 == NULL);
|
|
if (hDC2 != NULL) DeleteDC(hDC2);
|
|
|
|
// cleanup
|
|
DeleteDC(hDC);
|
|
|
|
ReleaseDC(NULL, hDCScreen);
|
|
return APISTATUS_NORMAL;
|
|
}
|