Stefan Dösinger : ddraw/tests: Extend the CreateSurface(NULL test), use own function.
Module: wine Branch: master Commit: 9cf25006adf37387c8dfad25839c1a00aa8b2ea8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9cf25006adf37387c8dfad2583... Author: Stefan Dösinger <stefan(a)codeweavers.com> Date: Thu Dec 8 15:59:07 2011 +0100 ddraw/tests: Extend the CreateSurface(NULL test), use own function. --- dlls/ddraw/tests/dsurface.c | 64 ++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 60 insertions(+), 4 deletions(-) diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index 0aabaad..32af27e 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -29,6 +29,8 @@ #include "d3d.h" #include "unknwn.h" +static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *, void **, REFIID, IUnknown *); + static LPDIRECTDRAW lpDD = NULL; static DDCAPS ddcaps; @@ -4484,10 +4486,6 @@ static void set_surface_desc_test(void) IDirectDrawSurface3 *surface3; BYTE data[16*16*4]; - hr = IDirectDraw_CreateSurface(lpDD, NULL, &surface, NULL); - ok(hr == DDERR_INVALIDPARAMS, "CreateSurface with a NULL DDSD returned %#x," - " expected DDERR_INVALIDPARAMS(%#x)\n", hr, DDERR_INVALIDPARAMS); - reset_ddsd(&ddsd); ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_PIXELFORMAT; ddsd.dwWidth = 8; @@ -4909,11 +4907,68 @@ static void partial_block_lock_test(void) IDirectDraw7_Release(dd7); } +static void create_surface_test(void) +{ + HRESULT hr; + IDirectDraw2 *ddraw2; + IDirectDraw4 *ddraw4; + IDirectDraw7 *ddraw7; + IDirectDrawSurface *surface; + IDirectDrawSurface4 *surface4; + IDirectDrawSurface7 *surface7; + + hr = IDirectDraw_CreateSurface(lpDD, NULL, &surface, NULL); + ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x," + " expected %#x.\n", hr, DDERR_INVALIDPARAMS); + + hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw2, (void **) &ddraw2); + ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); + + hr = IDirectDraw2_CreateSurface(ddraw2, NULL, &surface, NULL); + ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x," + " expected %#x.\n", hr, DDERR_INVALIDPARAMS); + + IDirectDraw2_Release(ddraw2); + + hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw4, (void **) &ddraw4); + ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr); + + hr = IDirectDraw4_CreateSurface(ddraw4, NULL, &surface4, NULL); + ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x," + " expected %#x.\n", hr, DDERR_INVALIDPARAMS); + + IDirectDraw4_Release(ddraw4); + + if (!pDirectDrawCreateEx) + { + skip("DirectDrawCreateEx not available, skipping IDirectDraw7 tests.\n"); + return; + } + hr = pDirectDrawCreateEx(NULL, (void **) &ddraw7, &IID_IDirectDraw7, NULL); + ok(SUCCEEDED(hr), "DirectDrawCreateEx failed, hr %#x.\n", hr); + + hr = IDirectDraw7_CreateSurface(ddraw7, NULL, &surface7, NULL); + ok(hr == DDERR_NOCOOPERATIVELEVELSET, "CreateSurface(ddsd=NULL, pre-SCL) returned %#x," + " expected %#x.\n", hr, DDERR_NOCOOPERATIVELEVELSET); + + hr = IDirectDraw7_SetCooperativeLevel(ddraw7, NULL, DDSCL_NORMAL); + ok(hr == DD_OK, "SetCooperativeLevel failed, hr %#x.\n", hr); + + hr = IDirectDraw7_CreateSurface(ddraw7, NULL, &surface7, NULL); + ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x," + " expected %#x.\n", hr, DDERR_INVALIDPARAMS); + + IDirectDraw7_Release(ddraw7); +} + START_TEST(dsurface) { HRESULT ret; IDirectDraw4 *dd4; + HMODULE ddraw_mod = GetModuleHandleA("ddraw.dll"); + pDirectDrawCreateEx = (void *) GetProcAddress(ddraw_mod, "DirectDrawCreateEx"); + if (!CreateDirectDraw()) return; @@ -4970,5 +5025,6 @@ START_TEST(dsurface) pixelformat_flag_test(); set_surface_desc_test(); partial_block_lock_test(); + create_surface_test(); ReleaseDirectDraw(); }
participants (1)
-
Alexandre Julliard