- add tests for SetWorldTransform

- more tests for CreateCompatibleDC, GetClipRgn, SelectObject and SetDCPenColor

svn path=/trunk/; revision=32746
This commit is contained in:
Timo Kreuzer 2008-03-22 03:21:52 +00:00
parent 019b6f7ff8
commit fa2f4d10ba
6 changed files with 59 additions and 9 deletions

View file

@ -18,7 +18,7 @@
#include "tests/SelectObject.c"
#include "tests/SetDCPenColor.c"
#include "tests/SetSysColors.c"
//#include "tests/SetWorldTransform.c"
#include "tests/SetWorldTransform.c"
/* The List of tests */
TESTENTRY TestList[] =
@ -37,7 +37,7 @@ TESTENTRY TestList[] =
{ L"SetSysColors", Test_SetSysColors },
{ L"SelectObject", Test_SelectObject },
{ L"SetDCPenColor", Test_SetDCPenColor },
// { L"SetWorldTransform", Test_SetWorldTransform },
{ L"SetWorldTransform", Test_SetWorldTransform },
};
/* The function that gives us the number of tests */

View file

@ -3,12 +3,23 @@ Test_CreateCompatibleDC(PTESTINFO pti)
{
HDC hDCScreen, hOldDC, hDC, hDC2;
// Create a DC
/* Get screen DC */
hDCScreen = GetDC(NULL);
if (hDCScreen == NULL)
{
return FALSE;
}
ASSERT(hDCScreen != NULL);
/* Test NULL DC handle */
SetLastError(ERROR_SUCCESS);
hDC = CreateCompatibleDC(NULL);
TEST(hDC != NULL);
TEST(GetLastError() == ERROR_SUCCESS);
if(hDC) DeleteDC(hDC);
/* Test invalid DC handle */
SetLastError(ERROR_SUCCESS);
hDC = CreateCompatibleDC((HDC)0x123456);
TEST(hDC == NULL);
TEST(GetLastError() == ERROR_SUCCESS);
if(hDC) DeleteDC(hDC);
hDC = CreateCompatibleDC(hDCScreen);
RTEST(hDC != NULL);

View file

@ -13,8 +13,15 @@ Test_GetClipRgn(PTESTINFO pti)
hDC = GetDC(hWnd);
hrgn = CreateRectRgn(0,0,0,0);
/* Test invalid DC */
SetLastError(ERROR_SUCCESS);
// TEST(GetClipRgn(hDC)
TEST(GetClipRgn((HDC)0x12345, hrgn) == -1);
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
/* Test invalid hrgn */
SetLastError(ERROR_SUCCESS);
TEST(GetClipRgn(hDC, (HRGN)0x12345) == 0);
TEST(GetLastError() == ERROR_SUCCESS);
ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd);

View file

@ -2,7 +2,7 @@ INT
Test_SelectObject(PTESTINFO pti)
{
HGDIOBJ hOldObj, hNewObj;
HDC hScreenDC, hDC;
HDC hScreenDC, hDC, hDC2;
PGDI_TABLE_ENTRY pEntry;
PDC_ATTR pDc_Attr;
HANDLE hcmXform;
@ -35,6 +35,16 @@ Test_SelectObject(PTESTINFO pti)
TEST(pDc_Attr->hbrush == hNewObj);
SelectObject(hDC, hOldObj);
/* Test wrong hDC handle type */
SetLastError(ERROR_SUCCESS);
hNewObj = GetStockObject(GRAY_BRUSH);
hDC2 = (HDC)((UINT_PTR)hDC & ~GDI_HANDLE_TYPE_MASK);
hDC2 = (HDC)((UINT_PTR)hDC2 | GDI_OBJECT_TYPE_PEN);
hOldObj = SelectObject(hDC2, hNewObj);
TEST(GetLastError() == ERROR_INVALID_HANDLE);
TEST(hOldObj == NULL);
TEST(pDc_Attr->hbrush == GetStockObject(WHITE_BRUSH));
/* Test wrong hobj handle type */
SetLastError(ERROR_SUCCESS);
hNewObj = GetStockObject(GRAY_BRUSH);

View file

@ -4,7 +4,9 @@ Test_SetDCPenColor(PTESTINFO pti)
HDC hScreenDC, hDC;
// Test an incorrect DC
SetLastError(ERROR_SUCCESS);
RTEST(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID);
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
// Get the Screen DC
hScreenDC = GetDC(NULL);

View file

@ -0,0 +1,20 @@
INT
Test_SetWorldTransform(PTESTINFO pti)
{
PGDI_TABLE_ENTRY pEntry;
HDC hScreenDC, hDC;
DC_ATTR* pDC_Attr;
/* Create a DC */
hScreenDC = GetDC(NULL);
hDC = CreateCompatibleDC(hScreenDC);
ReleaseDC(NULL, hScreenDC);
SetGraphicsMode(hDC, GM_ADVANCED);
pEntry = GdiHandleTable + GDI_HANDLE_GET_INDEX(hDC);
pDC_Attr = pEntry->UserData;
DeleteDC(hDC);
return APISTATUS_NORMAL;
}