Paul Gofman : ddraw/tests: Test locking lost surface for ddraw1.
Alexandre Julliard
julliard at winehq.org
Thu Mar 26 16:27:24 CDT 2020
Module: wine
Branch: master
Commit: 792dc34978c6bcc4bd08a39cb6b4ef9510e3dabe
URL: https://source.winehq.org/git/wine.git/?a=commit;h=792dc34978c6bcc4bd08a39cb6b4ef9510e3dabe
Author: Paul Gofman <gofmanp at gmail.com>
Date: Thu Mar 26 16:09:44 2020 +0300
ddraw/tests: Test locking lost surface for ddraw1.
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ddraw/tests/ddraw1.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 5bfca43008..ff100c64aa 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -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);
More information about the wine-cvs
mailing list