diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 3f8d2bd1c68..2cc65185cd0 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -96,6 +96,13 @@ static void destroy_window_thread(struct create_window_thread_param *p) CloseHandle(p->thread); } +static HRESULT set_display_mode(IDirectDraw *ddraw, DWORD width, DWORD height) +{ + if (SUCCEEDED(IDirectDraw_SetDisplayMode(ddraw, width, height, 32))) + return DD_OK; + return IDirectDraw_SetDisplayMode(ddraw, width, height, 24); +} + static D3DCOLOR get_surface_color(IDirectDrawSurface *surface, UINT x, UINT y) { RECT rect = {x, y, x + 1, y + 1}; @@ -2190,8 +2197,8 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2315,7 +2322,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 32); + hr = set_display_mode(ddraw, 640, 480); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping remaining tests.\n"); @@ -2323,7 +2330,7 @@ static void test_coop_level_mode_set(void) IDirectDraw_Release(ddraw); goto done; } - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2446,8 +2453,8 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2532,8 +2539,8 @@ static void test_coop_level_mode_set(void) /* Unlike ddraw2-7, changing from EXCLUSIVE to NORMAL does not restore the resolution */ hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); - hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2591,7 +2598,7 @@ 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); + hr = set_display_mode(ddraw1, 800, 600); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping test.\n"); @@ -2599,7 +2606,7 @@ static void test_coop_level_mode_set_multi(void) DestroyWindow(window); return; } - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2615,16 +2622,16 @@ static void test_coop_level_mode_set_multi(void) /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ ddraw1 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw1, 800, 600, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw2, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2646,16 +2653,16 @@ static void test_coop_level_mode_set_multi(void) /* Regardless of release ordering. */ ddraw1 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw1, 800, 600, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw2, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2678,8 +2685,8 @@ static void test_coop_level_mode_set_multi(void) /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); ddraw2 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw2, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2702,16 +2709,16 @@ static void test_coop_level_mode_set_multi(void) /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ ddraw1 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw1, 800, 600, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw2, 640, 480, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2736,8 +2743,8 @@ static void test_coop_level_mode_set_multi(void) /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw1, 800, 600, 32); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2747,7 +2754,7 @@ static void test_coop_level_mode_set_multi(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); ddraw2 = create_ddraw(); - hr = IDirectDraw_SetDisplayMode(ddraw2, 640, 480, 32); + hr = set_display_mode(ddraw2, 640, 480); ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr); ref = IDirectDraw_Release(ddraw1); @@ -3849,7 +3856,7 @@ static void test_flip(void) window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - hr = IDirectDraw_SetDisplayMode(ddraw, 640, 480, 32); + hr = set_display_mode(ddraw, 640, 480); 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 3aca6e2474b..e0168529d95 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -110,6 +110,13 @@ static IDirectDrawSurface *get_depth_stencil(IDirect3DDevice2 *device) return ret; } +static HRESULT set_display_mode(IDirectDraw2 *ddraw, DWORD width, DWORD height) +{ + if (SUCCEEDED(IDirectDraw2_SetDisplayMode(ddraw, width, height, 32, 0, 0))) + return DD_OK; + return IDirectDraw2_SetDisplayMode(ddraw, width, height, 24, 0, 0); +} + static D3DCOLOR get_surface_color(IDirectDrawSurface *surface, UINT x, UINT y) { RECT rect = {x, y, x + 1, y + 1}; @@ -2401,8 +2408,8 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2526,7 +2533,7 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw, 640, 480); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping remaining tests.\n"); @@ -2534,7 +2541,7 @@ static void test_coop_level_mode_set(void) IDirectDraw2_Release(ddraw); goto done; } - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2657,8 +2664,8 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2743,8 +2750,8 @@ static void test_coop_level_mode_set(void) /* Changing the coop level from EXCLUSIVE to NORMAL restores the screen resolution */ 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2782,8 +2789,8 @@ static void test_coop_level_mode_set(void) /* The screen restore is a property of DDSCL_EXCLUSIVE */ hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2809,8 +2816,8 @@ static void test_coop_level_mode_set(void) /* If the window is changed at the same time, messages are sent to the new 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2891,7 +2898,7 @@ 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); + hr = set_display_mode(ddraw1, 800, 600); if (hr == DDERR_NOEXCLUSIVEMODE /* NT4 testbot */) { win_skip("Broken SetDisplayMode(), skipping test.\n"); @@ -2899,7 +2906,7 @@ static void test_coop_level_mode_set_multi(void) DestroyWindow(window); return; } - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2915,16 +2922,16 @@ static void test_coop_level_mode_set_multi(void) /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ ddraw1 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2946,16 +2953,16 @@ static void test_coop_level_mode_set_multi(void) /* Regardless of release ordering. */ ddraw1 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2978,8 +2985,8 @@ static void test_coop_level_mode_set_multi(void) /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); ddraw2 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3002,16 +3009,16 @@ static void test_coop_level_mode_set_multi(void) /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ ddraw1 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3036,8 +3043,8 @@ static void test_coop_level_mode_set_multi(void) /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3047,7 +3054,7 @@ static void test_coop_level_mode_set_multi(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); ddraw2 = create_ddraw(); - hr = IDirectDraw2_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw2, 640, 480); ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr); ref = IDirectDraw2_Release(ddraw1); @@ -3225,8 +3232,8 @@ 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -4530,7 +4537,7 @@ static void test_flip(void) window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - hr = IDirectDraw2_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw, 640, 480); 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); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index c29ed406384..0786e8b524e 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -150,6 +150,13 @@ static IDirectDrawSurface4 *get_depth_stencil(IDirect3DDevice3 *device) return ret; } +static HRESULT set_display_mode(IDirectDraw4 *ddraw, DWORD width, DWORD height) +{ + if (SUCCEEDED(IDirectDraw4_SetDisplayMode(ddraw, width, height, 32, 0, 0))) + return DD_OK; + return IDirectDraw4_SetDisplayMode(ddraw, width, height, 24, 0, 0); +} + static D3DCOLOR get_surface_color(IDirectDrawSurface4 *surface, UINT x, UINT y) { RECT rect = {x, y, x + 1, y + 1}; @@ -2525,8 +2532,8 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2650,8 +2657,8 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2774,8 +2781,8 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2860,8 +2867,8 @@ static void test_coop_level_mode_set(void) /* Changing the coop level from EXCLUSIVE to NORMAL restores the screen resolution */ 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2899,8 +2906,8 @@ static void test_coop_level_mode_set(void) /* The screen restore is a property of DDSCL_EXCLUSIVE */ hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2926,8 +2933,8 @@ static void test_coop_level_mode_set(void) /* If the window is changed at the same time, messages are sent to the new 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -3007,8 +3014,8 @@ 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); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3024,16 +3031,16 @@ static void test_coop_level_mode_set_multi(void) /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ ddraw1 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3055,16 +3062,16 @@ static void test_coop_level_mode_set_multi(void) /* Regardless of release ordering. */ ddraw1 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3087,8 +3094,8 @@ static void test_coop_level_mode_set_multi(void) /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); ddraw2 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3111,16 +3118,16 @@ static void test_coop_level_mode_set_multi(void) /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ ddraw1 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3145,8 +3152,8 @@ static void test_coop_level_mode_set_multi(void) /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -3156,7 +3163,7 @@ static void test_coop_level_mode_set_multi(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); ddraw2 = create_ddraw(); - hr = IDirectDraw4_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw2, 640, 480); ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr); ref = IDirectDraw4_Release(ddraw1); @@ -3458,8 +3465,8 @@ 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -5135,7 +5142,7 @@ static void test_flip(void) window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - hr = IDirectDraw4_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw, 640, 480); 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 76a44fe57fc..287c5c3f719 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -165,6 +165,13 @@ static IDirectDrawSurface7 *get_depth_stencil(IDirect3DDevice7 *device) return ret; } +static HRESULT set_display_mode(IDirectDraw7 *ddraw, DWORD width, DWORD height) +{ + if (SUCCEEDED(IDirectDraw7_SetDisplayMode(ddraw, width, height, 32, 0, 0))) + return DD_OK; + return IDirectDraw7_SetDisplayMode(ddraw, width, height, 24, 0, 0); +} + static D3DCOLOR get_surface_color(IDirectDrawSurface7 *surface, UINT x, UINT y) { RECT rect = {x, y, x + 1, y + 1}; @@ -2251,8 +2258,8 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2376,8 +2383,8 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2500,8 +2507,8 @@ static void test_coop_level_mode_set(void) screen_size.cx = 0; screen_size.cy = 0; - hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); ok(!*expect_messages, "Expected message %#x, but didn't receive it.\n", *expect_messages); expect_messages = NULL; @@ -2586,8 +2593,8 @@ static void test_coop_level_mode_set(void) /* Changing the coop level from EXCLUSIVE to NORMAL restores the screen resolution */ 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2625,8 +2632,8 @@ static void test_coop_level_mode_set(void) /* The screen restore is a property of DDSCL_EXCLUSIVE */ hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL | 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -2652,8 +2659,8 @@ static void test_coop_level_mode_set(void) /* If the window is changed at the same time, messages are sent to the new 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); expect_messages = exclusive_messages; screen_size.cx = 0; @@ -2733,8 +2740,8 @@ 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); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2750,16 +2757,16 @@ static void test_coop_level_mode_set_multi(void) /* When there are multiple ddraw objects, the display mode is restored to * the initial mode, before the first SetDisplayMode() call. */ ddraw1 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2781,16 +2788,16 @@ static void test_coop_level_mode_set_multi(void) /* Regardless of release ordering. */ ddraw1 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2813,8 +2820,8 @@ static void test_coop_level_mode_set_multi(void) /* But only for ddraw objects that called SetDisplayMode(). */ ddraw1 = create_ddraw(); ddraw2 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2837,16 +2844,16 @@ static void test_coop_level_mode_set_multi(void) /* If there's a ddraw object that's currently in exclusive mode, it blocks * restoring the display mode. */ ddraw1 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); ok(h == 600, "Got unexpected screen height %u.\n", h); ddraw2 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw2, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 640, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2871,8 +2878,8 @@ static void test_coop_level_mode_set_multi(void) /* Exclusive mode blocks mode setting on other ddraw objects in general. */ ddraw1 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw1, 800, 600, 32, 0, 0); - ok(SUCCEEDED(hr), "SetDisplayMode failed, hr %#x.\n", hr); + hr = set_display_mode(ddraw1, 800, 600); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); w = GetSystemMetrics(SM_CXSCREEN); ok(w == 800, "Got unexpected screen width %u.\n", w); h = GetSystemMetrics(SM_CYSCREEN); @@ -2882,7 +2889,7 @@ static void test_coop_level_mode_set_multi(void) ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); ddraw2 = create_ddraw(); - hr = IDirectDraw7_SetDisplayMode(ddraw2, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw2, 640, 480); ok(hr == DDERR_NOEXCLUSIVEMODE, "Got unexpected hr %#x.\n", hr); ref = IDirectDraw7_Release(ddraw1); @@ -3181,8 +3188,8 @@ 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); + hr = set_display_mode(ddraw, 640, 480); + ok(SUCCEEDED(hr), "Failed to set display mode, hr %#x.\n", hr); hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL); ok(SUCCEEDED(hr), "SetCooperativeLevel failed, hr %#x.\n", hr); @@ -5013,7 +5020,7 @@ static void test_flip(void) window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); - hr = IDirectDraw7_SetDisplayMode(ddraw, 640, 480, 32, 0, 0); + hr = set_display_mode(ddraw, 640, 480); 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);