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);
19 /* Delete a compatible DC */
21 hdc
= CreateCompatibleDC(NULL
);
22 ASSERT(IsHandleValid(hdc
) == 1);
23 TEST(NtGdiDeleteObjectApp(hdc
) == 1);
24 TEST(GetLastError() == 0);
25 TEST(IsHandleValid(hdc
) == 0);
27 /* Delete a display DC */
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());
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());
49 hbrush
= CreateSolidBrush(0x123456);
50 ASSERT(IsHandleValid(hbrush
) == 1);
51 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
52 TEST(GetLastError() == 0);
53 TEST(IsHandleValid(hbrush
) == 0);
55 /* Try to delete a stock brush */
57 hbrush
= GetStockObject(BLACK_BRUSH
);
58 ASSERT(IsHandleValid(hbrush
) == 1);
59 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
60 TEST(GetLastError() == 0);
61 TEST(IsHandleValid(hbrush
) == 1);
65 hbmp
= CreateBitmap(10, 10, 1, 1, NULL
);
66 ASSERT(IsHandleValid(hbmp
) == 1);
67 TEST(NtGdiDeleteObjectApp(hbmp
) == 1);
68 TEST(GetLastError() == 0);
69 TEST(IsHandleValid(hbmp
) == 0);
71 /* Create a DC for further use */
72 hdc
= CreateCompatibleDC(NULL
);
75 /* Try to delete a brush that is selected into a DC */
77 hbrush
= CreateSolidBrush(0x123456);
78 ASSERT(IsHandleValid(hbrush
) == 1);
79 TEST(NtGdiSelectBrush(hdc
, hbrush
));
80 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
81 TEST(GetLastError() == 0);
82 TEST(IsHandleValid(hbrush
) == 1);
84 /* Try to delete a bitmap that is selected into a DC */
86 hbmp
= CreateBitmap(10, 10, 1, 1, NULL
);
87 ASSERT(IsHandleValid(hbmp
) == 1);
88 TEST(NtGdiSelectBitmap(hdc
, hbmp
));
90 TEST(NtGdiDeleteObjectApp(hbmp
) == 1);
91 TEST(GetLastError() == 0);
92 TEST(IsHandleValid(hbmp
) == 1);
94 /* Bitmap get's deleted as soon as we dereference it */
95 NtGdiSelectBitmap(hdc
, GetStockObject(DEFAULT_BITMAP
));
96 TEST(IsHandleValid(hbmp
) == 0);
98 TEST(NtGdiDeleteObjectApp(hbmp
) == 1);
99 TEST(GetLastError() == 0);
100 TEST(IsHandleValid(hbmp
) == 0);
102 /* Try to delete a brush that is selected into a DC */
104 hbrush
= CreateSolidBrush(123);
105 ASSERT(IsHandleValid(hbrush
) == 1);
106 TEST(NtGdiSelectBrush(hdc
, hbrush
));
108 TEST(NtGdiDeleteObjectApp(hbrush
) == 1);
109 TEST(GetLastError() == 0);
110 TEST(IsHandleValid(hbrush
) == 1);
112 return APISTATUS_NORMAL
;