Signed-off-by: Nikolay Sivov nsivov@codeweavers.com ---
v2: moved to different test function
dlls/ddraw/tests/ddraw1.c | 13 +++++++++++ dlls/ddraw/tests/ddraw2.c | 13 +++++++++++ dlls/ddraw/tests/ddraw4.c | 13 +++++++++++ dlls/ddraw/tests/ddraw7.c | 13 +++++++++++ dlls/ddraw/tests/dsurface.c | 55 --------------------------------------------- 5 files changed, 52 insertions(+), 55 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index d276565763..d1f28a2752 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -3320,6 +3320,19 @@ static void test_coop_level_surf_create(void) ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Surface creation returned hr %#x.\n", hr); ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface);
+ surface = (void *)0xdeadbeef; + hr = IDirectDraw_CreateSurface(ddraw, NULL, &surface, NULL); + ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Surface creation returned hr %#x.\n", hr); + ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface); + + hr = IDirectDraw_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + + surface = (void *)0xdeadbeef; + hr = IDirectDraw_CreateSurface(ddraw, NULL, &surface, NULL); + ok(hr == DDERR_INVALIDPARAMS, "Unexpected hr %#x.\n", hr); + ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface); + IDirectDraw_Release(ddraw); }
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 8b23c01b07..eb1385a87e 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -3521,6 +3521,19 @@ static void test_coop_level_surf_create(void) ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Surface creation returned hr %#x.\n", hr); ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface);
+ surface = (void *)0xdeadbeef; + hr = IDirectDraw2_CreateSurface(ddraw, NULL, &surface, NULL); + ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Surface creation returned hr %#x.\n", hr); + ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface); + + hr = IDirectDraw2_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + + surface = (void *)0xdeadbeef; + hr = IDirectDraw2_CreateSurface(ddraw, NULL, &surface, NULL); + ok(hr == DDERR_INVALIDPARAMS, "Unexpected hr %#x.\n", hr); + ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface); + IDirectDraw2_Release(ddraw); }
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 5eb391abd9..d8ea3a773e 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -3652,6 +3652,19 @@ static void test_coop_level_surf_create(void) ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Surface creation returned hr %#x.\n", hr); ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface);
+ surface = (void *)0xdeadbeef; + hr = IDirectDraw4_CreateSurface(ddraw, NULL, &surface, NULL); + ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Surface creation returned hr %#x.\n", hr); + ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface); + + hr = IDirectDraw4_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + + surface = (void *)0xdeadbeef; + hr = IDirectDraw4_CreateSurface(ddraw, NULL, &surface, NULL); + ok(hr == DDERR_INVALIDPARAMS, "Unexpected hr %#x.\n", hr); + ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface); + IDirectDraw4_Release(ddraw); }
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index d5969ab949..8eecde0196 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -3382,6 +3382,19 @@ static void test_coop_level_surf_create(void) ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Surface creation returned hr %#x.\n", hr); ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface);
+ surface = (void *)0xdeadbeef; + hr = IDirectDraw7_CreateSurface(ddraw, NULL, &surface, NULL); + ok(hr == DDERR_NOCOOPERATIVELEVELSET, "Surface creation returned hr %#x.\n", hr); + ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface); + + hr = IDirectDraw7_SetCooperativeLevel(ddraw, NULL, DDSCL_NORMAL); + ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr); + + surface = (void *)0xdeadbeef; + hr = IDirectDraw7_CreateSurface(ddraw, NULL, &surface, NULL); + ok(hr == DDERR_INVALIDPARAMS, "Unexpected hr %#x.\n", hr); + ok(surface == (void *)0xdeadbeef, "Got unexpected surface %p.\n", surface); + IDirectDraw7_Release(ddraw); }
diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index 0f775a0062..90de8b00b2 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -2476,60 +2476,6 @@ 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; @@ -2581,6 +2527,5 @@ START_TEST(dsurface) zbufferbitdepth_test(); pixelformat_flag_test(); partial_block_lock_test(); - create_surface_test(); ReleaseDirectDraw(); }