mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 15:38:37 +00:00
Add lots of test cases for the CreateSurface API. See caps_tests.h for more info.
svn path=/trunk/; revision=27189
This commit is contained in:
parent
355f43c264
commit
0dfb900085
2 changed files with 2349 additions and 177 deletions
2311
rostests/dxtest/ddraw/Surface/caps_tests.h
Normal file
2311
rostests/dxtest/ddraw/Surface/caps_tests.h
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,9 +1,31 @@
|
|||
HWND CreateBasicWindow (VOID);
|
||||
|
||||
|
||||
LPDIRECTDRAW7 DirectDraw;
|
||||
|
||||
BOOL TestCaps (char* dummy, DWORD Caps, HRESULT test1, HRESULT test2)
|
||||
{
|
||||
LPDIRECTDRAWSURFACE7 Surface = NULL;
|
||||
DDSURFACEDESC2 Desc = { 0 };
|
||||
Desc.dwHeight = 200;
|
||||
Desc.dwWidth = 200;
|
||||
Desc.dwSize = sizeof (DDSURFACEDESC2);
|
||||
Desc.ddsCaps.dwCaps = Caps;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
BOOL ret = DirectDraw->CreateSurface(&Desc, &Surface, NULL) == test1;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
ret = ret && DirectDraw->CreateSurface(&Desc, &Surface, NULL) == test2;
|
||||
|
||||
if ( Surface )
|
||||
Surface->Release();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL Test_CreateSurface (INT* passed, INT* failed)
|
||||
{
|
||||
LPDIRECTDRAW7 DirectDraw;
|
||||
LPDIRECTDRAWSURFACE7 DirectDrawSurface = NULL;
|
||||
LPDIRECTDRAWSURFACE7 Surface = NULL;
|
||||
HWND hwnd;
|
||||
|
||||
/* Preparations */
|
||||
|
@ -12,6 +34,8 @@ BOOL Test_CreateSurface (INT* passed, INT* failed)
|
|||
printf("ERROR: Failed to set up ddraw\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
TEST ( DirectDraw->CreateSurface(NULL, NULL, NULL) == DDERR_NOCOOPERATIVELEVELSET);
|
||||
|
||||
if(!( hwnd = CreateBasicWindow() ))
|
||||
{
|
||||
|
@ -28,183 +52,20 @@ BOOL Test_CreateSurface (INT* passed, INT* failed)
|
|||
}
|
||||
|
||||
/* 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);
|
||||
Desc.dwHeight = 200;
|
||||
Desc.dwWidth = 200;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.dwSize = sizeof (DDSURFACEDESC2);
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_3DDEVICE;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_ALLOCONLOAD;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_ALPHA;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_COMPLEX;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_FLIP;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_FRONTBUFFER;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_HWCODEC;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_LIVEVIDEO;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_LOCALVIDMEM;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_MIPMAP;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_MODEX;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_NONLOCALVIDMEM;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_OPTIMIZED;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_OVERLAY;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
#if 0
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
||||
DirectDrawSurface = NULL;
|
||||
#endif
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_OWNDC;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_UNSUPPORTED);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_PALETTE;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK );
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_STANDARDVGAMODE;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
DirectDrawSurface = NULL;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK );
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_VIDEOPORT;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
||||
DirectDrawSurface = NULL;
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_VISIBLE;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_WRITEONLY;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDCAPS);
|
||||
|
||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
||||
Desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER;
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
||||
|
||||
DirectDraw->Release();
|
||||
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &Surface, (IUnknown*)0xdeadbeef) == CLASS_E_NOAGGREGATION );
|
||||
TEST ( DirectDraw->CreateSurface(NULL, &Surface, NULL) == DDERR_INVALIDPARAMS );
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, NULL, NULL) == DDERR_INVALIDPARAMS );
|
||||
TEST ( DirectDraw->CreateSurface(&Desc, &Surface, NULL) == DDERR_INVALIDPARAMS );
|
||||
|
||||
// Test (nearly) all possible cap combinations
|
||||
#include "caps_tests.h"
|
||||
|
||||
DirectDraw->Release();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue