mirror of
https://github.com/reactos/reactos.git
synced 2025-05-30 06:28:34 +00:00
- add tests for SetWorldTransform
- more tests for CreateCompatibleDC, GetClipRgn, SelectObject and SetDCPenColor svn path=/trunk/; revision=32746
This commit is contained in:
parent
019b6f7ff8
commit
fa2f4d10ba
6 changed files with 59 additions and 9 deletions
|
@ -18,7 +18,7 @@
|
||||||
#include "tests/SelectObject.c"
|
#include "tests/SelectObject.c"
|
||||||
#include "tests/SetDCPenColor.c"
|
#include "tests/SetDCPenColor.c"
|
||||||
#include "tests/SetSysColors.c"
|
#include "tests/SetSysColors.c"
|
||||||
//#include "tests/SetWorldTransform.c"
|
#include "tests/SetWorldTransform.c"
|
||||||
|
|
||||||
/* The List of tests */
|
/* The List of tests */
|
||||||
TESTENTRY TestList[] =
|
TESTENTRY TestList[] =
|
||||||
|
@ -37,7 +37,7 @@ TESTENTRY TestList[] =
|
||||||
{ L"SetSysColors", Test_SetSysColors },
|
{ L"SetSysColors", Test_SetSysColors },
|
||||||
{ L"SelectObject", Test_SelectObject },
|
{ L"SelectObject", Test_SelectObject },
|
||||||
{ L"SetDCPenColor", Test_SetDCPenColor },
|
{ L"SetDCPenColor", Test_SetDCPenColor },
|
||||||
// { L"SetWorldTransform", Test_SetWorldTransform },
|
{ L"SetWorldTransform", Test_SetWorldTransform },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The function that gives us the number of tests */
|
/* The function that gives us the number of tests */
|
||||||
|
|
|
@ -3,12 +3,23 @@ Test_CreateCompatibleDC(PTESTINFO pti)
|
||||||
{
|
{
|
||||||
HDC hDCScreen, hOldDC, hDC, hDC2;
|
HDC hDCScreen, hOldDC, hDC, hDC2;
|
||||||
|
|
||||||
// Create a DC
|
/* Get screen DC */
|
||||||
hDCScreen = GetDC(NULL);
|
hDCScreen = GetDC(NULL);
|
||||||
if (hDCScreen == NULL)
|
ASSERT(hDCScreen != NULL);
|
||||||
{
|
|
||||||
return FALSE;
|
/* 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);
|
hDC = CreateCompatibleDC(hDCScreen);
|
||||||
RTEST(hDC != NULL);
|
RTEST(hDC != NULL);
|
||||||
|
|
|
@ -13,8 +13,15 @@ Test_GetClipRgn(PTESTINFO pti)
|
||||||
hDC = GetDC(hWnd);
|
hDC = GetDC(hWnd);
|
||||||
hrgn = CreateRectRgn(0,0,0,0);
|
hrgn = CreateRectRgn(0,0,0,0);
|
||||||
|
|
||||||
|
/* Test invalid DC */
|
||||||
SetLastError(ERROR_SUCCESS);
|
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);
|
ReleaseDC(hWnd, hDC);
|
||||||
DestroyWindow(hWnd);
|
DestroyWindow(hWnd);
|
||||||
|
|
|
@ -2,7 +2,7 @@ INT
|
||||||
Test_SelectObject(PTESTINFO pti)
|
Test_SelectObject(PTESTINFO pti)
|
||||||
{
|
{
|
||||||
HGDIOBJ hOldObj, hNewObj;
|
HGDIOBJ hOldObj, hNewObj;
|
||||||
HDC hScreenDC, hDC;
|
HDC hScreenDC, hDC, hDC2;
|
||||||
PGDI_TABLE_ENTRY pEntry;
|
PGDI_TABLE_ENTRY pEntry;
|
||||||
PDC_ATTR pDc_Attr;
|
PDC_ATTR pDc_Attr;
|
||||||
HANDLE hcmXform;
|
HANDLE hcmXform;
|
||||||
|
@ -35,6 +35,16 @@ Test_SelectObject(PTESTINFO pti)
|
||||||
TEST(pDc_Attr->hbrush == hNewObj);
|
TEST(pDc_Attr->hbrush == hNewObj);
|
||||||
SelectObject(hDC, hOldObj);
|
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 */
|
/* Test wrong hobj handle type */
|
||||||
SetLastError(ERROR_SUCCESS);
|
SetLastError(ERROR_SUCCESS);
|
||||||
hNewObj = GetStockObject(GRAY_BRUSH);
|
hNewObj = GetStockObject(GRAY_BRUSH);
|
||||||
|
|
|
@ -4,7 +4,9 @@ Test_SetDCPenColor(PTESTINFO pti)
|
||||||
HDC hScreenDC, hDC;
|
HDC hScreenDC, hDC;
|
||||||
|
|
||||||
// Test an incorrect DC
|
// Test an incorrect DC
|
||||||
|
SetLastError(ERROR_SUCCESS);
|
||||||
RTEST(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID);
|
RTEST(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID);
|
||||||
|
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||||
|
|
||||||
// Get the Screen DC
|
// Get the Screen DC
|
||||||
hScreenDC = GetDC(NULL);
|
hScreenDC = GetDC(NULL);
|
||||||
|
|
20
rostests/apitests/gdi32api/tests/SetWorldTransform.c
Normal file
20
rostests/apitests/gdi32api/tests/SetWorldTransform.c
Normal 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;
|
||||||
|
}
|
Loading…
Reference in a new issue