Skip to content

Commit 0963ef8

Browse files
committed
Add some win32k/gdi DC tests created by Jerome Gardou
svn path=/trunk/; revision=47128
1 parent 4545e03 commit 0963ef8

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Test_NtGdiCreateCompatibleDC(PTESTINFO pti)
2222
hObj = SelectObject(hDC, GetStockObject(WHITE_PEN));
2323
TEST(hObj == GetStockObject(BLACK_PEN));
2424

25+
TEST(NtGdiDeleteObjectApp(hDC) != 0);
26+
2527
return APISTATUS_NORMAL;
2628
}
2729

rostests/apitests/w32knapi/ntgdi/NtGdiDeleteObjectApp.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,34 @@ Test_NtGdiDeleteObjectApp(PTESTINFO pti)
1616
TEST(NtGdiDeleteObjectApp((PVOID)(GDI_HANDLE_STOCK_MASK | 0x1234)) == 1);
1717
TEST(GetLastError() == 0);
1818

19-
/* Delete a DC */
19+
/* Delete a compatible DC */
2020
SetLastError(0);
2121
hdc = CreateCompatibleDC(NULL);
2222
ASSERT(IsHandleValid(hdc) == 1);
2323
TEST(NtGdiDeleteObjectApp(hdc) == 1);
2424
TEST(GetLastError() == 0);
2525
TEST(IsHandleValid(hdc) == 0);
2626

27+
/* Delete a display DC */
28+
SetLastError(0);
29+
hdc = CreateDC("DISPLAY", NULL, NULL, NULL);
30+
ASSERT(IsHandleValid(hdc) == 1);
31+
TEST(NtGdiDeleteObjectApp(hdc) != 0);
32+
TEST(GetLastError() == 0);
33+
TEST(IsHandleValid(hdc) == 1);
34+
TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL);
35+
TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError());
36+
37+
/* Once more */
38+
SetLastError(0);
39+
hdc = GetDC(0);
40+
ASSERT(IsHandleValid(hdc) == 1);
41+
TEST(NtGdiDeleteObjectApp(hdc) != 0);
42+
TEST(GetLastError() == 0);
43+
TEST(IsHandleValid(hdc) == 1);
44+
TEST(SelectObject(hdc, GetStockObject(WHITE_PEN)) == NULL);
45+
TESTX(GetLastError() == ERROR_INVALID_PARAMETER, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError());
46+
2747
/* Delete a brush */
2848
SetLastError(0);
2949
hbrush = CreateSolidBrush(0x123456);

0 commit comments

Comments
 (0)