ddraw/tests: Skip some tests when switching the display mode is not supported.
Francois Gouget
fgouget at codeweavers.com
Mon Feb 17 10:45:23 CST 2014
This can happen on Windows 8 when the 'Microsoft Basic Display Adapter' driver does not recognize the graphics card, for instance QEmu's 'vga' graphics card.
---
dlls/ddraw/tests/ddraw1.c | 29 +++++++++++++++++++++++----
dlls/ddraw/tests/ddraw2.c | 51 +++++++++++++++++++++++++++++++++++------------
dlls/ddraw/tests/ddraw4.c | 32 ++++++++++++++++++++++++++++-
dlls/ddraw/tests/ddraw7.c | 39 +++++++++++++++++++++++++++++++++++-
4 files changed, 132 insertions(+), 19 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index ba7589b..56620fe 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -2078,6 +2078,14 @@ static void test_redundant_mode_set(void)
hr = IDirectDraw_SetDisplayMode(ddraw, surface_desc.dwWidth, surface_desc.dwHeight,
U1(surface_desc.ddpfPixelFormat).dwRGBBitCount);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (%dbpp)\n",
+ U1(surface_desc.ddpfPixelFormat).dwRGBBitCount);
+ IDirectDraw_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
GetWindowRect(window, &r);
@@ -2191,6 +2199,13 @@ static void test_coop_level_mode_set(void)
screen_size.cy = 0;
hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 32);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (32bpp)\n");
+ IDirectDrawSurface_Release(primary);
+ IDirectDraw_Release(ddraw);
+ goto done;
+ }
ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages);
@@ -2593,15 +2608,14 @@ static void test_coop_level_mode_set_multi(void)
/* With just a single ddraw object, the display mode is restored on
* release. */
hr = IDirectDraw_SetDisplayMode(ddraw1, 800, 600, 32);
- ok(SUCCEEDED(hr) || broken(hr == DDERR_NOEXCLUSIVEMODE) /* NT4 testbot */,
- "SetDisplayMode failed, hr %#x.\n", hr);
- if (hr == DDERR_NOEXCLUSIVEMODE)
+ if (hr == E_NOTIMPL || hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */)
{
- win_skip("Broken SetDisplayMode(), skipping test.\n");
+ win_skip("SetDisplayMode() not working (hr=%#x, 32bpp)\n", hr);
IDirectDraw_Release(ddraw1);
DestroyWindow(window);
return;
}
+ ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
w = GetSystemMetrics(SM_CXSCREEN);
ok(w == 800, "Got unexpected screen width %u.\n", w);
h = GetSystemMetrics(SM_CYSCREEN);
@@ -3852,6 +3866,13 @@ static void test_flip(void)
0, 0, 640, 480, 0, 0, 0, 0);
hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 32);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (32bpp)\n");
+ IDirectDraw_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index f46c515..3a665a3 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -839,7 +839,7 @@ static void test_surface_interface_mismatch(void)
/* Here too */
hr = IDirect3D2_CreateDevice(d3d, &IID_IDirect3DHALDevice, (IDirectDrawSurface *)surface3, &device);
- ok(SUCCEEDED(hr), "Failed to create d3d device.\n");
+ ok(SUCCEEDED(hr), "Failed to create d3d device (%#x)\n", hr);
if (FAILED(hr))
goto cleanup;
@@ -969,12 +969,14 @@ static void test_depth_blit(void)
SetRect(&src_rect, 0, 0, 320, 240);
SetRect(&dst_rect, 0, 0, 320, 240);
hr = IDirectDrawSurface_Blt(ds2, &dst_rect, ds1, &src_rect, DDBLT_WAIT, NULL);
- ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL /* GMA945 */),
+ "Got unexpected hr %#x.\n", hr);
/* Different locations. */
SetRect(&src_rect, 0, 0, 320, 240);
SetRect(&dst_rect, 320, 240, 640, 480);
hr = IDirectDrawSurface_Blt(ds2, &dst_rect, ds1, &src_rect, DDBLT_WAIT, NULL);
- ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL /* GMA945 */),
+ "Got unexpected hr %#x.\n", hr);
/* Streched. */
SetRect(&src_rect, 0, 0, 320, 240);
SetRect(&dst_rect, 0, 0, 640, 480);
@@ -993,7 +995,8 @@ static void test_depth_blit(void)
SetRect(&src_rect, 0, 0, 640, 480);
SetRect(&dst_rect, 0, 0, 640, 480);
hr = IDirectDrawSurface_Blt(ds2, &dst_rect, ds1, &src_rect, DDBLT_WAIT, NULL);
- ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL /* GMA945 */),
+ "Got unexpected hr %#x.\n", hr);
/* Depth -> color blit: Succeeds on Win7 + Radeon HD 5700, fails on WinXP + Radeon X1600 */
/* Depth blit inside a BeginScene / EndScene pair */
@@ -1001,10 +1004,11 @@ static void test_depth_blit(void)
ok(SUCCEEDED(hr), "Failed to start a scene, hr %#x.\n", hr);
/* From the current depth stencil */
hr = IDirectDrawSurface_Blt(ds2, NULL, ds1, NULL, DDBLT_WAIT, NULL);
- ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL), "Got unexpected hr %#x.\n", hr);
/* To the current depth stencil */
hr = IDirectDrawSurface_Blt(ds1, NULL, ds2, NULL, DDBLT_WAIT, NULL);
- ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
+ ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL /* GMA945 */),
+ "Got unexpected hr %#x.\n", hr);
/* Between unbound surfaces */
hr = IDirectDrawSurface_Blt(ds3, NULL, ds2, NULL, DDBLT_WAIT, NULL);
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
@@ -2274,6 +2278,14 @@ static void test_redundant_mode_set(void)
hr = IDirectDraw2_SetDisplayMode(ddraw, surface_desc.dwWidth, surface_desc.dwHeight,
U1(surface_desc.ddpfPixelFormat).dwRGBBitCount, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (%dbpp)\n",
+ U1(surface_desc.ddpfPixelFormat).dwRGBBitCount);
+ IDirectDraw2_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
GetWindowRect(window, &r);
@@ -2402,6 +2414,13 @@ static void test_coop_level_mode_set(void)
screen_size.cy = 0;
hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (32bpp)\n");
+ IDirectDrawSurface_Release(primary);
+ IDirectDraw2_Release(ddraw);
+ goto done;
+ }
ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages);
@@ -2893,15 +2912,14 @@ static void test_coop_level_mode_set_multi(void)
/* With just a single ddraw object, the display mode is restored on
* release. */
hr = IDirectDraw2_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0);
- ok(SUCCEEDED(hr) || broken(hr == DDERR_NOEXCLUSIVEMODE) /* NT4 testbot */,
- "SetDisplayMode failed, hr %#x.\n", hr);
- if (hr == DDERR_NOEXCLUSIVEMODE)
+ if (hr == E_NOTIMPL || hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */)
{
- win_skip("Broken SetDisplayMode(), skipping test.\n");
+ win_skip("SetDisplayMode() not working (hr=%#x, 32bpp)\n", hr);
IDirectDraw2_Release(ddraw1);
DestroyWindow(window);
return;
}
+ ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
w = GetSystemMetrics(SM_CXSCREEN);
ok(w == 800, "Got unexpected screen width %u.\n", w);
h = GetSystemMetrics(SM_CYSCREEN);
@@ -3228,7 +3246,7 @@ static BOOL test_mode_restored(IDirectDraw2 *ddraw, HWND window)
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0);
- ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
+ ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL), "SetDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
@@ -4533,6 +4551,13 @@ static void test_flip(void)
0, 0, 640, 480, 0, 0, 0, 0);
hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (32bpp)\n");
+ IDirectDraw2_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
@@ -4739,7 +4764,7 @@ static void test_set_surface_desc(void)
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
reset_ddsd(&ddsd);
- ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_PIXELFORMAT;
+ ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS/* | DDSD_PIXELFORMAT*/;
ddsd.dwWidth = 8;
ddsd.dwHeight = 8;
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
@@ -4751,7 +4776,7 @@ static void test_set_surface_desc(void)
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY;
hr = IDirectDraw2_CreateSurface(ddraw, &ddsd, &surface, NULL);
- ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
+ ok(SUCCEEDED(hr) /* broken(hr == DDERR_INVALIDPIXELFORMAT)*/, "Failed to create surface, hr %#x.\n", hr);
hr = IDirectDrawSurface_QueryInterface(surface, &IID_IDirectDrawSurface3, (void **)&surface3);
ok(SUCCEEDED(hr), "Failed to get IDirectDrawSurface3 interface, hr %#x.\n", hr);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 3eb258e..6fecf84 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -2397,6 +2397,14 @@ static void test_redundant_mode_set(void)
hr = IDirectDraw4_SetDisplayMode(ddraw, surface_desc.dwWidth, surface_desc.dwHeight,
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (%dbpp)\n",
+ U1(surface_desc.ddpfPixelFormat).dwRGBBitCount);
+ IDirectDraw4_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
GetWindowRect(window, &r);
@@ -2526,6 +2534,13 @@ static void test_coop_level_mode_set(void)
screen_size.cy = 0;
hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (32bpp)\n");
+ IDirectDrawSurface_Release(primary);
+ IDirectDraw4_Release(ddraw);
+ goto done;
+ }
ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages);
@@ -2978,6 +2993,7 @@ static void test_coop_level_mode_set(void)
s.left, s.top, s.right, s.bottom,
r.left, r.top, r.right, r.bottom);
+done:
expect_messages = NULL;
DestroyWindow(window);
DestroyWindow(window2);
@@ -3008,6 +3024,13 @@ static void test_coop_level_mode_set_multi(void)
/* With just a single ddraw object, the display mode is restored on
* release. */
hr = IDirectDraw4_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("SetDisplayMode() not working (hr=%#x, 32bpp)\n", hr);
+ IDirectDraw4_Release(ddraw1);
+ DestroyWindow(window);
+ return;
+ }
ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
w = GetSystemMetrics(SM_CXSCREEN);
ok(w == 800, "Got unexpected screen width %u.\n", w);
@@ -3459,7 +3482,7 @@ static BOOL test_mode_restored(IDirectDraw4 *ddraw, HWND window)
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0);
- ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
+ ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL), "SetDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
@@ -5136,6 +5159,13 @@ static void test_flip(void)
0, 0, 640, 480, 0, 0, 0, 0);
hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (32bpp)\n");
+ IDirectDraw4_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 2a681f1..eed005e 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -2123,6 +2123,14 @@ static void test_redundant_mode_set(void)
hr = IDirectDraw7_SetDisplayMode(ddraw, surface_desc.dwWidth, surface_desc.dwHeight,
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (%dbpp)\n",
+ U1(surface_desc.ddpfPixelFormat).dwRGBBitCount);
+ IDirectDraw7_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
GetWindowRect(window, &r);
@@ -2252,6 +2260,13 @@ static void test_coop_level_mode_set(void)
screen_size.cy = 0;
hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (32bpp)\n");
+ IDirectDrawSurface_Release(primary);
+ IDirectDraw7_Release(ddraw);
+ goto done;
+ }
ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages);
@@ -2704,6 +2719,7 @@ static void test_coop_level_mode_set(void)
s.left, s.top, s.right, s.bottom,
r.left, r.top, r.right, r.bottom);
+done:
expect_messages = NULL;
DestroyWindow(window);
DestroyWindow(window2);
@@ -2734,6 +2750,13 @@ static void test_coop_level_mode_set_multi(void)
/* With just a single ddraw object, the display mode is restored on
* release. */
hr = IDirectDraw7_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("SetDisplayMode() not working (hr=%#x, 32bpp)\n", hr);
+ IDirectDraw7_Release(ddraw1);
+ DestroyWindow(window);
+ return;
+ }
ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
w = GetSystemMetrics(SM_CXSCREEN);
ok(w == 800, "Got unexpected screen width %u.\n", w);
@@ -3182,7 +3205,7 @@ static BOOL test_mode_restored(IDirectDraw7 *ddraw, HWND window)
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0);
- ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr);
+ ok(SUCCEEDED(hr) || broken(hr == E_NOTIMPL), "SetDisplayMode failed, hr %#x.\n", hr);
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr);
@@ -5014,6 +5037,13 @@ static void test_flip(void)
0, 0, 640, 480, 0, 0, 0, 0);
hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (32bpp)\n");
+ IDirectDraw7_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
@@ -5650,6 +5680,13 @@ static void test_primary_palette(void)
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, 0, 0, 0, 0);
hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 8, 0, 0);
+ if (hr == E_NOTIMPL)
+ {
+ win_skip("changing display mode is not supported (8bpp)\n");
+ IDirectDraw7_Release(ddraw);
+ DestroyWindow(window);
+ return;
+ }
ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr);
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
--
1.8.5.3
More information about the wine-patches
mailing list