mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 04:37:15 +00:00
- Release Ddraw Object Test_CreateDDraw
- First Surface Test of many to follow - GetMonitorFrequency and whitespace changes by EmuandCo svn path=/trunk/; revision=26758
This commit is contained in:
parent
779a784f15
commit
35b29a1d0a
5 changed files with 61 additions and 18 deletions
|
@ -5,7 +5,7 @@ PCHAR DDErrorString (HRESULT hResult)
|
||||||
{
|
{
|
||||||
switch (hResult)
|
switch (hResult)
|
||||||
{
|
{
|
||||||
case DD_OK: return "DD_OK";
|
case DD_OK: return "DD_OK";
|
||||||
case DDERR_ALREADYINITIALIZED: return "DDERR_ALREADYINITIALIZED";
|
case DDERR_ALREADYINITIALIZED: return "DDERR_ALREADYINITIALIZED";
|
||||||
case DDERR_CANNOTATTACHSURFACE: return "DDERR_CANNOTATTACHSURFACE";
|
case DDERR_CANNOTATTACHSURFACE: return "DDERR_CANNOTATTACHSURFACE";
|
||||||
case DDERR_CANNOTDETACHSURFACE: return "DDERR_CANNOTDETACHSURFACE";
|
case DDERR_CANNOTDETACHSURFACE: return "DDERR_CANNOTDETACHSURFACE";
|
||||||
|
|
|
@ -15,7 +15,8 @@ TEST TestList[] =
|
||||||
{ "DirectDrawCreate(Ex)", Test_CreateDDraw },
|
{ "DirectDrawCreate(Ex)", Test_CreateDDraw },
|
||||||
{ "IDirectDraw::SetCooperativeLevel", Test_SetCooperativeLevel },
|
{ "IDirectDraw::SetCooperativeLevel", Test_SetCooperativeLevel },
|
||||||
// { "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes }, // uncomment this test if you have enough time and patience
|
// { "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes }, // uncomment this test if you have enough time and patience
|
||||||
{ "IDirectDraw::CreateSurface", Test_CreateSurface }
|
{ "IDirectDraw::CreateSurface", Test_CreateSurface },
|
||||||
|
{ "IDirectDraw::GetMonitorFrequency", Test_GetMonitorFrequency },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The function that gives us the number of tests */
|
/* The function that gives us the number of tests */
|
||||||
|
|
|
@ -4,8 +4,8 @@ HWND CreateBasicWindow (VOID);
|
||||||
|
|
||||||
BOOL Test_CreateDDraw (INT* passed, INT* failed)
|
BOOL Test_CreateDDraw (INT* passed, INT* failed)
|
||||||
{
|
{
|
||||||
LPDIRECTDRAW7 DirectDraw;
|
LPDIRECTDRAW7 DirectDraw = NULL;
|
||||||
IDirectDraw* DirectDraw2;
|
IDirectDraw* DirectDraw2 = NULL;
|
||||||
|
|
||||||
/*** FIXME: Test first parameter using EnumDisplayDrivers ***/
|
/*** FIXME: Test first parameter using EnumDisplayDrivers ***/
|
||||||
|
|
||||||
|
@ -13,7 +13,10 @@ BOOL Test_CreateDDraw (INT* passed, INT* failed)
|
||||||
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw4, NULL) == DDERR_INVALIDPARAMS);
|
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw4, NULL) == DDERR_INVALIDPARAMS);
|
||||||
TEST (DirectDrawCreateEx(NULL, NULL, IID_IDirectDraw7, NULL) == DDERR_INVALIDPARAMS);
|
TEST (DirectDrawCreateEx(NULL, NULL, IID_IDirectDraw7, NULL) == DDERR_INVALIDPARAMS);
|
||||||
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) == DD_OK);
|
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) == DD_OK);
|
||||||
|
TEST (DirectDraw && DirectDraw->Release());
|
||||||
TEST (DirectDrawCreate(NULL ,&DirectDraw2, NULL) == DD_OK);
|
TEST (DirectDrawCreate(NULL ,&DirectDraw2, NULL) == DD_OK);
|
||||||
|
TEST (DirectDraw2 && DirectDraw2->Release());
|
||||||
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -39,6 +42,7 @@ BOOL Test_SetCooperativeLevel (INT* passed, INT* failed)
|
||||||
|
|
||||||
/* The Test */
|
/* The Test */
|
||||||
TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_FULLSCREEN) == DDERR_INVALIDPARAMS );
|
TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_FULLSCREEN) == DDERR_INVALIDPARAMS );
|
||||||
|
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN) == DDERR_INVALIDPARAMS );
|
||||||
TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) == DDERR_INVALIDPARAMS );
|
TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) == DDERR_INVALIDPARAMS );
|
||||||
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN) == DDERR_INVALIDPARAMS);
|
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN) == DDERR_INVALIDPARAMS);
|
||||||
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL | DDSCL_ALLOWMODEX) == DDERR_INVALIDPARAMS );
|
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL | DDSCL_ALLOWMODEX) == DDERR_INVALIDPARAMS );
|
||||||
|
|
|
@ -4,7 +4,7 @@ HWND CreateBasicWindow (VOID);
|
||||||
BOOL Test_CreateSurface (INT* passed, INT* failed)
|
BOOL Test_CreateSurface (INT* passed, INT* failed)
|
||||||
{
|
{
|
||||||
LPDIRECTDRAW7 DirectDraw;
|
LPDIRECTDRAW7 DirectDraw;
|
||||||
LPDIRECTDRAWSURFACE7 DirectDrawSurface;
|
LPDIRECTDRAWSURFACE7 DirectDrawSurface = NULL;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
|
||||||
/* Preparations */
|
/* Preparations */
|
||||||
|
@ -40,6 +40,16 @@ BOOL Test_CreateSurface (INT* passed, INT* failed)
|
||||||
Desc.dwSize = sizeof (DDSURFACEDESC2);
|
Desc.dwSize = sizeof (DDSURFACEDESC2);
|
||||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS );
|
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS );
|
||||||
|
|
||||||
|
Desc.dwFlags = DDSD_CAPS;
|
||||||
|
Desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||||
|
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK );
|
||||||
|
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK );
|
||||||
|
|
||||||
|
DirectDrawSurface = NULL;
|
||||||
|
Desc.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
|
||||||
|
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK );
|
||||||
|
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK );
|
||||||
|
|
||||||
DirectDraw->Release();
|
DirectDraw->Release();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -55,3 +55,31 @@ BOOL Test_DisplayModes (INT* passed, INT* failed)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL Test_GetMonitorFrequency (INT* passed, INT* failed)
|
||||||
|
{
|
||||||
|
HWND hwnd;
|
||||||
|
DWORD lpdwFrequency;
|
||||||
|
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->GetMonitorFrequency (NULL) == DDERR_INVALIDPARAMS );
|
||||||
|
TEST ( DirectDraw->GetMonitorFrequency (&lpdwFrequency) == DD_OK );
|
||||||
|
TEST ( lpdwFrequency != 0 );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue