Author: mbosma
Date: Mon May 21 19:24:57 2007
New Revision: 26850
URL:
http://svn.reactos.org/svn/reactos?rev=26850&view=rev
Log:
Test for IDirectDraw7::GetFourCCCodes
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…
==============================================================================
--- trunk/rostests/dxtest/ddraw/testlist.cpp (original)
+++ trunk/rostests/dxtest/ddraw/testlist.cpp Mon May 21 19:24:57 2007
@@ -15,6 +15,7 @@
{ "IDirectDraw: COM Stuff", Test_CreateDDraw },
{ "IDirectDraw: Display Modes", Test_DisplayModes },
{ "IDirectDraw: Available Video Memory", Test_GetAvailableVidMem },
+ { "IDirectDraw: GetFourCC", Test_GetFourCCCodes },
{ "IDirectDraw: Cooperative Levels", Test_SetCooperativeLevel },
{ "IDirectDraw: CreateSurface", Test_CreateSurface },
};
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 Mon May 21 19:24:57 2007
@@ -97,8 +97,35 @@
TEST (DirectDraw->GetAvailableVidMem(NULL, &Total, &Free) ==
DDERR_INVALIDPARAMS);
TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK
&& Total == 0 && Free == 0 );
+ // TODO: Try to produce DDERR_INVALIDCAPS
Caps.dwCaps = DDSCAPS_VIDEOMEMORY;
TEST (DirectDraw->GetAvailableVidMem(&Caps, &Total, &Free) == DD_OK
);
+
+ DirectDraw->Release();
+
+ return TRUE;
+}
+
+BOOL Test_GetFourCCCodes (INT* passed, INT* failed)
+{
+ LPDIRECTDRAW7 DirectDraw;
+
+ /* Preparations */
+ if (DirectDrawCreateEx(NULL, (VOID**)&DirectDraw, IID_IDirectDraw7, NULL) !=
DD_OK)
+ {
+ printf("ERROR: Failed to set up ddraw\n");
+ return FALSE;
+ }
+
+ /* Here we go */
+ DWORD dwNumCodes, *lpCodes;
+ TEST (DirectDraw->GetFourCCCodes(NULL, NULL) == DDERR_INVALIDPARAMS);
+ TEST ( DirectDraw->GetFourCCCodes(NULL, lpCodes) == DDERR_INVALIDPARAMS );
+
+ TEST (DirectDraw->GetFourCCCodes(&dwNumCodes, NULL) == DD_OK &&
dwNumCodes);
+ lpCodes = (PDWORD)HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD)*dwNumCodes);
+ *lpCodes = 0;
+ TEST (DirectDraw->GetFourCCCodes(&dwNumCodes, lpCodes) == DD_OK &&
*lpCodes );
DirectDraw->Release();
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 Mon May 21 19:24:57 2007
@@ -12,25 +12,27 @@
HRESULT CALLBACK EnumDisplayModes( LPDDSURFACEDESC2 pDDSD, ENUMCONTEXT* Context )
{
+ static int setcout = 0;
+ if(setcout >= 5)
+ return DDENUMRET_OK;
+
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->dwHeight == DisplayMode.dwHeight
- && pDDSD->dwWidth == DisplayMode.dwWidth
- && pDDSD->dwRefreshRate == DisplayMode.dwRefreshRate
- && pDDSD->ddpfPixelFormat.dwRGBBitCount ==
DisplayMode.ddpfPixelFormat.dwRGBBitCount);
-
- }
+ TEST ( pDDSD->dwFlags == DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH |
DDSD_PIXELFORMAT | DDSD_REFRESHRATE);
+ TEST ( pDDSD->ddpfPixelFormat.dwFlags == DDPF_RGB | DDPF_PALETTEINDEXED8 ||
pDDSD->ddpfPixelFormat.dwFlags == DDPF_RGB );
+ 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->dwHeight == DisplayMode.dwHeight
+ && pDDSD->dwWidth == DisplayMode.dwWidth
+ && pDDSD->dwRefreshRate == DisplayMode.dwRefreshRate
+ && pDDSD->ddpfPixelFormat.dwRGBBitCount ==
DisplayMode.ddpfPixelFormat.dwRGBBitCount
+ && DisplayMode.dwFlags == DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH |
DDSD_PIXELFORMAT | DDSD_REFRESHRATE );
+
setcout++;
return DDENUMRET_OK;
}