Signed-off-by: Paul Gofman gofmanp@gmail.com --- dlls/ddraw/tests/ddraw4.c | 40 ++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 1e6cf4c446..fc3a415433 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -1111,6 +1111,7 @@ static void test_coop_level_d3d_state(void) IDirect3DViewport3 *viewport; IDirect3DDevice3 *device; IDirectDraw4 *ddraw; + DDSURFACEDESC2 lock; IDirect3D3 *d3d; D3DCOLOR color; DWORD value; @@ -1146,43 +1147,56 @@ static void test_coop_level_d3d_state(void) ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice3_GetRenderTarget(device, &rt); - ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DDevice3_GetRenderState(device, D3DRENDERSTATE_ZENABLE, &value); - ok(SUCCEEDED(hr), "Failed to get render state, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); ok(!!value, "Got unexpected z-enable state %#x.\n", value); hr = IDirect3DDevice3_GetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, &value); - ok(SUCCEEDED(hr), "Failed to get render state, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); ok(!value, "Got unexpected alpha blend enable state %#x.\n", value); hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); - ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0xffff0000, 0.0f, 0); - 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 = IDirect3DDevice3_GetDirect3D(device, &d3d); - ok(SUCCEEDED(hr), "Failed to get d3d interface, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); hr = IDirect3D3_QueryInterface(d3d, &IID_IDirectDraw4, (void **)&ddraw); - ok(SUCCEEDED(hr), "Failed to get ddraw interface, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); IDirect3D3_Release(d3d); hr = IDirectDraw4_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 = IDirectDrawSurface4_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 = IDirectDrawSurface4_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 = IDirectDraw4_RestoreAllSurfaces(ddraw); - ok(SUCCEEDED(hr), "Failed to restore surfaces, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirectDrawSurface4_Lock(rt, NULL, &lock, DDLOCK_READONLY, NULL); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface4_Unlock(rt, NULL); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice3_GetRenderTarget(device, &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 = IDirect3DDevice3_GetRenderState(device, D3DRENDERSTATE_ZENABLE, &value); - ok(SUCCEEDED(hr), "Failed to get render state, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); ok(!!value, "Got unexpected z-enable state %#x.\n", value); hr = IDirect3DDevice3_GetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, &value); - ok(SUCCEEDED(hr), "Failed to get render state, hr %#x.\n", hr); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); ok(!!value, "Got unexpected alpha blend enable state %#x.\n", value); hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xff00ff00, 1.0f, 0); - 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), "Got unexpected color 0x%08x.\n", color);