[ros-diffs] [mbosma] 26809: - Enable display mode tests but do not tests all of them, but only the first five onces. - Add tests for AddRef, QueryInterface, Release

mbosma at svn.reactos.org mbosma at svn.reactos.org
Wed May 16 20:57:22 CEST 2007


Author: mbosma
Date: Wed May 16 22:57:21 2007
New Revision: 26809

URL: http://svn.reactos.org/svn/reactos?rev=26809&view=rev
Log:
- Enable display mode tests but do not tests all of them, but only the first five onces.
- Add tests for AddRef, QueryInterface, Release

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

Modified: trunk/rostests/dxtest/ddraw/testlist.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/testlist.cpp?rev=26809&r1=26808&r2=26809&view=diff
==============================================================================
--- trunk/rostests/dxtest/ddraw/testlist.cpp (original)
+++ trunk/rostests/dxtest/ddraw/testlist.cpp Wed May 16 22:57:21 2007
@@ -14,7 +14,7 @@
 {
 	{ "DirectDrawCreate(Ex)", Test_CreateDDraw },
 	{ "IDirectDraw::SetCooperativeLevel", Test_SetCooperativeLevel },
-	// { "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes }, // uncomment this test if you have enough time and patience
+	{ "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes },
 	{ "IDirectDraw::CreateSurface", Test_CreateSurface },
 	{ "IDirectDraw::GetMonitorFrequency", Test_GetMonitorFrequency },
 };

Modified: trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp?rev=26809&r1=26808&r2=26809&view=diff
==============================================================================
--- trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp (original)
+++ trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp Wed May 16 22:57:21 2007
@@ -4,18 +4,35 @@
 
 BOOL Test_CreateDDraw (INT* passed, INT* failed)
 {
-	LPDIRECTDRAW7 DirectDraw = NULL;
-	IDirectDraw* DirectDraw2 = NULL;
+	LPDIRECTDRAW7 DirectDraw;
+	IDirectDraw* DirectDraw2;
 
 	/*** FIXME: Test first parameter using EnumDisplayDrivers  ***/
+	DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL);
 
 	TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, (IUnknown*)0xdeadbeef) == CLASS_E_NOAGGREGATION);
 	TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw4, NULL) == DDERR_INVALIDPARAMS);
 	TEST (DirectDrawCreateEx(NULL, NULL, IID_IDirectDraw7, NULL) == DDERR_INVALIDPARAMS); 
+
+	DirectDraw = NULL;
 	TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) == DD_OK);
-	//TEST (DirectDraw && DirectDraw->Release());
+	if(DirectDraw)
+	{
+		TEST (DirectDraw->Release() == 0);
+	}
+
+	DirectDraw2 = NULL;
 	TEST (DirectDrawCreate(NULL ,&DirectDraw2, NULL) == DD_OK);
-	//TEST (DirectDraw2 && DirectDraw2->Release());
+	if(DirectDraw2)
+	{
+		TEST (DirectDraw2->QueryInterface(IID_IDirectDraw7, (PVOID*)&DirectDraw) == 0);
+		TEST (DirectDraw2->AddRef() == 2);
+		TEST (DirectDraw->AddRef() == 2);
+		TEST (DirectDraw->Release() == 1);
+		TEST (DirectDraw->Release() == 0);
+		TEST (DirectDraw2->Release() == 1);
+		TEST (DirectDraw2->Release() == 0);
+	}
 
 	return TRUE;
 }

Modified: trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp?rev=26809&r1=26808&r2=26809&view=diff
==============================================================================
--- trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp (original)
+++ trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp Wed May 16 22:57:21 2007
@@ -14,7 +14,12 @@
 {
 	INT* passed = Context->passed;
 	INT* failed = Context->failed;
-	TEST ( Context->DirectDraw->SetDisplayMode (pDDSD->dwWidth, pDDSD->dwHeight, pDDSD->ddpfPixelFormat.dwRGBBitCount, pDDSD->dwRefreshRate, 0) == DD_OK);
+	static int setcout = 0;
+	if(setcout < 5)
+	{
+		TEST ( Context->DirectDraw->SetDisplayMode (pDDSD->dwWidth, pDDSD->dwHeight, pDDSD->ddpfPixelFormat.dwRGBBitCount, pDDSD->dwRefreshRate, 0) == DD_OK);
+	}
+	setcout++;
 	return DDENUMRET_OK;
 }
 




More information about the Ros-diffs mailing list