mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 20:36:35 +00:00
Test for IDirectDraw7::GetFourCCCodes
svn path=/trunk/; revision=26850
This commit is contained in:
parent
ded6f889ce
commit
16abbb4536
3 changed files with 43 additions and 13 deletions
|
@ -15,6 +15,7 @@ TEST TestList[] =
|
|||
{ "IDirectDraw: COM Stuff", Test_CreateDDraw },
|
||||
{ "IDirectDraw: Display Modes", Test_DisplayModes },
|
||||
{ "IDirectDraw: Available Video Memory", Test_GetAvailableVidMem },
|
||||
{ "IDirectDraw: GetFourCC", Test_GetFourCCCodes },
|
||||
{ "IDirectDraw: Cooperative Levels", Test_SetCooperativeLevel },
|
||||
{ "IDirectDraw: CreateSurface", Test_CreateSurface },
|
||||
};
|
||||
|
|
|
@ -97,6 +97,7 @@ BOOL Test_GetAvailableVidMem (INT* passed, INT* failed)
|
|||
TEST (DirectDraw->GetAvailableVidMem(NULL, &Total, &Free) == DDERR_INVALIDPARAMS);
|
||||
TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK && Total == 0 && Free == 0 );
|
||||
|
||||
// TODO: Try to produce DDERR_INVALIDCAPS
|
||||
Caps.dwCaps = DDSCAPS_VIDEOMEMORY;
|
||||
TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK );
|
||||
|
||||
|
@ -105,6 +106,32 @@ BOOL Test_GetAvailableVidMem (INT* passed, INT* failed)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL Test_GetFourCCCodes (INT* passed, INT* failed)
|
||||
{
|
||||
LPDIRECTDRAW7 DirectDraw;
|
||||
|
||||
/* Preparations */
|
||||
if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK)
|
||||
{
|
||||
printf("ERROR: Failed to set up ddraw\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Here we go */
|
||||
DWORD dwNumCodes, *lpCodes;
|
||||
TEST (DirectDraw->GetFourCCCodes(NULL, NULL) == DDERR_INVALIDPARAMS);
|
||||
TEST ( DirectDraw->GetFourCCCodes(NULL, lpCodes) == DDERR_INVALIDPARAMS );
|
||||
|
||||
TEST (DirectDraw->GetFourCCCodes(&dwNumCodes, NULL) == DD_OK && dwNumCodes);
|
||||
lpCodes = (PDWORD)HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)*dwNumCodes);
|
||||
*lpCodes = 0;
|
||||
TEST (DirectDraw->GetFourCCCodes(&dwNumCodes, lpCodes) == DD_OK && *lpCodes );
|
||||
|
||||
DirectDraw->Release();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
LONG WINAPI BasicWindowProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)
|
||||
{
|
||||
switch (message)
|
||||
|
|
|
@ -12,25 +12,27 @@ HRESULT CALLBACK DummyEnumDisplayModes( LPDDSURFACEDESC2 pDDSD, ENUMCONTEXT* Con
|
|||
|
||||
HRESULT CALLBACK EnumDisplayModes( LPDDSURFACEDESC2 pDDSD, ENUMCONTEXT* Context )
|
||||
{
|
||||
static int setcout = 0;
|
||||
if(setcout >= 5)
|
||||
return DDENUMRET_OK;
|
||||
|
||||
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->dwHeight == DisplayMode.dwHeight
|
||||
&& pDDSD->dwWidth == DisplayMode.dwWidth
|
||||
&& pDDSD->dwRefreshRate == DisplayMode.dwRefreshRate
|
||||
&& pDDSD->ddpfPixelFormat.dwRGBBitCount == DisplayMode.ddpfPixelFormat.dwRGBBitCount);
|
||||
|
||||
}
|
||||
TEST ( pDDSD->dwFlags == DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH | DDSD_PIXELFORMAT | DDSD_REFRESHRATE);
|
||||
TEST ( pDDSD->ddpfPixelFormat.dwFlags == DDPF_RGB | DDPF_PALETTEINDEXED8 || pDDSD->ddpfPixelFormat.dwFlags == DDPF_RGB );
|
||||
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->dwHeight == DisplayMode.dwHeight
|
||||
&& pDDSD->dwWidth == DisplayMode.dwWidth
|
||||
&& pDDSD->dwRefreshRate == DisplayMode.dwRefreshRate
|
||||
&& pDDSD->ddpfPixelFormat.dwRGBBitCount == DisplayMode.ddpfPixelFormat.dwRGBBitCount
|
||||
&& DisplayMode.dwFlags == DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH | DDSD_PIXELFORMAT | DDSD_REFRESHRATE );
|
||||
|
||||
setcout++;
|
||||
return DDENUMRET_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue