mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
SetCooperativeLevel Test
svn path=/trunk/; revision=26749
This commit is contained in:
parent
b955734dc0
commit
ba36cacf56
2 changed files with 65 additions and 3 deletions
|
@ -9,7 +9,8 @@
|
|||
/* The List of tests */
|
||||
TEST TestList[] =
|
||||
{
|
||||
{ "CreateDDraw", Test_CreateDDraw }
|
||||
{ "DirectDrawCreate(Ex)", Test_CreateDDraw },
|
||||
{ "IDirectDraw::SetCooperativeLevel", Test_SetCooperativeLevel }
|
||||
};
|
||||
|
||||
/* The function that gives us the number of tests */
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
#include "ddrawtest.h"
|
||||
|
||||
PCHAR DDErrorString (HRESULT hResult);
|
||||
HWND CreateBasicWindow (VOID);
|
||||
|
||||
BOOL Test_CreateDDraw (INT* passed, INT* failed)
|
||||
{
|
||||
LPDIRECTDRAW7 DirectDraw;
|
||||
IDirectDraw* DirectDraw2;
|
||||
|
||||
// FIXME: Test first parameter
|
||||
/*** FIXME: Test first parameter ***/
|
||||
|
||||
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, (IUnknown*)0xdeadbeef) == CLASS_E_NOAGGREGATION);
|
||||
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw4, NULL) == DDERR_INVALIDPARAMS);
|
||||
|
@ -17,3 +17,64 @@ BOOL Test_CreateDDraw (INT* passed, INT* failed)
|
|||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL Test_SetCooperativeLevel (INT* passed, INT* failed)
|
||||
{
|
||||
HWND hwnd;
|
||||
LPDIRECTDRAW7 DirectDraw;
|
||||
|
||||
/* Preparations */
|
||||
if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK)
|
||||
{
|
||||
printf("ERROR: Failed to set up ddraw\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!( hwnd = CreateBasicWindow() ))
|
||||
{
|
||||
printf("ERROR: Failed to create window\n");
|
||||
DirectDraw->Release();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* The Test */
|
||||
TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_FULLSCREEN) == DDERR_INVALIDPARAMS );
|
||||
TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) == DDERR_INVALIDPARAMS );
|
||||
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL | DDSCL_ALLOWMODEX) == DDERR_INVALIDPARAMS );
|
||||
TEST ( DirectDraw->SetCooperativeLevel ((HWND)0xdeadbeef, DDSCL_NORMAL) == DDERR_INVALIDPARAMS);
|
||||
|
||||
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) == DD_OK);
|
||||
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX) == DD_OK);
|
||||
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL | DDSCL_FULLSCREEN) == DD_OK);
|
||||
TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_NORMAL) == DD_OK );
|
||||
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL) == DD_OK );
|
||||
|
||||
DirectDraw->Release();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LONG WINAPI BasicWindowProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)
|
||||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_DESTROY:
|
||||
{
|
||||
PostQuitMessage (0);
|
||||
return 0;
|
||||
} break;
|
||||
}
|
||||
|
||||
return DefWindowProc (hwnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
HWND CreateBasicWindow (VOID)
|
||||
{
|
||||
WNDCLASS wndclass = {0};
|
||||
wndclass.lpfnWndProc = BasicWindowProc;
|
||||
wndclass.hInstance = GetModuleHandle(NULL);
|
||||
wndclass.lpszClassName = "DDrawTest";
|
||||
RegisterClass(&wndclass);
|
||||
|
||||
return CreateWindow("DDrawTest", "ReactOS DirectDraw Test", WS_POPUP, 0, 0, 10, 10, NULL, NULL, GetModuleHandle(NULL), NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue