diff --git a/rostests/apitests/gdi32api/testlist.c b/rostests/apitests/gdi32api/testlist.c index a21e9d2ff42..a68d6d304c0 100644 --- a/rostests/apitests/gdi32api/testlist.c +++ b/rostests/apitests/gdi32api/testlist.c @@ -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 */ diff --git a/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c b/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c index f31103d567c..17337bd9da3 100644 --- a/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c +++ b/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c @@ -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); diff --git a/rostests/apitests/gdi32api/tests/GetClipRgn.c b/rostests/apitests/gdi32api/tests/GetClipRgn.c index 14bd2a87776..fee7b051d85 100644 --- a/rostests/apitests/gdi32api/tests/GetClipRgn.c +++ b/rostests/apitests/gdi32api/tests/GetClipRgn.c @@ -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); diff --git a/rostests/apitests/gdi32api/tests/SelectObject.c b/rostests/apitests/gdi32api/tests/SelectObject.c index 5e0a6a880cb..c45b318b1f6 100644 --- a/rostests/apitests/gdi32api/tests/SelectObject.c +++ b/rostests/apitests/gdi32api/tests/SelectObject.c @@ -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); diff --git a/rostests/apitests/gdi32api/tests/SetDCPenColor.c b/rostests/apitests/gdi32api/tests/SetDCPenColor.c index b04bb936d0c..225379c0bce 100644 --- a/rostests/apitests/gdi32api/tests/SetDCPenColor.c +++ b/rostests/apitests/gdi32api/tests/SetDCPenColor.c @@ -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); diff --git a/rostests/apitests/gdi32api/tests/SetWorldTransform.c b/rostests/apitests/gdi32api/tests/SetWorldTransform.c new file mode 100644 index 00000000000..7aa79d5cdea --- /dev/null +++ b/rostests/apitests/gdi32api/tests/SetWorldTransform.c @@ -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; +}