[WIN32KNT_APITEST:NTDD] Improve failure handling
[reactos.git] / modules / rostests / apitests / win32nt / ntdd / NtGdiDdDeleteDirectDrawObject.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for NtGdiDdDeleteDirectDrawObject
5 * PROGRAMMERS:
6 */
7
8 #include <win32nt.h>
9
10 START_TEST(NtGdiDdDeleteDirectDrawObject)
11 {
12 HANDLE hDirectDraw;
13 HDC hdc = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
14 ok(hdc != NULL, "CreateDCW() failed\n");
15
16 ok(NtGdiDdDeleteDirectDrawObject(NULL) == FALSE,
17 "NtGdiDdDeleteDirectDrawObject() succeeded on NULL object\n");
18
19 if (hdc == NULL)
20 {
21 skip("No DC\n");
22 return;
23 }
24
25 hDirectDraw = NtGdiDdCreateDirectDrawObject(hdc);
26 ok(hDirectDraw != NULL, "NtGdiDdCreateDirectDrawObject() failed\n");
27
28 if (hDirectDraw == NULL)
29 {
30 skip("No DirectDrawObject\n");
31 ok(DeleteDC(hdc) != 0, "DeleteDC() failed\n");
32 return;
33 }
34
35 ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == TRUE,
36 "NtGdiDdDeleteDirectDrawObject() failed on existing object\n");
37 ok(NtGdiDdDeleteDirectDrawObject(hDirectDraw) == FALSE,
38 "NtGdiDdDeleteDirectDrawObject() succeeded on deleted object\n");
39
40 ok(DeleteDC(hdc) != 0, "DeleteDC() failed\n");
41 }