3 Test_NtGdiDeleteObjectApp(PTESTINFO pti
)
11 TEST(NtGdiDeleteObjectApp(0) == 0);
12 TEST(GetLastError() == 0);
14 /* Try to delete something with a stockbit */
16 TEST(NtGdiDeleteObjectApp((PVOID
)(GDI_HANDLE_STOCK_MASK
| 0x1234)) == 1);
17 TEST(GetLastError() == 0);
21 hdc
= CreateCompatibleDC(NULL
);
22 ASSERT(IsHandleValid(hdc
) == 1);
23 TEST(NtGdiDeleteObjectApp(hdc
) == 1);
24 TEST(GetLastError() == 0);
25 TEST(IsHandleValid(hdc
) == 0);
29 hbrush
= CreateSolidBrush(0x123456);
30 ASSERT(IsHandleValid(hbrush
) == 1);
31 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
32 TEST(GetLastError() == 0);
33 TEST(IsHandleValid(hbrush
) == 0);
35 /* Try to delete a stock brush */
37 hbrush
= GetStockObject(BLACK_BRUSH
);
38 ASSERT(IsHandleValid(hbrush
) == 1);
39 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
40 TEST(GetLastError() == 0);
41 TEST(IsHandleValid(hbrush
) == 1);
45 hbmp
= CreateBitmap(10, 10, 1, 1, NULL
);
46 ASSERT(IsHandleValid(hbmp
) == 1);
47 TEST(NtGdiDeleteObjectApp(hbmp
) == 1);
48 TEST(GetLastError() == 0);
49 TEST(IsHandleValid(hbmp
) == 0);
51 /* Create a DC for further use */
52 hdc
= CreateCompatibleDC(NULL
);
55 /* Try to delete a brush that is selected into a DC */
57 hbrush
= CreateSolidBrush(0x123456);
58 ASSERT(IsHandleValid(hbrush
) == 1);
59 TEST(NtGdiSelectBrush(hdc
, hbrush
));
60 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
61 TEST(GetLastError() == 0);
62 TEST(IsHandleValid(hbrush
) == 1);
64 /* Try to delete a bitmap that is selected into a DC */
66 hbmp
= CreateBitmap(10, 10, 1, 1, NULL
);
67 ASSERT(IsHandleValid(hbmp
) == 1);
68 TEST(NtGdiSelectBitmap(hdc
, hbmp
));
70 TEST(NtGdiDeleteObjectApp(hbmp
) == 1);
71 TEST(GetLastError() == 0);
72 TEST(IsHandleValid(hbmp
) == 1);
74 /* Bitmap get's deleted as soon as we dereference it */
75 NtGdiSelectBitmap(hdc
, GetStockObject(DEFAULT_BITMAP
));
76 TEST(IsHandleValid(hbmp
) == 0);
78 TEST(NtGdiDeleteObjectApp(hbmp
) == 1);
79 TEST(GetLastError() == 0);
80 TEST(IsHandleValid(hbmp
) == 0);
82 /* Try to delete a brush that is selected into a DC */
84 hbrush
= CreateSolidBrush(123);
85 ASSERT(IsHandleValid(hbrush
) == 1);
86 TEST(NtGdiSelectBrush(hdc
, hbrush
));
88 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
89 TEST(GetLastError() == 0);
90 TEST(IsHandleValid(hbrush
) == 1);
92 return APISTATUS_NORMAL
;