mirror of
https://github.com/reactos/reactos.git
synced 2025-05-18 00:31:27 +00:00
- Tests for Compact, TestCooperativeLevel, Initialize, GetDisplayMode, RestoreDisplayMode
- Merge GetMonitorFrequency Test with other Display Mode Tests svn path=/trunk/; revision=26810
This commit is contained in:
parent
d64da71c44
commit
3fa5e74711
2 changed files with 26 additions and 30 deletions
|
@ -18,6 +18,7 @@ BOOL Test_CreateDDraw (INT* passed, INT* failed)
|
|||
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) == DD_OK);
|
||||
if(DirectDraw)
|
||||
{
|
||||
TEST (DirectDraw->Initialize(NULL) == DDERR_ALREADYINITIALIZED);
|
||||
TEST (DirectDraw->Release() == 0);
|
||||
}
|
||||
|
||||
|
@ -65,9 +66,13 @@ BOOL Test_SetCooperativeLevel (INT* passed, INT* failed)
|
|||
TEST ( DirectDraw->SetCooperativeLevel ((HWND)0xdeadbeef, DDSCL_NORMAL) == DDERR_INVALIDPARAMS);
|
||||
|
||||
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) == DD_OK);
|
||||
TEST ( DirectDraw->Compact() == DD_OK );
|
||||
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX) == DD_OK);
|
||||
TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_NORMAL) == DD_OK );
|
||||
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL) == DD_OK );
|
||||
TEST ( DirectDraw->Compact() == DDERR_NOEXCLUSIVEMODE );
|
||||
|
||||
TEST ( DirectDraw->TestCooperativeLevel() == DD_OK ); // I do not get what this API does it always seems to return DD_OK
|
||||
|
||||
DirectDraw->Release();
|
||||
|
||||
|
|
|
@ -12,12 +12,24 @@ HRESULT CALLBACK DummyEnumDisplayModes( LPDDSURFACEDESC2 pDDSD, ENUMCONTEXT* Con
|
|||
|
||||
HRESULT CALLBACK EnumDisplayModes( LPDDSURFACEDESC2 pDDSD, ENUMCONTEXT* Context )
|
||||
{
|
||||
DWORD lpdwFrequency = 0;
|
||||
INT* passed = Context->passed;
|
||||
INT* failed = Context->failed;
|
||||
static int setcout = 0;
|
||||
|
||||
DDSURFACEDESC2 DisplayMode = {0};
|
||||
DisplayMode.dwSize = sizeof(DDSURFACEDESC2);
|
||||
|
||||
if(setcout < 5)
|
||||
{
|
||||
TEST ( Context->DirectDraw->SetDisplayMode (pDDSD->dwWidth, pDDSD->dwHeight, pDDSD->ddpfPixelFormat.dwRGBBitCount, pDDSD->dwRefreshRate, 0) == DD_OK);
|
||||
TEST ( Context->DirectDraw->GetMonitorFrequency (&lpdwFrequency) == DD_OK && lpdwFrequency == pDDSD->dwRefreshRate);
|
||||
TEST ( Context->DirectDraw->GetDisplayMode (&DisplayMode) == DD_OK
|
||||
&& pDDSD->dwWidth == DisplayMode.dwHeight
|
||||
&& pDDSD->dwWidth == DisplayMode.dwWidth
|
||||
&& pDDSD->dwRefreshRate == DisplayMode.dwRefreshRate
|
||||
&& pDDSD->ddpfPixelFormat.dwRGBBitCount == DisplayMode.ddpfPixelFormat.dwRGBBitCount);
|
||||
|
||||
}
|
||||
setcout++;
|
||||
return DDENUMRET_OK;
|
||||
|
@ -39,52 +51,31 @@ BOOL Test_DisplayModes (INT* passed, INT* failed)
|
|||
|
||||
/* The Test */
|
||||
|
||||
// First try with some generic display modes
|
||||
/* First try with some generic display modes */
|
||||
TEST ( DirectDraw->SetDisplayMode (1586, 895, 0, 0, 0) == DDERR_UNSUPPORTED );
|
||||
TEST ( DirectDraw->SetDisplayMode (0, 0, 0, 0, 0x123) == DDERR_INVALIDPARAMS );
|
||||
|
||||
// does this change the display mode to DDSCL_EXCLUSIVE ?
|
||||
TEST ( DirectDraw->SetDisplayMode (0, 0, 0, 0, 0) == DD_OK );
|
||||
TEST ( DirectDraw->SetDisplayMode (800, 600, 0, 0, 0) == DD_OK );
|
||||
TEST ( DirectDraw->SetDisplayMode (0, 0, 16, 0, 0) == DD_OK );
|
||||
|
||||
// does this change the display mode to DDSCL_EXCLUSIVE ?
|
||||
TEST ( DirectDraw->GetMonitorFrequency (NULL) == DDERR_INVALIDPARAMS );
|
||||
TEST ( DirectDraw->GetDisplayMode (NULL) == DDERR_INVALIDPARAMS );
|
||||
DDSURFACEDESC2 DisplayMode = {0};
|
||||
TEST ( DirectDraw->GetDisplayMode (&DisplayMode) == DDERR_INVALIDPARAMS );
|
||||
|
||||
// Now try getting vaild modes from driver
|
||||
//* Now try getting vaild modes from drive */
|
||||
TEST (DirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, (PVOID)&Context, NULL) == DDERR_INVALIDPARAMS);
|
||||
TEST (DirectDraw->EnumDisplayModes(0, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)DummyEnumDisplayModes) == DD_OK );
|
||||
TEST (DirectDraw->EnumDisplayModes(DDEDM_REFRESHRATES, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)DummyEnumDisplayModes) == DD_OK );
|
||||
TEST (DirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)DummyEnumDisplayModes) == DD_OK );
|
||||
TEST (DirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES|DDEDM_REFRESHRATES, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)EnumDisplayModes) == DD_OK);
|
||||
|
||||
TEST (DirectDraw->RestoreDisplayMode() == DD_OK);
|
||||
|
||||
DirectDraw->Release();
|
||||
|
||||
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