[ros-diffs] [mbosma] 26810: - Tests for Compact, TestCooperativeLevel, Initialize, GetDisplayMode, RestoreDisplayMode - Merge GetMonitorFrequency Test with other Display Mode Tests

mbosma at svn.reactos.org mbosma at svn.reactos.org
Wed May 16 22:42:34 CEST 2007


Author: mbosma
Date: Thu May 17 00:42:33 2007
New Revision: 26810

URL: http://svn.reactos.org/svn/reactos?rev=26810&view=rev
Log:
- Tests for Compact, TestCooperativeLevel, Initialize, GetDisplayMode, RestoreDisplayMode
- Merge GetMonitorFrequency Test with other Display Mode Tests

Modified:
    trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp
    trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp

Modified: trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp?rev=26810&r1=26809&r2=26810&view=diff
==============================================================================
--- trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp (original)
+++ trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp Thu May 17 00:42:33 2007
@@ -18,6 +18,7 @@
 	TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) == DD_OK);
 	if(DirectDraw)
 	{
+		TEST (DirectDraw->Initialize(NULL) == DDERR_ALREADYINITIALIZED);
 		TEST (DirectDraw->Release() == 0);
 	}
 
@@ -65,9 +66,13 @@
 	TEST ( DirectDraw->SetCooperativeLevel ((HWND)0xdeadbeef, DDSCL_NORMAL) == DDERR_INVALIDPARAMS);
 
 	TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) == DD_OK);
+	TEST ( DirectDraw->Compact() == DD_OK );
 	TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_ALLOWMODEX) == DD_OK);
 	TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_NORMAL) == DD_OK );
 	TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL) == DD_OK );
+	TEST ( DirectDraw->Compact() == DDERR_NOEXCLUSIVEMODE );
+
+	TEST ( DirectDraw->TestCooperativeLevel() == DD_OK ); // I do not get what this API does it always seems to return DD_OK
 
 	DirectDraw->Release();
 

Modified: trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp?rev=26810&r1=26809&r2=26810&view=diff
==============================================================================
--- trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp (original)
+++ trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp Thu May 17 00:42:33 2007
@@ -12,12 +12,24 @@
 
 HRESULT CALLBACK EnumDisplayModes( LPDDSURFACEDESC2 pDDSD, ENUMCONTEXT* Context )
 {
+	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->dwWidth == DisplayMode.dwHeight 
+			&& pDDSD->dwWidth == DisplayMode.dwWidth 
+			&& pDDSD->dwRefreshRate == DisplayMode.dwRefreshRate
+			&& pDDSD->ddpfPixelFormat.dwRGBBitCount == DisplayMode.ddpfPixelFormat.dwRGBBitCount);
+
 	}
 	setcout++;
 	return DDENUMRET_OK;
@@ -39,52 +51,31 @@
 
 	/* 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 );
 
+	// does this change the display mode to DDSCL_EXCLUSIVE ?
 	TEST ( DirectDraw->SetDisplayMode (0, 0, 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 ?
+	TEST ( DirectDraw->GetMonitorFrequency (NULL) == DDERR_INVALIDPARAMS );
+	TEST ( DirectDraw->GetDisplayMode (NULL) == DDERR_INVALIDPARAMS );
+	DDSURFACEDESC2 DisplayMode = {0};
+	TEST ( DirectDraw->GetDisplayMode (&DisplayMode) == DDERR_INVALIDPARAMS );
 
-	// Now try getting vaild modes from driver
+	//* Now try getting vaild modes from drive */
 	TEST (DirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, (PVOID)&Context, NULL) == DDERR_INVALIDPARAMS);
 	TEST (DirectDraw->EnumDisplayModes(0, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)DummyEnumDisplayModes) == DD_OK );
 	TEST (DirectDraw->EnumDisplayModes(DDEDM_REFRESHRATES, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)DummyEnumDisplayModes) == DD_OK );
 	TEST (DirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)DummyEnumDisplayModes) == DD_OK );
 	TEST (DirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES|DDEDM_REFRESHRATES, NULL, (PVOID)&Context, (LPDDENUMMODESCALLBACK2)EnumDisplayModes) == DD_OK);
 
+	TEST (DirectDraw->RestoreDisplayMode() == DD_OK);
+
 	DirectDraw->Release();
+
 
 	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;
-}




More information about the Ros-diffs mailing list