1 HWND
CreateBasicWindow (VOID
);
3 LPDIRECTDRAW7 DirectDraw
;
5 BOOL
TestCaps (char* dummy
, DWORD Caps
, HRESULT test1
, HRESULT test2
)
7 LPDIRECTDRAWSURFACE7 Surface
= NULL
;
8 DDSURFACEDESC2 Desc
= { 0 };
11 Desc
.dwSize
= sizeof (DDSURFACEDESC2
);
12 Desc
.ddsCaps
.dwCaps
= Caps
;
14 Desc
.dwFlags
= DDSD_CAPS
;
15 BOOL ret
= DirectDraw
->CreateSurface(&Desc
, &Surface
, NULL
) == test1
;
17 Desc
.dwFlags
= DDSD_CAPS
| DDSD_HEIGHT
| DDSD_WIDTH
;
18 ret
= ret
&& DirectDraw
->CreateSurface(&Desc
, &Surface
, NULL
) == test2
;
26 BOOL
Test_CreateSurface (INT
* passed
, INT
* failed
)
28 LPDIRECTDRAWSURFACE7 Surface
= NULL
;
32 if (DirectDrawCreateEx(NULL
, (VOID
**)&DirectDraw
, IID_IDirectDraw7
, NULL
) != DD_OK
)
34 printf("ERROR: Failed to set up ddraw\n");
38 TEST ( DirectDraw
->CreateSurface(NULL
, NULL
, NULL
) == DDERR_NOCOOPERATIVELEVELSET
);
40 if(!( hwnd
= CreateBasicWindow() ))
42 printf("ERROR: Failed to create window\n");
43 DirectDraw
->Release();
47 if (DirectDraw
->SetCooperativeLevel (hwnd
, DDSCL_NORMAL
) != DD_OK
)
49 printf("ERROR: Could not set cooperative level\n");
50 DirectDraw
->Release();
55 DDSURFACEDESC2 Desc
= { 0 };
56 Desc
.dwSize
= sizeof (DDSURFACEDESC2
);
60 TEST ( DirectDraw
->CreateSurface(&Desc
, &Surface
, (IUnknown
*)0xdeadbeef) == CLASS_E_NOAGGREGATION
);
61 TEST ( DirectDraw
->CreateSurface(NULL
, &Surface
, NULL
) == DDERR_INVALIDPARAMS
);
62 TEST ( DirectDraw
->CreateSurface(&Desc
, NULL
, NULL
) == DDERR_INVALIDPARAMS
);
63 TEST ( DirectDraw
->CreateSurface(&Desc
, &Surface
, NULL
) == DDERR_INVALIDPARAMS
);
65 // Test (nearly) all possible cap combinations
66 #include "caps_tests.h"
68 DirectDraw
->Release();