adding a big freq test
authorMagnus Olsen <magnus@greatlord.com>
Thu, 7 Jun 2007 19:03:11 +0000 (19:03 +0000)
committerMagnus Olsen <magnus@greatlord.com>
Thu, 7 Jun 2007 19:03:11 +0000 (19:03 +0000)
svn path=/trunk/; revision=27059

rostests/dxtest/ddraw/ddrawtest.h
rostests/dxtest/ddraw/testlist.cpp
rostests/dxtest/ddraw/tests/CreateDDraw.cpp
rostests/dxtest/ddraw/tests/DisplayModes.cpp

index 6e2464a..78f3190 100644 (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)\
index 1c9fbe1..5404306 100644 (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 },
index ec7a71c..e1ecfa2 100644 (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)
index e77a8ef..641a1b5 100644 (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;
+}