mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:53:07 +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);
|
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)
|
BOOL Test_CreateSurface (INT* passed, INT* failed)
|
||||||
{
|
{
|
||||||
LPDIRECTDRAW7 DirectDraw;
|
LPDIRECTDRAWSURFACE7 Surface = NULL;
|
||||||
LPDIRECTDRAWSURFACE7 DirectDrawSurface = NULL;
|
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
|
||||||
/* Preparations */
|
/* Preparations */
|
||||||
|
@ -13,6 +35,8 @@ BOOL Test_CreateSurface (INT* passed, INT* failed)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST ( DirectDraw->CreateSurface(NULL, NULL, NULL) == DDERR_NOCOOPERATIVELEVELSET);
|
||||||
|
|
||||||
if(!( hwnd = CreateBasicWindow() ))
|
if(!( hwnd = CreateBasicWindow() ))
|
||||||
{
|
{
|
||||||
printf("ERROR: Failed to create window\n");
|
printf("ERROR: Failed to create window\n");
|
||||||
|
@ -28,181 +52,18 @@ BOOL Test_CreateSurface (INT* passed, INT* failed)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The Test */
|
/* The Test */
|
||||||
|
|
||||||
DDSURFACEDESC2 Desc = { 0 };
|
DDSURFACEDESC2 Desc = { 0 };
|
||||||
|
Desc.dwSize = sizeof (DDSURFACEDESC2);
|
||||||
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.dwHeight = 200;
|
Desc.dwHeight = 200;
|
||||||
Desc.dwWidth = 200;
|
Desc.dwWidth = 200;
|
||||||
|
|
||||||
Desc.dwFlags = DDSD_CAPS;
|
TEST ( DirectDraw->CreateSurface(&Desc, &Surface, (IUnknown*)0xdeadbeef) == CLASS_E_NOAGGREGATION );
|
||||||
Desc.dwSize = sizeof (DDSURFACEDESC2);
|
TEST ( DirectDraw->CreateSurface(NULL, &Surface, NULL) == DDERR_INVALIDPARAMS );
|
||||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS);
|
TEST ( DirectDraw->CreateSurface(&Desc, NULL, NULL) == DDERR_INVALIDPARAMS );
|
||||||
Desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
|
TEST ( DirectDraw->CreateSurface(&Desc, &Surface, NULL) == DDERR_INVALIDPARAMS );
|
||||||
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK);
|
|
||||||
TEST ( DirectDrawSurface && DirectDrawSurface->Release() == 0 );
|
|
||||||
DirectDrawSurface = NULL;
|
|
||||||
|
|
||||||
Desc.dwFlags = DDSD_CAPS;
|
// Test (nearly) all possible cap combinations
|
||||||
Desc.ddsCaps.dwCaps = DDSCAPS_3DDEVICE;
|
#include "caps_tests.h"
|
||||||
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();
|
DirectDraw->Release();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue