diff --git a/rostests/dxtest/ddraw/ddrawtest.h b/rostests/dxtest/ddraw/ddrawtest.h index 6e2464aee49..78f3190170f 100644 --- a/rostests/dxtest/ddraw/ddrawtest.h +++ b/rostests/dxtest/ddraw/ddrawtest.h @@ -5,7 +5,11 @@ #include #include +#include #include +#include +#include +#include #define TEST(x) \ if (x)\ diff --git a/rostests/dxtest/ddraw/testlist.cpp b/rostests/dxtest/ddraw/testlist.cpp index 1c9fbe1ccb1..54043063b9a 100644 --- a/rostests/dxtest/ddraw/testlist.cpp +++ b/rostests/dxtest/ddraw/testlist.cpp @@ -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 }, diff --git a/rostests/dxtest/ddraw/tests/CreateDDraw.cpp b/rostests/dxtest/ddraw/tests/CreateDDraw.cpp index ec7a71cb6b3..e1ecfa20268 100644 --- a/rostests/dxtest/ddraw/tests/CreateDDraw.cpp +++ b/rostests/dxtest/ddraw/tests/CreateDDraw.cpp @@ -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) diff --git a/rostests/dxtest/ddraw/tests/DisplayModes.cpp b/rostests/dxtest/ddraw/tests/DisplayModes.cpp index e77a8ef03db..641a1b5793f 100644 --- a/rostests/dxtest/ddraw/tests/DisplayModes.cpp +++ b/rostests/dxtest/ddraw/tests/DisplayModes.cpp @@ -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; +}