diff --git a/rostests/dxtest/ddraw/Surface/misc.cpp b/rostests/dxtest/ddraw/Surface/misc.cpp new file mode 100644 index 00000000000..1d493e9c0e4 --- /dev/null +++ b/rostests/dxtest/ddraw/Surface/misc.cpp @@ -0,0 +1,64 @@ +BOOL CreateSurface(LPDIRECTDRAWSURFACE7* pSurface); + +BOOL Test_Misc (INT* passed, INT* failed) +{ + LPDIRECTDRAWSURFACE7 Surface; + if(!CreateSurface(&Surface)) + return FALSE; + + TEST (Surface->Initialize(NULL, NULL) == DDERR_ALREADYINITIALIZED); + + // GetCaps + DDSCAPS2 Caps; + TEST (Surface->GetCaps((DDSCAPS2*)0xdeadbeef) == DDERR_INVALIDPARAMS); + TEST (Surface->GetCaps(&Caps) == DD_OK && Caps.dwCaps == 0x10004040 + && Caps.dwCaps2 == Caps.dwCaps3 == Caps.dwCaps4 == 0); // FIXME: Replace 0x10004040 + + // GetDC / ReleaseDC + HDC hdc; + TEST (Surface->GetDC((HDC*)0xdeadbeef) == DDERR_INVALIDPARAMS); + TEST (Surface->ReleaseDC((HDC)0xdeadbeef) == DDERR_NODC); + TEST (Surface->ReleaseDC(GetDC(NULL)) == DDERR_NODC); + + TEST (Surface->GetDC(&hdc) == DD_OK); + TEST (MoveToEx(hdc, 0, 0, NULL) == TRUE); // validate hdc + TEST (Surface->Blt(NULL, NULL, NULL, 0, NULL) == DDERR_SURFACEBUSY); // check lock + TEST (Surface->ReleaseDC(hdc) == DD_OK); + + // ChangeUniquenessValue / GetUniquenessValue + DWORD Value; + // FIXME: find out other apis which increases the uniqueness value + TEST (Surface->GetUniquenessValue(&Value) == DD_OK && Value == 2); + TEST (Surface->Blt(NULL, NULL, NULL, 0, NULL) == DDERR_INVALIDPARAMS); // Even this increases the uniqueness value + TEST (Surface->GetUniquenessValue(&Value) == DD_OK && Value == 3); + TEST (Surface->ChangeUniquenessValue() == DD_OK); + TEST (Surface->GetUniquenessValue(&Value) == DD_OK && Value == 4); + + // GetPixelFormat + DDPIXELFORMAT PixelFormat = {0}; + // FIXME: Produce DDERR_INVALIDSURFACETYPE + TEST (Surface->GetPixelFormat((LPDDPIXELFORMAT)0xdeadbeef) == DDERR_INVALIDPARAMS); + TEST (Surface->GetPixelFormat(&PixelFormat)); + PixelFormat.dwSize = sizeof(DDPIXELFORMAT); + TEST (Surface->GetPixelFormat(&PixelFormat) == DD_OK && PixelFormat.dwFlags == 0x40); // FIXME: Find out what 0x40 is + + // GetSurfaceDesc / SetSurfaceDesc + DDSURFACEDESC2 Desc = {0}; + // FIXME: Produce DDERR_INVALIDSURFACETYPE + TEST (Surface->GetSurfaceDesc((LPDDSURFACEDESC2)0xdeadbeef) == DDERR_INVALIDPARAMS); + TEST (Surface->GetSurfaceDesc(&Desc)); + Desc.dwSize = sizeof(DDSURFACEDESC2); + TEST (Surface->GetSurfaceDesc(&Desc) == DD_OK && Desc.dwFlags == 0x100f); // FIXME: Find out what 0x100f is + TEST (memcmp ((PVOID)&Desc.ddpfPixelFormat, (PVOID)&PixelFormat, sizeof(DDPIXELFORMAT)) == 0); + // FIXME: Test SetSurfaceDesc + + // GetDDInterface + IUnknown* iface; + TEST(Surface->GetDDInterface((LPVOID*)0xdeadbeef) == DDERR_INVALIDPARAMS); + TEST(Surface->GetDDInterface((LPVOID*)&iface) == DD_OK && iface); + TEST(iface->Release() == 1); // FIXME: Test the interface further + + Surface->Release(); + + return TRUE; +} diff --git a/rostests/dxtest/ddraw/helper.cpp b/rostests/dxtest/ddraw/helper.cpp index 8f5f9d4a3bd..b414ffc6ca8 100644 --- a/rostests/dxtest/ddraw/helper.cpp +++ b/rostests/dxtest/ddraw/helper.cpp @@ -25,7 +25,6 @@ HWND CreateBasicWindow (VOID) return CreateWindow("DDrawTest", "ReactOS DirectDraw Test", WS_POPUP, 0, 0, 10, 10, NULL, NULL, GetModuleHandle(NULL), NULL); } - BOOL CreateSurface(LPDIRECTDRAWSURFACE7* pSurface) { LPDIRECTDRAW7 DirectDraw; diff --git a/rostests/dxtest/ddraw/testlist.cpp b/rostests/dxtest/ddraw/testlist.cpp index 358a38626fd..31dbe51f597 100644 --- a/rostests/dxtest/ddraw/testlist.cpp +++ b/rostests/dxtest/ddraw/testlist.cpp @@ -9,6 +9,7 @@ #include "DDraw/display_modes.cpp" #include "Surface/create.cpp" #include "Surface/private_data.cpp" +#include "Surface/misc.cpp" /* The List of tests */ TEST TestList[] = @@ -20,8 +21,9 @@ TEST TestList[] = { "IDirectDraw: Available Video Memory", Test_GetAvailableVidMem }, { "IDirectDraw: GetFourCC", Test_GetFourCCCodes }, { "IDirectDraw: Cooperative Levels", Test_SetCooperativeLevel }, - { "IDirectDraw: CreateSurface", Test_CreateSurface }, + { "IDirectDrawSurface: Creation", Test_CreateSurface }, { "IDirectDrawSurface: Private Data", Test_PrivateData }, + { "IDirectDrawSurface: Miscellaneous Tests", Test_Misc }, }; /* The function that gives us the number of tests */