mirror of
https://github.com/reactos/reactos.git
synced 2026-07-03 20:34:24 +08:00
- another test for NtGdiBitBlt
- Add tests for NtGdiSelectBitmap, NtGdiSelectBrush, NtGdiSelectFont and NtGdiSelectPen svn path=/trunk/; revision=30904
This commit is contained in:
@@ -4,6 +4,12 @@ Test_NtGdiBitBlt(PTESTINFO pti)
|
||||
{
|
||||
BOOL bRet;
|
||||
|
||||
/* Test NULL dc */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
bRet = NtGdiBitBlt((HDC)0, 0, 0, 10, 10, (HDC)0, 10, 10, SRCCOPY, 0, 0);
|
||||
TEST(bRet == FALSE);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid dc */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
bRet = NtGdiBitBlt((HDC)0x123456, 0, 0, 10, 10, (HDC)0x123456, 10, 10, SRCCOPY, 0, 0);
|
||||
|
||||
49
rostests/apitests/w32knapi/ntgdi/NtGdiSelectBitmap.c
Normal file
49
rostests/apitests/w32knapi/ntgdi/NtGdiSelectBitmap.c
Normal file
@@ -0,0 +1,49 @@
|
||||
INT
|
||||
Test_NtGdiSelectBitmap(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
HBITMAP hBmp, hOldBmp;
|
||||
|
||||
hDC = CreateCompatibleDC(GetDC(NULL));
|
||||
ASSERT(hDC);
|
||||
|
||||
hBmp = CreateBitmap(2,2,1,1,NULL);
|
||||
|
||||
/* Test NULL DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBmp = NtGdiSelectBitmap(NULL, hBmp);
|
||||
TEST(hOldBmp == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBmp = NtGdiSelectBitmap((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBmp);
|
||||
TEST(hOldBmp == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, NULL);
|
||||
TEST(hOldBmp == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, (HBITMAP)((ULONG_PTR)hBmp & 0x0000ffff));
|
||||
TEST(hOldBmp == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, hBmp);
|
||||
TEST(hOldBmp != NULL);
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, hOldBmp);
|
||||
TEST(hOldBmp == hBmp);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hBmp);
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
47
rostests/apitests/w32knapi/ntgdi/NtGdiSelectBrush.c
Normal file
47
rostests/apitests/w32knapi/ntgdi/NtGdiSelectBrush.c
Normal file
@@ -0,0 +1,47 @@
|
||||
INT
|
||||
Test_NtGdiSelectBrush(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
HBRUSH hBrush, hOldBrush;
|
||||
|
||||
hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
|
||||
|
||||
hBrush = GetStockObject(GRAY_BRUSH);
|
||||
|
||||
/* Test NULL DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBrush = NtGdiSelectBrush(NULL, hBrush);
|
||||
TEST(hOldBrush == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBrush = NtGdiSelectBrush((HDC)((ULONG_PTR)hDC & 0x0000ffff), hBrush);
|
||||
TEST(hOldBrush == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL brush */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBrush = NtGdiSelectBrush(hDC, NULL);
|
||||
TEST(hOldBrush == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid brush */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBrush = NtGdiSelectBrush(hDC, (HBRUSH)((ULONG_PTR)hBrush & 0x0000ffff));
|
||||
TEST(hOldBrush == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBrush = NtGdiSelectBrush(hDC, hBrush);
|
||||
TEST(hOldBrush != NULL);
|
||||
hOldBrush = NtGdiSelectBrush(hDC, hOldBrush);
|
||||
TEST(hOldBrush == hBrush);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
47
rostests/apitests/w32knapi/ntgdi/NtGdiSelectFont.c
Normal file
47
rostests/apitests/w32knapi/ntgdi/NtGdiSelectFont.c
Normal file
@@ -0,0 +1,47 @@
|
||||
INT
|
||||
Test_NtGdiSelectFont(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
HFONT hFont, hOldFont;
|
||||
|
||||
hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
|
||||
|
||||
hFont = GetStockObject(DEFAULT_GUI_FONT);
|
||||
|
||||
/* Test NULL DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldFont = NtGdiSelectFont(NULL, hFont);
|
||||
TEST(hOldFont == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldFont = NtGdiSelectFont((HDC)((ULONG_PTR)hDC & 0x0000ffff), hFont);
|
||||
TEST(hOldFont == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL font */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldFont = NtGdiSelectFont(hDC, NULL);
|
||||
TEST(hOldFont == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid font */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldFont = NtGdiSelectFont(hDC, (HFONT)((ULONG_PTR)hFont & 0x0000ffff));
|
||||
TEST(hOldFont == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldFont = NtGdiSelectFont(hDC, hFont);
|
||||
TEST(hOldFont != NULL);
|
||||
hOldFont = NtGdiSelectFont(hDC, hOldFont);
|
||||
TEST(hOldFont == hFont);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
46
rostests/apitests/w32knapi/ntgdi/NtGdiSelectPen.c
Normal file
46
rostests/apitests/w32knapi/ntgdi/NtGdiSelectPen.c
Normal file
@@ -0,0 +1,46 @@
|
||||
INT
|
||||
Test_NtGdiSelectPen(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
HPEN hPen, hOldPen;
|
||||
|
||||
hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
|
||||
|
||||
hPen = GetStockObject(WHITE_PEN);
|
||||
|
||||
/* Test NULL DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPen = NtGdiSelectPen(NULL, hPen);
|
||||
TEST(hOldPen == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPen = NtGdiSelectPen((HDC)((ULONG_PTR)hDC & 0x0000ffff), hPen);
|
||||
TEST(hOldPen == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPen = NtGdiSelectPen(hDC, NULL);
|
||||
TEST(hOldPen == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff));
|
||||
TEST(hOldPen == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPen = NtGdiSelectPen(hDC, hPen);
|
||||
TEST(hOldPen != NULL);
|
||||
hOldPen = NtGdiSelectPen(hDC, hOldPen);
|
||||
TEST(hOldPen == hPen);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
@@ -16,6 +16,10 @@
|
||||
#include "ntgdi/NtGdiEnumFontOpen.c"
|
||||
#include "ntgdi/NtGdiGetBitmapBits.c"
|
||||
#include "ntgdi/NtGdiGetRandomRgn.c"
|
||||
#include "ntgdi/NtGdiSelectBitmap.c"
|
||||
#include "ntgdi/NtGdiSelectBrush.c"
|
||||
#include "ntgdi/NtGdiSelectFont.c"
|
||||
#include "ntgdi/NtGdiSelectPen.c"
|
||||
#include "ntgdi/NtGdiSetBitmapBits.c"
|
||||
//#include "ntgdi/NtGdiSTROBJ_vEnumStart.c"
|
||||
#include "ntgdi/NtGdiGetDIBits.c"
|
||||
@@ -46,6 +50,10 @@ TESTENTRY TestList[] =
|
||||
{ L"NtGdiGetBitmapBits", Test_NtGdiGetBitmapBits },
|
||||
{ L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn },
|
||||
{ L"NtGdiSetBitmapBits", Test_NtGdiSetBitmapBits },
|
||||
{ L"NtGdiSelectBitmap", Test_NtGdiSelectBitmap },
|
||||
{ L"NtGdiSelectBrush", Test_NtGdiSelectBrush },
|
||||
{ L"NtGdiSelectFont", Test_NtGdiSelectFont },
|
||||
{ L"NtGdiSelectPen", Test_NtGdiSelectPen },
|
||||
// { L"NtGdiSTROBJ_vEnumStart", Test_NtGdiSTROBJ_vEnumStart },
|
||||
{ L"NtGdiGetDIBitsInternal", Test_NtGdiGetDIBitsInternal },
|
||||
|
||||
|
||||
Reference in New Issue
Block a user