adding a big freq test

svn path=/trunk/; revision=27059
This commit is contained in:
Magnus Olsen 2007-06-07 19:03:11 +00:00
parent e86c5c5ce0
commit a5b4c11371
4 changed files with 56 additions and 0 deletions

View file

@ -5,7 +5,11 @@
#include <stdio.h>
#include <windows.h>
#include <stdio.h>
#include <ddraw.h>
#include <ddrawi.h>
#include <d3dhal.h>
#include <ddrawgdi.h>
#define TEST(x) \
if (x)\

View file

@ -13,6 +13,7 @@
TEST TestList[] =
{
{ "IDirectDraw: COM Stuff", Test_CreateDDraw },
{ "IDirectDraw: Display Frequency", Test_GetMonitorFrequency },
{ "IDirectDraw: Display Modes", Test_DisplayModes },
{ "IDirectDraw: Available Video Memory", Test_GetAvailableVidMem },
{ "IDirectDraw: GetFourCC", Test_GetFourCCCodes },

View file

@ -132,6 +132,9 @@ BOOL Test_GetFourCCCodes (INT* passed, INT* failed)
return TRUE;
}
LONG WINAPI BasicWindowProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)
{
switch (message)

View file

@ -81,3 +81,51 @@ BOOL Test_DisplayModes (INT* passed, INT* failed)
return TRUE;
}
BOOL Test_GetMonitorFrequency (INT* passed, INT* failed)
{
LPDIRECTDRAW7 DirectDraw;
LPDDRAWI_DIRECTDRAW_INT This;
/* Preparations */
if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK)
{
printf("ERROR: Failed to set up ddraw\n");
return FALSE;
}
This = (LPDDRAWI_DIRECTDRAW_INT)DirectDraw;
/* Here we go */
DWORD lpFreq;
DWORD temp;
HRESULT retVal;
TEST (DirectDraw->GetMonitorFrequency((PDWORD)0xdeadbeef) == DDERR_INVALIDPARAMS);
TEST (DirectDraw->GetMonitorFrequency(NULL) == DDERR_INVALIDPARAMS);
/* This test depns on which graphice card you have */
retVal = DirectDraw->GetMonitorFrequency((PDWORD)&lpFreq);
if ( retVal == DDERR_UNSUPPORTED)
{
retVal = DD_OK;
}
TEST ( retVal == DD_OK);
/* hacking testing */
/* shall return DDERR_UNSUPPORTED */
This->lpLcl->lpGbl->dwMonitorFrequency = 0;
TEST (DirectDraw->GetMonitorFrequency(&temp) == DDERR_UNSUPPORTED);
/* shall return DD_OK */
This->lpLcl->lpGbl->dwMonitorFrequency = 85;
TEST (DirectDraw->GetMonitorFrequency(&temp) == DD_OK);
/* restore */
This->lpLcl->lpGbl->dwMonitorFrequency = lpFreq;
DirectDraw->Release();
return TRUE;
}