- Enable display mode tests but do not tests all of them, but only the first five onces.

- Add tests for AddRef, QueryInterface, Release

svn path=/trunk/; revision=26809
This commit is contained in:
Maarten Bosma 2007-05-16 18:57:21 +00:00
parent e2ad78e62d
commit d64da71c44
3 changed files with 28 additions and 6 deletions

View file

@ -14,7 +14,7 @@ TEST TestList[] =
{
{ "DirectDrawCreate(Ex)", Test_CreateDDraw },
{ "IDirectDraw::SetCooperativeLevel", Test_SetCooperativeLevel },
// { "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes }, // uncomment this test if you have enough time and patience
{ "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes },
{ "IDirectDraw::CreateSurface", Test_CreateSurface },
{ "IDirectDraw::GetMonitorFrequency", Test_GetMonitorFrequency },
};

View file

@ -4,18 +4,35 @@ HWND CreateBasicWindow (VOID);
BOOL Test_CreateDDraw (INT* passed, INT* failed)
{
LPDIRECTDRAW7 DirectDraw = NULL;
IDirectDraw* DirectDraw2 = NULL;
LPDIRECTDRAW7 DirectDraw;
IDirectDraw* DirectDraw2;
/*** FIXME: Test first parameter using EnumDisplayDrivers ***/
DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL);
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, (IUnknown*)0xdeadbeef) == CLASS_E_NOAGGREGATION);
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw4, NULL) == DDERR_INVALIDPARAMS);
TEST (DirectDrawCreateEx(NULL, NULL, IID_IDirectDraw7, NULL) == DDERR_INVALIDPARAMS);
DirectDraw = NULL;
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) == DD_OK);
//TEST (DirectDraw && DirectDraw->Release());
if(DirectDraw)
{
TEST (DirectDraw->Release() == 0);
}
DirectDraw2 = NULL;
TEST (DirectDrawCreate(NULL ,&DirectDraw2, NULL) == DD_OK);
//TEST (DirectDraw2 && DirectDraw2->Release());
if(DirectDraw2)
{
TEST (DirectDraw2->QueryInterface(IID_IDirectDraw7, (PVOID*)&DirectDraw) == 0);
TEST (DirectDraw2->AddRef() == 2);
TEST (DirectDraw->AddRef() == 2);
TEST (DirectDraw->Release() == 1);
TEST (DirectDraw->Release() == 0);
TEST (DirectDraw2->Release() == 1);
TEST (DirectDraw2->Release() == 0);
}
return TRUE;
}

View file

@ -14,7 +14,12 @@ HRESULT CALLBACK EnumDisplayModes( LPDDSURFACEDESC2 pDDSD, ENUMCONTEXT* Context
{
INT* passed = Context->passed;
INT* failed = Context->failed;
TEST ( Context->DirectDraw->SetDisplayMode (pDDSD->dwWidth, pDDSD->dwHeight, pDDSD->ddpfPixelFormat.dwRGBBitCount, pDDSD->dwRefreshRate, 0) == DD_OK);
static int setcout = 0;
if(setcout < 5)
{
TEST ( Context->DirectDraw->SetDisplayMode (pDDSD->dwWidth, pDDSD->dwHeight, pDDSD->ddpfPixelFormat.dwRGBBitCount, pDDSD->dwRefreshRate, 0) == DD_OK);
}
setcout++;
return DDENUMRET_OK;
}