3 Test_NtGdiDeleteObjectApp(PTESTINFO pti
)
12 TEST(NtGdiDeleteObjectApp(0) == 0);
13 TEST(GetLastError() == 0);
15 /* Try to delete something with a stockbit */
17 TEST(NtGdiDeleteObjectApp((PVOID
)(GDI_HANDLE_STOCK_MASK
| 0x1234)) == 1);
18 TEST(GetLastError() == 0);
20 /* Delete a compatible DC */
22 hdc
= CreateCompatibleDC(NULL
);
23 ASSERT(IsHandleValid(hdc
) == 1);
24 TEST(NtGdiDeleteObjectApp(hdc
) == 1);
25 TEST(GetLastError() == 0);
26 TEST(IsHandleValid(hdc
) == 0);
28 /* Delete a display DC */
30 hdc
= CreateDC("DISPLAY", NULL
, NULL
, NULL
);
31 ASSERT(IsHandleValid(hdc
) == 1);
32 TEST((hpen
=SelectObject(hdc
, GetStockObject(WHITE_PEN
))) != NULL
);
33 SelectObject(hdc
, hpen
);
34 TEST(NtGdiDeleteObjectApp(hdc
) != 0);
35 TEST(GetLastError() == 0);
36 TEST(IsHandleValid(hdc
) == 1);
37 TEST(SelectObject(hdc
, GetStockObject(WHITE_PEN
)) == NULL
);
38 TESTX(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError());
43 ASSERT(IsHandleValid(hdc
) == 1);
44 TEST(NtGdiDeleteObjectApp(hdc
) != 0);
45 TEST(GetLastError() == 0);
46 TEST(IsHandleValid(hdc
) == 1);
47 TEST(SelectObject(hdc
, GetStockObject(WHITE_PEN
)) == NULL
);
48 TESTX(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLasterror returned 0x%08x\n", (unsigned int)GetLastError());
50 TEST(NtUserCallOneParam((DWORD_PTR
)hdc
, ONEPARAM_ROUTINE_RELEASEDC
) == 0);
54 hbrush
= CreateSolidBrush(0x123456);
55 ASSERT(IsHandleValid(hbrush
) == 1);
56 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
57 TEST(GetLastError() == 0);
58 TEST(IsHandleValid(hbrush
) == 0);
60 /* Try to delete a stock brush */
62 hbrush
= GetStockObject(BLACK_BRUSH
);
63 ASSERT(IsHandleValid(hbrush
) == 1);
64 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
65 TEST(GetLastError() == 0);
66 TEST(IsHandleValid(hbrush
) == 1);
70 hbmp
= CreateBitmap(10, 10, 1, 1, NULL
);
71 ASSERT(IsHandleValid(hbmp
) == 1);
72 TEST(NtGdiDeleteObjectApp(hbmp
) == 1);
73 TEST(GetLastError() == 0);
74 TEST(IsHandleValid(hbmp
) == 0);
76 /* Create a DC for further use */
77 hdc
= CreateCompatibleDC(NULL
);
80 /* Try to delete a brush that is selected into a DC */
82 hbrush
= CreateSolidBrush(0x123456);
83 ASSERT(IsHandleValid(hbrush
) == 1);
84 TEST(NtGdiSelectBrush(hdc
, hbrush
));
85 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
86 TEST(GetLastError() == 0);
87 TEST(IsHandleValid(hbrush
) == 1);
89 /* Try to delete a bitmap that is selected into a DC */
91 hbmp
= CreateBitmap(10, 10, 1, 1, NULL
);
92 ASSERT(IsHandleValid(hbmp
) == 1);
93 TEST(NtGdiSelectBitmap(hdc
, hbmp
));
95 TEST(NtGdiDeleteObjectApp(hbmp
) == 1);
96 TEST(GetLastError() == 0);
97 TEST(IsHandleValid(hbmp
) == 1);
99 /* Bitmap get's deleted as soon as we dereference it */
100 NtGdiSelectBitmap(hdc
, GetStockObject(DEFAULT_BITMAP
));
101 TEST(IsHandleValid(hbmp
) == 0);
103 TEST(NtGdiDeleteObjectApp(hbmp
) == 1);
104 TEST(GetLastError() == 0);
105 TEST(IsHandleValid(hbmp
) == 0);
107 /* Try to delete a brush that is selected into a DC */
109 hbrush
= CreateSolidBrush(123);
110 ASSERT(IsHandleValid(hbrush
) == 1);
111 TEST(NtGdiSelectBrush(hdc
, hbrush
));
113 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
114 TEST(GetLastError() == 0);
115 TEST(IsHandleValid(hbrush
) == 1);
117 return APISTATUS_NORMAL
;