- Add tests for NtGdiSelectBitmap, NtGdiSelectBrush, NtGdiSelectFont and NtGdiSelectPen
svn path=/trunk/; revision=30904
{
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);
--- /dev/null
+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;
+}
+
--- /dev/null
+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;
+}
+
--- /dev/null
+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;
+}
+
--- /dev/null
+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;
+}
#include "ntgdi/NtGdiEnumFontOpen.c"\r
#include "ntgdi/NtGdiGetBitmapBits.c"\r
#include "ntgdi/NtGdiGetRandomRgn.c"\r
+#include "ntgdi/NtGdiSelectBitmap.c"\r
+#include "ntgdi/NtGdiSelectBrush.c"\r
+#include "ntgdi/NtGdiSelectFont.c"\r
+#include "ntgdi/NtGdiSelectPen.c"\r
#include "ntgdi/NtGdiSetBitmapBits.c"\r
//#include "ntgdi/NtGdiSTROBJ_vEnumStart.c"\r
#include "ntgdi/NtGdiGetDIBits.c"\r
{ L"NtGdiGetBitmapBits", Test_NtGdiGetBitmapBits },\r
{ L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn },\r
{ L"NtGdiSetBitmapBits", Test_NtGdiSetBitmapBits },\r
+ { L"NtGdiSelectBitmap", Test_NtGdiSelectBitmap },\r
+ { L"NtGdiSelectBrush", Test_NtGdiSelectBrush },\r
+ { L"NtGdiSelectFont", Test_NtGdiSelectFont },\r
+ { L"NtGdiSelectPen", Test_NtGdiSelectPen },\r
// { L"NtGdiSTROBJ_vEnumStart", Test_NtGdiSTROBJ_vEnumStart },\r
{ L"NtGdiGetDIBitsInternal", Test_NtGdiGetDIBitsInternal },\r
\r