3b06a250acf4ae23756358a732e8b54772ce4fd1
3 HWND
CreateBasicWindow (VOID
);
5 BOOL
Test_CreateDDraw (INT
* passed
, INT
* failed
)
7 LPDIRECTDRAW7 DirectDraw
;
8 IDirectDraw
* DirectDraw2
;
10 /*** FIXME: Test first parameter using EnumDisplayDrivers ***/
11 DirectDrawCreateEx(NULL
, (VOID
**)&DirectDraw
, IID_IDirectDraw7
, NULL
);
13 TEST (DirectDrawCreateEx(NULL
, (VOID
**)&DirectDraw
, IID_IDirectDraw7
, (IUnknown
*)0xdeadbeef) == CLASS_E_NOAGGREGATION
);
14 TEST (DirectDrawCreateEx(NULL
, (VOID
**)&DirectDraw
, IID_IDirectDraw4
, NULL
) == DDERR_INVALIDPARAMS
);
15 TEST (DirectDrawCreateEx(NULL
, NULL
, IID_IDirectDraw7
, NULL
) == DDERR_INVALIDPARAMS
);
18 TEST (DirectDrawCreateEx(NULL
, (VOID
**)&DirectDraw
, IID_IDirectDraw7
, NULL
) == DD_OK
);
21 TEST (DirectDraw
->Initialize(NULL
) == DDERR_ALREADYINITIALIZED
);
22 TEST (DirectDraw
->Release() == 0);
26 TEST (DirectDrawCreate(NULL
,&DirectDraw2
, NULL
) == DD_OK
);
29 TEST (DirectDraw2
->QueryInterface(IID_IDirectDraw7
, (PVOID
*)&DirectDraw
) == 0);
30 TEST (DirectDraw2
->AddRef() == 2);
31 TEST (DirectDraw
->AddRef() == 2);
32 TEST (DirectDraw
->Release() == 1);
33 TEST (DirectDraw
->Release() == 0);
34 TEST (DirectDraw2
->Release() == 1);
35 TEST (DirectDraw2
->Release() == 0);
41 BOOL
Test_SetCooperativeLevel (INT
* passed
, INT
* failed
)
44 LPDIRECTDRAW7 DirectDraw
;
47 if (DirectDrawCreateEx(NULL
, (VOID
**)&DirectDraw
, IID_IDirectDraw7
, NULL
) != DD_OK
)
49 printf("ERROR: Failed to set up ddraw\n");
53 if(!( hwnd
= CreateBasicWindow() ))
55 printf("ERROR: Failed to create window\n");
56 DirectDraw
->Release();
61 TEST ( DirectDraw
->SetCooperativeLevel (NULL
, DDSCL_FULLSCREEN
) == DDERR_INVALIDPARAMS
);
62 TEST ( DirectDraw
->SetCooperativeLevel (hwnd
, DDSCL_FULLSCREEN
) == DDERR_INVALIDPARAMS
);
63 TEST ( DirectDraw
->SetCooperativeLevel (NULL
, DDSCL_FULLSCREEN
| DDSCL_EXCLUSIVE
) == DDERR_INVALIDPARAMS
);
64 TEST ( DirectDraw
->SetCooperativeLevel (hwnd
, DDSCL_FULLSCREEN
) == DDERR_INVALIDPARAMS
);
65 TEST ( DirectDraw
->SetCooperativeLevel (hwnd
, DDSCL_NORMAL
| DDSCL_ALLOWMODEX
) == DDERR_INVALIDPARAMS
);
66 TEST ( DirectDraw
->SetCooperativeLevel ((HWND
)0xdeadbeef, DDSCL_NORMAL
) == DDERR_INVALIDPARAMS
);
68 TEST ( DirectDraw
->SetCooperativeLevel (hwnd
, DDSCL_FULLSCREEN
| DDSCL_EXCLUSIVE
) == DD_OK
);
69 TEST ( DirectDraw
->Compact() == DD_OK
);
70 TEST ( DirectDraw
->SetCooperativeLevel (hwnd
, DDSCL_FULLSCREEN
| DDSCL_EXCLUSIVE
| DDSCL_ALLOWMODEX
) == DD_OK
);
71 TEST ( DirectDraw
->SetCooperativeLevel (NULL
, DDSCL_NORMAL
) == DD_OK
);
72 TEST ( DirectDraw
->SetCooperativeLevel (hwnd
, DDSCL_NORMAL
) == DD_OK
);
73 TEST ( DirectDraw
->Compact() == DDERR_NOEXCLUSIVEMODE
);
75 TEST ( DirectDraw
->TestCooperativeLevel() == DD_OK
); // I do not get what this API does it always seems to return DD_OK
77 DirectDraw
->Release();
82 BOOL
Test_GetAvailableVidMem (INT
* passed
, INT
* failed
)
84 LPDIRECTDRAW7 DirectDraw
;
87 if (DirectDrawCreateEx(NULL
, (VOID
**)&DirectDraw
, IID_IDirectDraw7
, NULL
) != DD_OK
)
89 printf("ERROR: Failed to set up ddraw\n");
95 DDSCAPS2 Caps
= { 0 };
96 TEST (DirectDraw
->GetAvailableVidMem(&Caps
, NULL
, NULL
) == DDERR_INVALIDPARAMS
);
97 TEST (DirectDraw
->GetAvailableVidMem(NULL
, &Total
, &Free
) == DDERR_INVALIDPARAMS
);
98 TEST (DirectDraw
->GetAvailableVidMem(&Caps
, &Total
, &Free
) == DD_OK
&& Total
== 0 && Free
== 0 );
100 Caps
.dwCaps
= DDSCAPS_VIDEOMEMORY
;
101 TEST (DirectDraw
->GetAvailableVidMem(&Caps
, &Total
, &Free
) == DD_OK
);
103 DirectDraw
->Release();
108 LONG WINAPI
BasicWindowProc (HWND hwnd
, UINT message
, UINT wParam
, LONG lParam
)
119 return DefWindowProc (hwnd
, message
, wParam
, lParam
);
122 HWND
CreateBasicWindow (VOID
)
124 WNDCLASS wndclass
= {0};
125 wndclass
.lpfnWndProc
= BasicWindowProc
;
126 wndclass
.hInstance
= GetModuleHandle(NULL
);
127 wndclass
.lpszClassName
= "DDrawTest";
128 RegisterClass(&wndclass
);
130 return CreateWindow("DDrawTest", "ReactOS DirectDraw Test", WS_POPUP
, 0, 0, 10, 10, NULL
, NULL
, GetModuleHandle(NULL
), NULL
);