diff --git a/rostests/dxtest/ddraw/testlist.cpp b/rostests/dxtest/ddraw/testlist.cpp index 1f091f723e3..e20d74e8ee4 100644 --- a/rostests/dxtest/ddraw/testlist.cpp +++ b/rostests/dxtest/ddraw/testlist.cpp @@ -7,13 +7,15 @@ /* include the tests */ #include "tests/CreateDDraw.cpp" #include "tests/DisplayModes.cpp" +#include "tests/CreateSurface.cpp" /* The List of tests */ TEST TestList[] = { { "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 }, // uncomment this test if you have enough time and patience + { "IDirectDraw::CreateSurface", Test_CreateSurface } }; /* The function that gives us the number of tests */ diff --git a/rostests/dxtest/ddraw/tests/CreateSurface.cpp b/rostests/dxtest/ddraw/tests/CreateSurface.cpp new file mode 100644 index 00000000000..33edbbc8f90 --- /dev/null +++ b/rostests/dxtest/ddraw/tests/CreateSurface.cpp @@ -0,0 +1,46 @@ + +HWND CreateBasicWindow (VOID); + +BOOL Test_CreateSurface (INT* passed, INT* failed) +{ + LPDIRECTDRAW7 DirectDraw; + LPDIRECTDRAWSURFACE7 DirectDrawSurface; + HWND hwnd; + + /* 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; + } + + if (DirectDraw->SetCooperativeLevel (hwnd, DDSCL_NORMAL) != DD_OK) + { + printf("ERROR: you not set cooperative level\n"); + DirectDraw->Release(); + return 0; + } + + /* The Test */ + + DDSURFACEDESC2 Desc = { 0 }; + + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, (IUnknown*)0xdeadbeef) == CLASS_E_NOAGGREGATION ); + TEST ( DirectDraw->CreateSurface(NULL, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS ); + TEST ( DirectDraw->CreateSurface(&Desc, NULL, NULL) == DDERR_INVALIDPARAMS ); + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS ); + + Desc.dwSize = sizeof (DDSURFACEDESC2); + TEST ( DirectDraw->CreateSurface(&Desc, &DirectDrawSurface, NULL) == DDERR_INVALIDPARAMS ); + + DirectDraw->Release(); + + return TRUE; +} \ No newline at end of file diff --git a/rostests/dxtest/ddraw/tests/DisplayModes.cpp b/rostests/dxtest/ddraw/tests/DisplayModes.cpp index 4592e8efc44..7dd951439ce 100644 --- a/rostests/dxtest/ddraw/tests/DisplayModes.cpp +++ b/rostests/dxtest/ddraw/tests/DisplayModes.cpp @@ -42,6 +42,8 @@ BOOL Test_DisplayModes (INT* passed, INT* failed) 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 ? + // 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 );