Beginning of CreateSurface test.

svn path=/trunk/; revision=26755
This commit is contained in:
Maarten Bosma 2007-05-13 16:37:58 +00:00
parent f9560fb69d
commit e37697709f
3 changed files with 51 additions and 1 deletions

View file

@ -7,13 +7,15 @@
/* include the tests */
#include "tests/CreateDDraw.cpp"
#include "tests/DisplayModes.cpp"
#include "tests/CreateSurface.cpp"
/* The List of tests */
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 }, // uncomment this test if you have enough time and patience
{ "IDirectDraw::CreateSurface", Test_CreateSurface }
};
/* The function that gives us the number of tests */

View file

@ -0,0 +1,46 @@
HWND CreateBasicWindow (VOID);
BOOL Test_CreateSurface (INT* passed, INT* failed)
{
LPDIRECTDRAW7 DirectDraw;
LPDIRECTDRAWSURFACE7 DirectDrawSurface;
HWND hwnd;
/* 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;
}
if (DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL) != DD_OK)
{
printf("ERROR: you not set cooperative level\n");
DirectDraw->Release();
return 0;
}
/* The Test */
DDSURFACEDESC2 Desc = { 0 };
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, (IUnknown*)0xdeadbeef) == CLASS_E_NOAGGREGATION );
TEST ( DirectDraw->CreateSurface(NULL, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS );
TEST ( DirectDraw->CreateSurface(&Desc, NULL, NULL) == DDERR_INVALIDPARAMS );
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS );
Desc.dwSize = sizeof (DDSURFACEDESC2);
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS );
DirectDraw->Release();
return TRUE;
}

View file

@ -42,6 +42,8 @@ BOOL Test_DisplayModes (INT* passed, INT* failed)
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 ?
// Now try getting vaild modes from driver
TEST (DirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, (PVOID)&Context, NULL) == DDERR_INVALIDPARAMS);
TEST (DirectDraw->EnumDisplayModes(0, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)DummyEnumDisplayModes) == DD_OK );