Add some win32k/gdi DC tests created by Jerome Gardou
authorGregor Schneider <grschneider@gmail.com>
Sat, 8 May 2010 16:27:36 +0000 (16:27 +0000)
committerGregor Schneider <grschneider@gmail.com>
Sat, 8 May 2010 16:27:36 +0000 (16:27 +0000)
svn path=/trunk/; revision=47128

rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c
rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c

index a53821b..3597eb6 100644 (file)
@@ -22,6 +22,8 @@ Test_NtGdiCreateCompatibleDC(PTESTINFO pti)
        hObj = SelectObject(hDC, GetStockObject(WHITE_PEN));
        TEST(hObj == GetStockObject(BLACK_PEN));
 
        hObj = SelectObject(hDC, GetStockObject(WHITE_PEN));
        TEST(hObj == GetStockObject(BLACK_PEN));
 
+       TEST(NtGdiDeleteObjectApp(hDC) != 0);
+
        return APISTATUS_NORMAL;
 }
 
        return APISTATUS_NORMAL;
 }
 
index ef4daa2..0084b10 100644 (file)
@@ -16,7 +16,7 @@ Test_NtGdiDeleteObjectApp(PTESTINFO pti)
     TEST(NtGdiDeleteObjectApp((PVOID)(GDI_HANDLE_STOCK_MASK | 0x1234)) == 1);
     TEST(GetLastError() == 0);
 
     TEST(NtGdiDeleteObjectApp((PVOID)(GDI_HANDLE_STOCK_MASK | 0x1234)) == 1);
     TEST(GetLastError() == 0);
 
-    /* Delete a DC */
+    /* Delete a compatible DC */
     SetLastError(0);
     hdc = CreateCompatibleDC(NULL);
     ASSERT(IsHandleValid(hdc) == 1);
     SetLastError(0);
     hdc = CreateCompatibleDC(NULL);
     ASSERT(IsHandleValid(hdc) == 1);
@@ -24,6 +24,26 @@ Test_NtGdiDeleteObjectApp(PTESTINFO pti)
     TEST(GetLastError() == 0);
     TEST(IsHandleValid(hdc) == 0);
 
     TEST(GetLastError() == 0);
     TEST(IsHandleValid(hdc) == 0);
 
+    /* Delete a display DC */
+    SetLastError(0);
+    hdc = CreateDC("DISPLAY", NULL, NULL, NULL);
+    ASSERT(IsHandleValid(hdc) == 1);
+    TEST(NtGdiDeleteObjectApp(hdc) != 0);
+    TEST(GetLastError() == 0);
+    TEST(IsHandleValid(hdc) == 1);
+    TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL);
+    TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError());
+
+    /* Once more */
+    SetLastError(0);
+    hdc = GetDC(0);
+    ASSERT(IsHandleValid(hdc) == 1);
+    TEST(NtGdiDeleteObjectApp(hdc) != 0);
+    TEST(GetLastError() == 0);
+    TEST(IsHandleValid(hdc) == 1);
+    TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL);
+    TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError());
+
     /* Delete a brush */
     SetLastError(0);
     hbrush = CreateSolidBrush(0x123456);
     /* Delete a brush */
     SetLastError(0);
     hbrush = CreateSolidBrush(0x123456);