From 426a9efc3a696b4fa2765988e4b96ced1138699a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sun, 7 Aug 2016 20:22:50 +0100 Subject: [PATCH] ddraw/tests: Skip overlay tests if DWM is on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Dösinger Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/ddraw/tests/ddraw1.c | 34 +++++++++++++++++++++++++++++++--- dlls/ddraw/tests/ddraw2.c | 34 +++++++++++++++++++++++++++++++--- dlls/ddraw/tests/ddraw4.c | 34 +++++++++++++++++++++++++++++++--- dlls/ddraw/tests/ddraw7.c | 34 +++++++++++++++++++++++++++++++--- 4 files changed, 124 insertions(+), 12 deletions(-) diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 923aea33d4e..bfc6bfe8cf4 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -25,6 +25,8 @@ static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static DEVMODEW registry_mode; +static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *); + struct create_window_thread_param { HWND window; @@ -8455,6 +8457,19 @@ done: DestroyWindow(window); } +static BOOL dwm_enabled(void) +{ + BOOL ret = FALSE; + + if (!strcmp(winetest_platform, "wine")) + return FALSE; + if (!pDwmIsCompositionEnabled) + return FALSE; + if (FAILED(pDwmIsCompositionEnabled(&ret))) + return FALSE; + return ret; +} + static void test_offscreen_overlay(void) { IDirectDrawSurface *overlay, *offscreen, *primary; @@ -8516,7 +8531,8 @@ static void test_offscreen_overlay(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); - ok(SUCCEEDED(hr), "Failed to update overlay, hr %#x.\n", hr); + ok(SUCCEEDED(hr) || broken(hr == DDERR_OUTOFCAPS && dwm_enabled()), + "Failed to update overlay, hr %#x.\n", hr); /* Try to overlay the primary with a non-overlay surface. */ hr = IDirectDrawSurface_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL); @@ -8534,7 +8550,7 @@ done: static void test_overlay_rect(void) { - IDirectDrawSurface *overlay, *primary; + IDirectDrawSurface *overlay, *primary = NULL; DDSURFACEDESC surface_desc; RECT rect = {0, 0, 64, 64}; IDirectDraw *ddraw; @@ -8571,6 +8587,13 @@ static void test_overlay_rect(void) hr = IDirectDrawSurface_ReleaseDC(primary, dc); ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); + /* On Windows 8 and newer DWM can't be turned off, making overlays unusable. */ + if (dwm_enabled()) + { + win_skip("Cannot disable DWM, skipping overlay test.\n"); + goto done; + } + /* The dx sdk sort of implies that rect must be set when DDOVER_SHOW is * used. This is not true in Windows Vista and earlier, but changed in * Windows 7. */ @@ -8618,9 +8641,10 @@ static void test_overlay_rect(void) ok(!pos_x, "Got unexpected pos_x %d.\n", pos_x); ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y); - IDirectDrawSurface_Release(primary); IDirectDrawSurface_Release(overlay); done: + if (primary) + IDirectDrawSurface_Release(primary); IDirectDraw_Release(ddraw); DestroyWindow(window); } @@ -9051,6 +9075,7 @@ START_TEST(ddraw1) { IDirectDraw *ddraw; DEVMODEW current_mode; + HMODULE dwmapi; if (!(ddraw = create_ddraw())) { @@ -9071,6 +9096,9 @@ START_TEST(ddraw1) return; } + if ((dwmapi = LoadLibraryA("dwmapi.dll"))) + pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled"); + test_coop_level_create_device_window(); test_clipper_blt(); test_coop_level_d3d_state(); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index fda7ffd793b..479b6362e90 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -27,6 +27,8 @@ static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static DEVMODEW registry_mode; +static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *); + struct create_window_thread_param { HWND window; @@ -9567,6 +9569,19 @@ done: DestroyWindow(window); } +static BOOL dwm_enabled(void) +{ + BOOL ret = FALSE; + + if (!strcmp(winetest_platform, "wine")) + return FALSE; + if (!pDwmIsCompositionEnabled) + return FALSE; + if (FAILED(pDwmIsCompositionEnabled(&ret))) + return FALSE; + return ret; +} + static void test_offscreen_overlay(void) { IDirectDrawSurface *overlay, *offscreen, *primary; @@ -9628,7 +9643,8 @@ static void test_offscreen_overlay(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); - ok(SUCCEEDED(hr), "Failed to update overlay, hr %#x.\n", hr); + ok(SUCCEEDED(hr) || broken(hr == DDERR_OUTOFCAPS && dwm_enabled()), + "Failed to update overlay, hr %#x.\n", hr); /* Try to overlay the primary with a non-overlay surface. */ hr = IDirectDrawSurface_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL); @@ -9646,7 +9662,7 @@ done: static void test_overlay_rect(void) { - IDirectDrawSurface *overlay, *primary; + IDirectDrawSurface *overlay, *primary = NULL; DDSURFACEDESC surface_desc; RECT rect = {0, 0, 64, 64}; IDirectDraw2 *ddraw; @@ -9683,6 +9699,13 @@ static void test_overlay_rect(void) hr = IDirectDrawSurface_ReleaseDC(primary, dc); ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); + /* On Windows 8 and newer DWM can't be turned off, making overlays unusable. */ + if (dwm_enabled()) + { + win_skip("Cannot disable DWM, skipping overlay test.\n"); + goto done; + } + /* The dx sdk sort of implies that rect must be set when DDOVER_SHOW is * used. This is not true in Windows Vista and earlier, but changed in * Windows 7. */ @@ -9730,9 +9753,10 @@ static void test_overlay_rect(void) ok(!pos_x, "Got unexpected pos_x %d.\n", pos_x); ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y); - IDirectDrawSurface_Release(primary); IDirectDrawSurface_Release(overlay); done: + if (primary) + IDirectDrawSurface_Release(primary); IDirectDraw2_Release(ddraw); DestroyWindow(window); } @@ -10224,6 +10248,7 @@ START_TEST(ddraw2) { IDirectDraw2 *ddraw; DEVMODEW current_mode; + HMODULE dwmapi; if (!(ddraw = create_ddraw())) { @@ -10244,6 +10269,9 @@ START_TEST(ddraw2) return; } + if ((dwmapi = LoadLibraryA("dwmapi.dll"))) + pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled"); + test_coop_level_create_device_window(); test_clipper_blt(); test_coop_level_d3d_state(); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index efb485f9437..8cce19d216f 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -27,6 +27,8 @@ static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static DEVMODEW registry_mode; +static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *); + struct vec2 { float x, y; @@ -10734,6 +10736,19 @@ done: DestroyWindow(window); } +static BOOL dwm_enabled(void) +{ + BOOL ret = FALSE; + + if (!strcmp(winetest_platform, "wine")) + return FALSE; + if (!pDwmIsCompositionEnabled) + return FALSE; + if (FAILED(pDwmIsCompositionEnabled(&ret))) + return FALSE; + return ret; +} + static void test_offscreen_overlay(void) { IDirectDrawSurface4 *overlay, *offscreen, *primary; @@ -10795,7 +10810,8 @@ static void test_offscreen_overlay(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface4_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); - ok(SUCCEEDED(hr), "Failed to update overlay, hr %#x.\n", hr); + ok(SUCCEEDED(hr) || broken(hr == DDERR_OUTOFCAPS && dwm_enabled()), + "Failed to update overlay, hr %#x.\n", hr); /* Try to overlay the primary with a non-overlay surface. */ hr = IDirectDrawSurface4_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL); @@ -10813,7 +10829,7 @@ done: static void test_overlay_rect(void) { - IDirectDrawSurface4 *overlay, *primary; + IDirectDrawSurface4 *overlay, *primary = NULL; DDSURFACEDESC2 surface_desc; RECT rect = {0, 0, 64, 64}; IDirectDraw4 *ddraw; @@ -10850,6 +10866,13 @@ static void test_overlay_rect(void) hr = IDirectDrawSurface4_ReleaseDC(primary, dc); ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); + /* On Windows 8 and newer DWM can't be turned off, making overlays unusable. */ + if (dwm_enabled()) + { + win_skip("Cannot disable DWM, skipping overlay test.\n"); + goto done; + } + /* The dx sdk sort of implies that rect must be set when DDOVER_SHOW is * used. This is not true in Windows Vista and earlier, but changed in * Windows 7. */ @@ -10897,9 +10920,10 @@ static void test_overlay_rect(void) ok(!pos_x, "Got unexpected pos_x %d.\n", pos_x); ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y); - IDirectDrawSurface4_Release(primary); IDirectDrawSurface4_Release(overlay); done: + if (primary) + IDirectDrawSurface4_Release(primary); IDirectDraw4_Release(ddraw); DestroyWindow(window); } @@ -11540,6 +11564,7 @@ START_TEST(ddraw4) { IDirectDraw4 *ddraw; DEVMODEW current_mode; + HMODULE dwmapi; if (!(ddraw = create_ddraw())) { @@ -11560,6 +11585,9 @@ START_TEST(ddraw4) return; } + if ((dwmapi = LoadLibraryA("dwmapi.dll"))) + pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled"); + test_process_vertices(); test_coop_level_create_device_window(); test_clipper_blt(); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index bcd2021f6bb..024da08fd58 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -28,6 +28,8 @@ static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *guid, void **ddraw, REFIID ii static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static DEVMODEW registry_mode; +static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *); + struct vec2 { float x, y; @@ -11063,6 +11065,19 @@ done: DestroyWindow(window); } +static BOOL dwm_enabled(void) +{ + BOOL ret = FALSE; + + if (!strcmp(winetest_platform, "wine")) + return FALSE; + if (!pDwmIsCompositionEnabled) + return FALSE; + if (FAILED(pDwmIsCompositionEnabled(&ret))) + return FALSE; + return ret; +} + static void test_offscreen_overlay(void) { IDirectDrawSurface7 *overlay, *offscreen, *primary; @@ -11124,7 +11139,8 @@ static void test_offscreen_overlay(void) ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr); hr = IDirectDrawSurface7_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); - ok(SUCCEEDED(hr), "Failed to update overlay, hr %#x.\n", hr); + ok(SUCCEEDED(hr) || broken(hr == DDERR_OUTOFCAPS && dwm_enabled()), + "Failed to update overlay, hr %#x.\n", hr); /* Try to overlay the primary with a non-overlay surface. */ hr = IDirectDrawSurface7_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL); @@ -11142,7 +11158,7 @@ done: static void test_overlay_rect(void) { - IDirectDrawSurface7 *overlay, *primary; + IDirectDrawSurface7 *overlay, *primary = NULL; DDSURFACEDESC2 surface_desc; RECT rect = {0, 0, 64, 64}; IDirectDraw7 *ddraw; @@ -11179,6 +11195,13 @@ static void test_overlay_rect(void) hr = IDirectDrawSurface7_ReleaseDC(primary, dc); ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); + /* On Windows 8 and newer DWM can't be turned off, making overlays unusable. */ + if (dwm_enabled()) + { + win_skip("Cannot disable DWM, skipping overlay test.\n"); + goto done; + } + /* The dx sdk sort of implies that rect must be set when DDOVER_SHOW is * used. This is not true in Windows Vista and earlier, but changed in * Windows 7. */ @@ -11226,9 +11249,10 @@ static void test_overlay_rect(void) ok(!pos_x, "Got unexpected pos_x %d.\n", pos_x); ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y); - IDirectDrawSurface7_Release(primary); IDirectDrawSurface7_Release(overlay); done: + if (primary) + IDirectDrawSurface7_Release(primary); IDirectDraw7_Release(ddraw); DestroyWindow(window); } @@ -11860,6 +11884,7 @@ static void test_draw_primitive(void) START_TEST(ddraw7) { HMODULE module = GetModuleHandleA("ddraw.dll"); + HMODULE dwmapi; IDirectDraw7 *ddraw; DEVMODEW current_mode; @@ -11888,6 +11913,9 @@ START_TEST(ddraw7) return; } + if ((dwmapi = LoadLibraryA("dwmapi.dll"))) + pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled"); + test_process_vertices(); test_coop_level_create_device_window(); test_clipper_blt();