Author: mbosma
Date: Sun May 13 21:31:35 2007
New Revision: 26758
URL:
http://svn.reactos.org/svn/reactos?rev=26758&view=rev
Log:
- Release Ddraw Object Test_CreateDDraw
- First Surface Test of many to follow
- GetMonitorFrequency and whitespace changes by EmuandCo
Modified:
trunk/rostests/dxtest/ddraw/debug.cpp
trunk/rostests/dxtest/ddraw/testlist.cpp
trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp
trunk/rostests/dxtest/ddraw/tests/CreateSurface.cpp
trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp
Modified: trunk/rostests/dxtest/ddraw/debug.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/debug.cpp?re…
==============================================================================
--- trunk/rostests/dxtest/ddraw/debug.cpp (original)
+++ trunk/rostests/dxtest/ddraw/debug.cpp Sun May 13 21:31:35 2007
@@ -5,7 +5,7 @@
{
switch (hResult)
{
- case DD_OK: return "DD_OK";
+ case DD_OK: return "DD_OK";
case DDERR_ALREADYINITIALIZED: return "DDERR_ALREADYINITIALIZED";
case DDERR_CANNOTATTACHSURFACE: return "DDERR_CANNOTATTACHSURFACE";
case DDERR_CANNOTDETACHSURFACE: return "DDERR_CANNOTDETACHSURFACE";
Modified: trunk/rostests/dxtest/ddraw/testlist.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/testlist.cpp…
==============================================================================
--- trunk/rostests/dxtest/ddraw/testlist.cpp (original)
+++ trunk/rostests/dxtest/ddraw/testlist.cpp Sun May 13 21:31:35 2007
@@ -15,7 +15,8 @@
{ "DirectDrawCreate(Ex)", Test_CreateDDraw },
{ "IDirectDraw::SetCooperativeLevel", Test_SetCooperativeLevel },
// { "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes }, //
uncomment this test if you have enough time and patience
- { "IDirectDraw::CreateSurface", Test_CreateSurface }
+ { "IDirectDraw::CreateSurface", Test_CreateSurface },
+ { "IDirectDraw::GetMonitorFrequency", Test_GetMonitorFrequency },
};
/* The function that gives us the number of tests */
Modified: trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/Create…
==============================================================================
--- trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp (original)
+++ trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp Sun May 13 21:31:35 2007
@@ -4,8 +4,8 @@
BOOL Test_CreateDDraw (INT* passed, INT* failed)
{
- LPDIRECTDRAW7 DirectDraw;
- IDirectDraw* DirectDraw2;
+ LPDIRECTDRAW7 DirectDraw = NULL;
+ IDirectDraw* DirectDraw2 = NULL;
/*** FIXME: Test first parameter using EnumDisplayDrivers ***/
@@ -13,16 +13,19 @@
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw4, NULL) ==
DDERR_INVALIDPARAMS);
TEST (DirectDrawCreateEx(NULL, NULL, IID_IDirectDraw7, NULL) == DDERR_INVALIDPARAMS);
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) ==
DD_OK);
+ TEST (DirectDraw && DirectDraw->Release());
TEST (DirectDrawCreate(NULL ,&DirectDraw2, NULL) == DD_OK);
+ TEST (DirectDraw2 && DirectDraw2->Release());
+
return TRUE;
}
BOOL Test_SetCooperativeLevel (INT* passed, INT* failed)
{
- HWND hwnd;
+ HWND hwnd;
LPDIRECTDRAW7 DirectDraw;
-
+
/* Preparations */
if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK)
{
@@ -36,9 +39,10 @@
DirectDraw->Release();
return FALSE;
}
-
+
/* The Test */
TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_FULLSCREEN) ==
DDERR_INVALIDPARAMS );
+ TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN) ==
DDERR_INVALIDPARAMS );
TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) ==
DDERR_INVALIDPARAMS );
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN) ==
DDERR_INVALIDPARAMS);
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL | DDSCL_ALLOWMODEX) ==
DDERR_INVALIDPARAMS );
@@ -54,27 +58,27 @@
return TRUE;
}
-LONG WINAPI BasicWindowProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)
-{
+LONG WINAPI BasicWindowProc (HWND hwnd, UINT message, UINT wParam, LONG lParam)
+{
switch (message)
{
case WM_DESTROY:
{
- PostQuitMessage (0);
+ PostQuitMessage (0);
return 0;
} break;
}
return DefWindowProc (hwnd, message, wParam, lParam);
-}
+}
HWND CreateBasicWindow (VOID)
{
WNDCLASS wndclass = {0};
wndclass.lpfnWndProc = BasicWindowProc;
wndclass.hInstance = GetModuleHandle(NULL);
- wndclass.lpszClassName = "DDrawTest";
- RegisterClass(&wndclass);
+ wndclass.lpszClassName = "DDrawTest";
+ RegisterClass(&wndclass);
return CreateWindow("DDrawTest", "ReactOS DirectDraw Test",
WS_POPUP, 0, 0, 10, 10, NULL, NULL, GetModuleHandle(NULL), NULL);
}
Modified: trunk/rostests/dxtest/ddraw/tests/CreateSurface.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/Create…
==============================================================================
--- trunk/rostests/dxtest/ddraw/tests/CreateSurface.cpp (original)
+++ trunk/rostests/dxtest/ddraw/tests/CreateSurface.cpp Sun May 13 21:31:35 2007
@@ -4,7 +4,7 @@
BOOL Test_CreateSurface (INT* passed, INT* failed)
{
LPDIRECTDRAW7 DirectDraw;
- LPDIRECTDRAWSURFACE7 DirectDrawSurface;
+ LPDIRECTDRAWSURFACE7 DirectDrawSurface = NULL;
HWND hwnd;
/* Preparations */
@@ -40,7 +40,17 @@
Desc.dwSize = sizeof (DDSURFACEDESC2);
TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) ==
DDERR_INVALIDPARAMS );
+ Desc.dwFlags = DDSD_CAPS;
+ Desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
+ TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK
);
+ TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK );
+
+ DirectDrawSurface = NULL;
+ Desc.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER;
+ TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DD_OK
);
+ TEST ( DirectDrawSurface && DirectDrawSurface->Release() == DD_OK );
+
DirectDraw->Release();
return TRUE;
-}
+}
Modified: trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/Displa…
==============================================================================
--- trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp (original)
+++ trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp Sun May 13 21:31:35 2007
@@ -22,7 +22,7 @@
{
/*** FIXME: Also test with surface as parameter; try busy/locked surface as well ***/
LPDIRECTDRAW7 DirectDraw;
-
+
/* Preparations */
if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK)
{
@@ -34,12 +34,12 @@
/* The Test */
- // First try with some generic display modes
+ // First try with some generic display modes
TEST ( DirectDraw->SetDisplayMode (1586, 895, 0, 0, 0) == DDERR_UNSUPPORTED );
TEST ( DirectDraw->SetDisplayMode (0, 0, 0, 0, 0x123) == DDERR_INVALIDPARAMS );
TEST ( DirectDraw->SetDisplayMode (0, 0, 0, 0, 0) == DD_OK );
- TEST ( DirectDraw->SetDisplayMode (800, 600, 0, 0, 0) == DD_OK );
+ TEST ( DirectDraw->SetDisplayMode (800, 600, 0, 0, 0) == DD_OK );
TEST ( DirectDraw->SetDisplayMode (0, 0, 16, 0, 0) == DD_OK );
// does this change the display mode to DDSCL_EXCLUSIVE ?
@@ -55,3 +55,31 @@
return TRUE;
}
+
+BOOL Test_GetMonitorFrequency (INT* passed, INT* failed)
+{
+ HWND hwnd;
+ DWORD lpdwFrequency;
+ LPDIRECTDRAW7 DirectDraw;
+
+ /* Preparations */
+ if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) != DD_OK)
+ {
+ printf("ERROR: Failed to set up ddraw\n");
+ return FALSE;
+ }
+
+ if(!( hwnd = CreateBasicWindow() ))
+ {
+ printf("ERROR: Failed to create window\n");
+ DirectDraw->Release();
+ return FALSE;
+ }
+
+ /* The Test */
+ TEST ( DirectDraw->GetMonitorFrequency (NULL) == DDERR_INVALIDPARAMS );
+ TEST ( DirectDraw->GetMonitorFrequency (&lpdwFrequency) == DD_OK );
+ TEST ( lpdwFrequency != 0 );
+
+ return TRUE;
+}