From dfa69cd6e328594bf3e32d129a0166a2e12deedf Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Mon, 5 Aug 2019 21:58:34 +0300 Subject: [PATCH] ddraw/tests: Test restoring attached surface for ddraw2. Signed-off-by: Paul Gofman Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard (cherry picked from commit d8812edc6584d434c4ffd68dc7a3a783623a3703) Signed-off-by: Michael Stefaniuc --- dlls/ddraw/tests/ddraw2.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 3aedadfe1ee..953ece2b884 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -8005,11 +8005,12 @@ static void test_palette_alpha(void) static void test_lost_device(void) { - IDirectDrawSurface *surface; + IDirectDrawSurface *surface, *back_buffer; DDSURFACEDESC surface_desc; HWND window1, window2; IDirectDraw2 *ddraw; ULONG refcount; + DDSCAPS caps; HRESULT hr; BOOL ret; @@ -8147,6 +8148,19 @@ static void test_lost_device(void) hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT); ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + memset(&caps, 0, sizeof(caps)); + caps.dwCaps = DDSCAPS_FLIP; + + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &back_buffer); + ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_Restore(surface); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_GetAttachedSurface(surface, &caps, &back_buffer); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); + hr = IDirectDrawSurface_IsLost(back_buffer); + ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr); + IDirectDrawSurface_Release(back_buffer); + IDirectDrawSurface_Release(surface); refcount = IDirectDraw2_Release(ddraw); ok(!refcount, "Got unexpected refcount %u.\n", refcount);