From: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
Signed-off-by: Gabriel Ivăncescu <gabrielopcode(a)gmail.com>
Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com>
---
This supersedes patch 189880. Minor style changes.
dlls/ddraw/tests/ddraw1.c | 99 +++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw2.c | 99 +++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw4.c | 104 +++++++++++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw7.c | 104 +++++++++++++++++++++++++++++++++++++-
4 files changed, 402 insertions(+), 4 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 652e52a05c4..2fc454a6069 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -7309,8 +7309,8 @@ static void test_palette_alpha(void)
static void test_lost_device(void)
{
+ IDirectDrawSurface *sysmem_surface, *vidmem_surface;
IDirectDrawSurface *surface, *back_buffer;
- IDirectDrawSurface *sysmem_surface;
DDSURFACEDESC surface_desc;
HWND window1, window2;
IDirectDraw *ddraw;
@@ -7345,12 +7345,35 @@ static void test_lost_device(void)
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &sysmem_surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
+ surface_desc.dwWidth = 64;
+ surface_desc.dwHeight = 64;
+ surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat);
+ surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(surface_desc.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(surface_desc.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(surface_desc.ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ if (FAILED(IDirectDraw_CreateSurface(ddraw, &surface_desc, &vidmem_surface, NULL)))
+ {
+ skip("Failed to create video memory surface, skipping related tests.\n");
+ vidmem_surface = NULL;
+ }
+
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -7360,6 +7383,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -7369,6 +7397,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = restore_surfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7378,6 +7411,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7388,6 +7426,11 @@ static void test_lost_device(void)
"Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK || broken(ddraw_is_warp(ddraw) && hr == DDERR_SURFACELOST), "Got unexpected hr %#x.\n", hr);
+ }
/* Trying to restore the primary will crash, probably because flippable
* surfaces can't exist in DDSCL_NORMAL. */
@@ -7398,6 +7441,8 @@ static void test_lost_device(void)
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = restore_surfaces(ddraw);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7408,6 +7453,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -7415,6 +7465,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window1, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7422,6 +7477,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = restore_surfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7429,6 +7489,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
IDirectDrawSurface_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -7447,6 +7512,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7456,6 +7526,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7465,6 +7540,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7474,6 +7554,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7483,6 +7568,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw_SetCooperativeLevel(ddraw, window2, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -7492,6 +7582,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
memset(&caps, 0, sizeof(caps));
caps.dwCaps = DDSCAPS_FLIP;
@@ -7506,6 +7601,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface_Release(back_buffer);
+ if (vidmem_surface)
+ IDirectDrawSurface_Release(vidmem_surface);
IDirectDrawSurface_Release(sysmem_surface);
IDirectDrawSurface_Release(surface);
refcount = IDirectDraw_Release(ddraw);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index edaf868900c..311c7a159df 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -8262,8 +8262,8 @@ static void test_palette_alpha(void)
static void test_lost_device(void)
{
+ IDirectDrawSurface *sysmem_surface, *vidmem_surface;
IDirectDrawSurface *surface, *back_buffer;
- IDirectDrawSurface *sysmem_surface;
DDSURFACEDESC surface_desc;
HWND window1, window2;
IDirectDraw2 *ddraw;
@@ -8298,12 +8298,35 @@ static void test_lost_device(void)
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &sysmem_surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
+ surface_desc.dwWidth = 64;
+ surface_desc.dwHeight = 64;
+ surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat);
+ surface_desc.ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(surface_desc.ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(surface_desc.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(surface_desc.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(surface_desc.ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ if (FAILED(IDirectDraw2_CreateSurface(ddraw, &surface_desc, &vidmem_surface, NULL)))
+ {
+ skip("Failed to create video memory surface, skipping related tests.\n");
+ vidmem_surface = NULL;
+ }
+
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -8313,6 +8336,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -8322,6 +8350,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = restore_surfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8331,6 +8364,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8340,6 +8378,11 @@ static void test_lost_device(void)
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
/* Trying to restore the primary will crash, probably because flippable
* surfaces can't exist in DDSCL_NORMAL. */
@@ -8350,6 +8393,8 @@ static void test_lost_device(void)
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = restore_surfaces(ddraw);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8360,6 +8405,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -8367,6 +8417,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window1, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8374,6 +8429,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = restore_surfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8381,6 +8441,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
IDirectDrawSurface_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -8399,6 +8464,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8408,6 +8478,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8417,6 +8492,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8426,6 +8506,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8435,6 +8520,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window2, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -8444,6 +8534,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
memset(&caps, 0, sizeof(caps));
caps.dwCaps = DDSCAPS_FLIP;
@@ -8458,6 +8553,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface_Release(back_buffer);
+ if (vidmem_surface)
+ IDirectDrawSurface_Release(vidmem_surface);
IDirectDrawSurface_Release(sysmem_surface);
IDirectDrawSurface_Release(surface);
refcount = IDirectDraw2_Release(ddraw);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index d1abde05ca0..8eee655bba4 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -9655,8 +9655,8 @@ static void test_vb_writeonly(void)
static void test_lost_device(void)
{
+ IDirectDrawSurface4 *sysmem_surface, *vidmem_surface;
IDirectDrawSurface4 *surface, *back_buffer;
- IDirectDrawSurface4 *sysmem_surface;
DDSURFACEDESC2 surface_desc;
HWND window1, window2;
IDirectDraw4 *ddraw;
@@ -9691,6 +9691,24 @@ static void test_lost_device(void)
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &sysmem_surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
+ surface_desc.dwWidth = 64;
+ surface_desc.dwHeight = 64;
+ U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
+ U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ if (FAILED(IDirectDraw4_CreateSurface(ddraw, &surface_desc, &vidmem_surface, NULL)))
+ {
+ skip("Failed to create video memory surface, skipping related tests.\n");
+ vidmem_surface = NULL;
+ }
+
hr = IDirectDraw4_TestCooperativeLevel(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(surface);
@@ -9699,6 +9717,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -9710,6 +9733,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -9721,6 +9749,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_RestoreAllSurfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9732,6 +9765,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9743,6 +9781,11 @@ static void test_lost_device(void)
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
/* Trying to restore the primary will crash, probably because flippable
* surfaces can't exist in DDSCL_NORMAL. */
@@ -9753,6 +9796,8 @@ static void test_lost_device(void)
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDraw4_RestoreAllSurfaces(ddraw);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw4_TestCooperativeLevel(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9760,6 +9805,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -9769,6 +9819,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -9778,6 +9833,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window1, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9787,6 +9847,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_RestoreAllSurfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9796,6 +9861,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
IDirectDrawSurface4_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -9816,6 +9886,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9827,6 +9902,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9838,6 +9918,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9849,6 +9934,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9860,6 +9950,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window2, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9869,6 +9964,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface4_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface4_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDrawSurface4_Flip(surface, NULL, DDFLIP_WAIT);
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
@@ -9886,6 +9986,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
IDirectDrawSurface4_Release(back_buffer);
+ if (vidmem_surface)
+ IDirectDrawSurface4_Release(vidmem_surface);
IDirectDrawSurface4_Release(sysmem_surface);
IDirectDrawSurface4_Release(surface);
refcount = IDirectDraw4_Release(ddraw);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 13eadfdf132..778b1738fa9 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -9413,8 +9413,8 @@ static void test_vb_writeonly(void)
static void test_lost_device(void)
{
+ IDirectDrawSurface7 *sysmem_surface, *vidmem_surface;
IDirectDrawSurface7 *surface, *back_buffer;
- IDirectDrawSurface7 *sysmem_surface;
DDSURFACEDESC2 surface_desc;
HWND window1, window2;
IDirectDraw7 *ddraw;
@@ -9449,6 +9449,24 @@ static void test_lost_device(void)
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &sysmem_surface, NULL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ memset(&surface_desc, 0, sizeof(surface_desc));
+ surface_desc.dwSize = sizeof(surface_desc);
+ surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
+ surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY;
+ surface_desc.dwWidth = 64;
+ surface_desc.dwHeight = 64;
+ U4(surface_desc).ddpfPixelFormat.dwSize = sizeof(U4(surface_desc).ddpfPixelFormat);
+ U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB;
+ U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
+ U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
+ U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
+ U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
+ if (FAILED(IDirectDraw7_CreateSurface(ddraw, &surface_desc, &vidmem_surface, NULL)))
+ {
+ skip("Failed to create video memory surface, skipping related tests.\n");
+ vidmem_surface = NULL;
+ }
+
hr = IDirectDraw7_TestCooperativeLevel(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(surface);
@@ -9457,6 +9475,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -9468,6 +9491,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -9479,6 +9507,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_RestoreAllSurfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9490,6 +9523,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9501,6 +9539,11 @@ static void test_lost_device(void)
todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ todo_wine ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
/* Trying to restore the primary will crash, probably because flippable
* surfaces can't exist in DDSCL_NORMAL. */
@@ -9513,6 +9556,8 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ hr = IDirectDraw7_RestoreAllSurfaces(ddraw);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDraw7_TestCooperativeLevel(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9520,6 +9565,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(GetDesktopWindow());
ok(ret, "Failed to set foreground window.\n");
@@ -9529,6 +9579,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
ret = SetForegroundWindow(window1);
ok(ret, "Failed to set foreground window.\n");
@@ -9538,6 +9593,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window1, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9547,6 +9607,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_RestoreAllSurfaces(ddraw);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9556,6 +9621,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
IDirectDrawSurface7_Release(surface);
memset(&surface_desc, 0, sizeof(surface_desc));
@@ -9576,6 +9646,11 @@ static void test_lost_device(void)
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9587,6 +9662,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window1, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9598,6 +9678,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9609,6 +9694,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_NORMAL | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9620,6 +9710,11 @@ static void test_lost_device(void)
ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ }
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window2, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
@@ -9631,6 +9726,11 @@ static void test_lost_device(void)
ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
hr = IDirectDrawSurface7_IsLost(sysmem_surface);
ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+ if (vidmem_surface)
+ {
+ hr = IDirectDrawSurface7_IsLost(vidmem_surface);
+ ok(hr == DDERR_SURFACELOST, "Got unexpected hr %#x.\n", hr);
+ }
memset(&caps, 0, sizeof(caps));
caps.dwCaps = DDSCAPS_FLIP;
@@ -9646,6 +9746,8 @@ static void test_lost_device(void)
IDirectDrawSurface7_Release(back_buffer);
+ if (vidmem_surface)
+ IDirectDrawSurface7_Release(vidmem_surface);
IDirectDrawSurface7_Release(sysmem_surface);
IDirectDrawSurface7_Release(surface);
refcount = IDirectDraw7_Release(ddraw);
--
2.20.1