Author: mbosma
Date: Sun May 13 16:09:44 2007
New Revision: 26750
URL:
http://svn.reactos.org/svn/reactos?rev=26750&view=rev
Log:
Add debugging macro to get error code and test for display modes (commented out because it
checks every single display mode and thus takes fairly long).
Added:
trunk/rostests/dxtest/ddraw/debug.cpp (with props)
trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp (with props)
Modified:
trunk/rostests/dxtest/ddraw/testlist.cpp
trunk/rostests/dxtest/ddraw/tests/CreateDDraw.cpp
Added: 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 (added)
+++ trunk/rostests/dxtest/ddraw/debug.cpp Sun May 13 16:09:44 2007
@@ -1,0 +1,111 @@
+
+#define GetCode(X) printf("%s\n", DDErrorString(X));
+
+PCHAR DDErrorString (HRESULT hResult)
+{
+ switch (hResult)
+ {
+ case DD_OK: return "DD_OK";
+ case DDERR_ALREADYINITIALIZED: return "DDERR_ALREADYINITIALIZED";
+ case DDERR_CANNOTATTACHSURFACE: return "DDERR_CANNOTATTACHSURFACE";
+ case DDERR_CANNOTDETACHSURFACE: return "DDERR_CANNOTDETACHSURFACE";
+ case DDERR_CURRENTLYNOTAVAIL: return "DDERR_CURRENTLYNOTAVAIL";
+ case DDERR_EXCEPTION: return "DDERR_EXCEPTION";
+ case DDERR_GENERIC: return "DDERR_GENERIC";
+ case DDERR_HEIGHTALIGN: return "DDERR_HEIGHTALIGN";
+ case DDERR_INCOMPATIBLEPRIMARY: return "DDERR_INCOMPATIBLEPRIMARY";
+ case DDERR_INVALIDCAPS: return "DDERR_INVALIDCAPS";
+ case DDERR_INVALIDCLIPLIST: return "DDERR_INVALIDCLIPLIST";
+ case DDERR_INVALIDMODE: return "DDERR_INVALIDMODE";
+ case DDERR_INVALIDOBJECT: return "DDERR_INVALIDOBJECT";
+ case DDERR_INVALIDPARAMS: return "DDERR_INVALIDPARAMS";
+ case DDERR_INVALIDPIXELFORMAT: return "DDERR_INVALIDPIXELFORMAT";
+ case DDERR_INVALIDRECT: return "DDERR_INVALIDRECT";
+ case DDERR_LOCKEDSURFACES: return "DDERR_LOCKEDSURFACES";
+ case DDERR_NO3D: return "DDERR_NO3D";
+ case DDERR_NOALPHAHW: return "DDERR_NOALPHAHW";
+ case DDERR_NOCLIPLIST: return "DDERR_NOCLIPLIST";
+ case DDERR_NOCOLORCONVHW: return "DDERR_NOCOLORCONVHW";
+ case DDERR_NOCOOPERATIVELEVELSET: return
"DDERR_NOCOOPERATIVELEVELSET";
+ case DDERR_NOCOLORKEY: return "DDERR_NOCOLORKEY";
+ case DDERR_NOCOLORKEYHW: return "DDERR_NOCOLORKEYHW";
+ case DDERR_NODIRECTDRAWSUPPORT: return "DDERR_NODIRECTDRAWSUPPORT";
+ case DDERR_NOEXCLUSIVEMODE: return "DDERR_NOEXCLUSIVEMODE";
+ case DDERR_NOFLIPHW: return "DDERR_NOFLIPHW";
+ case DDERR_NOGDI: return "DDERR_NOGDI";
+ case DDERR_NOMIRRORHW: return "DDERR_NOMIRRORHW";
+ case DDERR_NOTFOUND: return "DDERR_NOTFOUND";
+ case DDERR_NOOVERLAYHW: return "DDERR_NOOVERLAYHW";
+ case DDERR_NORASTEROPHW: return "DDERR_NORASTEROPHW";
+ case DDERR_NOROTATIONHW: return "DDERR_NOROTATIONHW";
+ case DDERR_NOSTRETCHHW: return "DDERR_NOSTRETCHHW";
+ case DDERR_NOT4BITCOLOR: return "DDERR_NOT4BITCOLOR";
+ case DDERR_NOT4BITCOLORINDEX: return "DDERR_NOT4BITCOLORINDEX";
+ case DDERR_NOT8BITCOLOR: return "DDERR_NOT8BITCOLOR";
+ case DDERR_NOTEXTUREHW: return "DDERR_NOTEXTUREHW";
+ case DDERR_NOVSYNCHW: return "DDERR_NOVSYNCHW";
+ case DDERR_NOZBUFFERHW: return "DDERR_NOZBUFFERHW";
+ case DDERR_NOZOVERLAYHW: return "DDERR_NOZOVERLAYHW";
+ case DDERR_OUTOFCAPS: return "DDERR_OUTOFCAPS";
+ case DDERR_OUTOFMEMORY: return "DDERR_OUTOFMEMORY";
+ case DDERR_OUTOFVIDEOMEMORY: return "DDERR_OUTOFVIDEOMEMORY";
+ case DDERR_OVERLAYCANTCLIP: return "DDERR_OVERLAYCANTCLIP";
+ case DDERR_OVERLAYCOLORKEYONLYONEACTIVE: return
"DDERR_OVERLAYCOLORKEYONLYONEACTIVE";
+ case DDERR_PALETTEBUSY: return "DDERR_PALETTEBUSY";
+ case DDERR_COLORKEYNOTSET: return "DDERR_COLORKEYNOTSET";
+ case DDERR_SURFACEALREADYATTACHED: return
"DDERR_SURFACEALREADYATTACHED";
+ case DDERR_SURFACEALREADYDEPENDENT: return
"DDERR_SURFACEALREADYDEPENDENT";
+ case DDERR_SURFACEBUSY: return "DDERR_SURFACEBUSY";
+ case DDERR_CANTLOCKSURFACE: return "DDERR_CANTLOCKSURFACE";
+ case DDERR_SURFACEISOBSCURED: return "DDERR_SURFACEISOBSCURED";
+ case DDERR_SURFACELOST: return "DDERR_SURFACELOST";
+ case DDERR_SURFACENOTATTACHED: return "DDERR_SURFACENOTATTACHED";
+ case DDERR_TOOBIGHEIGHT: return "DDERR_TOOBIGHEIGHT";
+ case DDERR_TOOBIGSIZE: return "DDERR_TOOBIGSIZE";
+ case DDERR_TOOBIGWIDTH: return "DDERR_TOOBIGWIDTH";
+ case DDERR_UNSUPPORTED: return "DDERR_UNSUPPORTED";
+ case DDERR_UNSUPPORTEDFORMAT: return "DDERR_UNSUPPORTEDFORMAT";
+ case DDERR_UNSUPPORTEDMASK: return "DDERR_UNSUPPORTEDMASK";
+ case DDERR_VERTICALBLANKINPROGRESS: return
"DDERR_VERTICALBLANKINPROGRESS";
+ case DDERR_WASSTILLDRAWING: return "DDERR_WASSTILLDRAWING";
+ case DDERR_XALIGN: return "DDERR_XALIGN";
+ case DDERR_INVALIDDIRECTDRAWGUID: return
"DDERR_INVALIDDIRECTDRAWGUID";
+ case DDERR_DIRECTDRAWALREADYCREATED: return
"DDERR_DIRECTDRAWALREADYCREATED";
+ case DDERR_NODIRECTDRAWHW: return "DDERR_NODIRECTDRAWHW";
+ case DDERR_PRIMARYSURFACEALREADYEXISTS: return
"DDERR_PRIMARYSURFACEALREADYEXISTS";
+ case DDERR_NOEMULATION: return "DDERR_NOEMULATION";
+ case DDERR_REGIONTOOSMALL: return "DDERR_REGIONTOOSMALL";
+ case DDERR_CLIPPERISUSINGHWND: return "DDERR_CLIPPERISUSINGHWND";
+ case DDERR_NOCLIPPERATTACHED: return "DDERR_NOCLIPPERATTACHED";
+ case DDERR_NOHWND: return "DDERR_NOHWND";
+ case DDERR_HWNDSUBCLASSED: return "DDERR_HWNDSUBCLASSED";
+ case DDERR_HWNDALREADYSET: return "DDERR_HWNDALREADYSET";
+ case DDERR_NOPALETTEATTACHED: return "DDERR_NOPALETTEATTACHED";
+ case DDERR_NOPALETTEHW: return "DDERR_NOPALETTEHW";
+ case DDERR_BLTFASTCANTCLIP: return "DDERR_BLTFASTCANTCLIP";
+ case DDERR_NOBLTHW: return "DDERR_NOBLTHW";
+ case DDERR_NODDROPSHW: return "DDERR_NODDROPSHW";
+ case DDERR_OVERLAYNOTVISIBLE: return "DDERR_OVERLAYNOTVISIBLE";
+ case DDERR_NOOVERLAYDEST: return "DDERR_NOOVERLAYDEST";
+ case DDERR_INVALIDPOSITION: return "DDERR_INVALIDPOSITION";
+ case DDERR_NOTAOVERLAYSURFACE: return "DDERR_NOTAOVERLAYSURFACE";
+ case DDERR_EXCLUSIVEMODEALREADYSET: return
"DDERR_EXCLUSIVEMODEALREADYSET";
+ case DDERR_NOTFLIPPABLE: return "DDERR_NOTFLIPPABLE";
+ case DDERR_CANTDUPLICATE: return "DDERR_CANTDUPLICATE";
+ case DDERR_NOTLOCKED: return "DDERR_NOTLOCKED";
+ case DDERR_CANTCREATEDC: return "DDERR_CANTCREATEDC";
+ case DDERR_NODC: return "DDERR_NODC";
+ case DDERR_WRONGMODE: return "DDERR_WRONGMODE";
+ case DDERR_IMPLICITLYCREATED: return "DDERR_IMPLICITLYCREATED";
+ case DDERR_NOTPALETTIZED: return "DDERR_NOTPALETTIZED";
+ case DDERR_UNSUPPORTEDMODE: return "DDERR_UNSUPPORTEDMODE";
+ case DDERR_NOMIPMAPHW: return "DDERR_NOMIPMAPHW";
+ case DDERR_INVALIDSURFACETYPE: return "DDERR_INVALIDSURFACETYPE";
+ case DDERR_DCALREADYCREATED: return "DDERR_DCALREADYCREATED";
+ case DDERR_CANTPAGELOCK: return "DDERR_CANTPAGELOCK";
+ case DDERR_CANTPAGEUNLOCK: return "DDERR_CANTPAGEUNLOCK";
+ case DDERR_NOTPAGELOCKED: return "DDERR_NOTPAGELOCKED";
+ case DDERR_NOTINITIALIZED: return "DDERR_NOTINITIALIZED";
+ }
+ return "Unknown Error";
+}
Propchange: trunk/rostests/dxtest/ddraw/debug.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/rostests/dxtest/ddraw/debug.cpp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
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 16:09:44 2007
@@ -2,15 +2,18 @@
#define _DDRAWTESTLIST_H
#include "ddrawtest.h"
+#include "debug.cpp"
/* include the tests */
#include "tests/CreateDDraw.cpp"
+#include "tests/DisplayModes.cpp"
/* The List of tests */
TEST TestList[] =
{
{ "DirectDrawCreate(Ex)", Test_CreateDDraw },
- { "IDirectDraw::SetCooperativeLevel", Test_SetCooperativeLevel }
+ { "IDirectDraw::SetCooperativeLevel", Test_SetCooperativeLevel },
+ // { "IDirectDraw::EnumDisplayModes/SetDisplayMode", Test_DisplayModes } //
uncomment this test if you have enough time and patience
};
/* 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 16:09:44 2007
@@ -7,7 +7,7 @@
LPDIRECTDRAW7 DirectDraw;
IDirectDraw* DirectDraw2;
- /*** FIXME: Test first parameter ***/
+ /*** FIXME: Test first parameter using EnumDisplayDrivers ***/
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7,
(IUnknown*)0xdeadbeef) == CLASS_E_NOAGGREGATION);
TEST (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw4, NULL) ==
DDERR_INVALIDPARAMS);
@@ -36,16 +36,16 @@
DirectDraw->Release();
return FALSE;
}
-
+
/* The Test */
TEST ( DirectDraw->SetCooperativeLevel (NULL, 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 );
TEST ( DirectDraw->SetCooperativeLevel ((HWND)0xdeadbeef, DDSCL_NORMAL) ==
DDERR_INVALIDPARAMS);
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE) ==
DD_OK);
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE |
DDSCL_ALLOWMODEX) == DD_OK);
- TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL | DDSCL_FULLSCREEN) ==
DD_OK);
TEST ( DirectDraw->SetCooperativeLevel (NULL, DDSCL_NORMAL) == DD_OK );
TEST ( DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL) == DD_OK );
Added: 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 (added)
+++ trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp Sun May 13 16:09:44 2007
@@ -1,0 +1,55 @@
+typedef struct
+{
+ INT* passed;
+ INT* failed;
+ LPDIRECTDRAW7 DirectDraw;
+} ENUMCONTEXT;
+
+HRESULT CALLBACK DummyEnumDisplayModes( LPDDSURFACEDESC2 pDDSD, ENUMCONTEXT* Context )
+{
+ return DDENUMRET_OK;
+}
+
+HRESULT CALLBACK EnumDisplayModes( LPDDSURFACEDESC2 pDDSD, ENUMCONTEXT* Context )
+{
+ INT* passed = Context->passed;
+ INT* failed = Context->failed;
+ TEST ( Context->DirectDraw->SetDisplayMode (pDDSD->dwWidth, pDDSD->dwHeight,
pDDSD->ddpfPixelFormat.dwRGBBitCount, pDDSD->dwRefreshRate, 0) == DD_OK);
+ return DDENUMRET_OK;
+}
+
+BOOL Test_DisplayModes (INT* passed, INT* failed)
+{
+ /*** 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)
+ {
+ printf("ERROR: Failed to set up ddraw\n");
+ return FALSE;
+ }
+
+ ENUMCONTEXT Context = {passed, failed, DirectDraw};
+
+ /* The Test */
+
+ // 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 (0, 0, 16, 0, 0) == DD_OK );
+
+ // Now try getting vaild modes from driver
+ 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);
+
+ DirectDraw->Release();
+
+ return TRUE;
+}
Propchange: trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/rostests/dxtest/ddraw/tests/DisplayModes.cpp
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision