Commit 81bc148b authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ddraw/tests: Move CreateSurface() invalid arguments test.

parent 9ccce0ce
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment