Commit 792dc349 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ddraw/tests: Test locking lost surface for ddraw1.

parent 98b8f680
......@@ -1085,6 +1085,7 @@ static void test_coop_level_d3d_state(void)
IDirect3DViewport *viewport;
IDirect3DDevice *device;
D3DMATERIAL material;
DDSURFACEDESC lock;
IDirectDraw *ddraw;
D3DCOLOR color;
HWND window;
......@@ -1106,18 +1107,31 @@ static void test_coop_level_d3d_state(void)
viewport_set_background(device, viewport, background);
hr = IDirect3DDevice_QueryInterface(device, &IID_IDirectDrawSurface, (void **)&rt);
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DViewport_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
color = get_surface_color(rt, 320, 240);
ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(rt);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
memset(&lock, 0, sizeof(lock));
lock.dwSize = sizeof(lock);
lock.lpSurface = (void *)0xdeadbeef;
hr = IDirectDrawSurface_Lock(rt, NULL, &lock, DDLOCK_READONLY, NULL);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
ok(lock.lpSurface == (void *)0xdeadbeef, "Got unexpected lock.lpSurface %p.\n", lock.lpSurface);
hr = restore_surfaces(ddraw);
ok(SUCCEEDED(hr), "Failed to restore surfaces, hr %#x.\n", hr);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Lock(rt, NULL, &lock, DDLOCK_READONLY, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface2_Unlock(rt, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
memset(&material, 0, sizeof(material));
material.dwSize = sizeof(material);
......@@ -1126,13 +1140,13 @@ static void test_coop_level_d3d_state(void)
U3(U(material).diffuse).b = 0.0f;
U4(U(material).diffuse).a = 1.0f;
hr = IDirect3DMaterial_SetMaterial(background, &material);
ok(SUCCEEDED(hr), "Failed to set material data, hr %#x.\n", hr);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice_QueryInterface(device, &IID_IDirectDrawSurface, (void **)&surface);
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
ok(surface == rt, "Got unexpected surface %p.\n", surface);
hr = IDirect3DViewport_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
color = get_surface_color(rt, 320, 240);
ok(compare_color(color, 0x0000ff00, 1) || broken(compare_color(color, 0x00000000, 1)),
"Got unexpected color 0x%08x.\n", color);
......
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