ddraw/tests: Skip overlay tests if DWM is on.

Signed-off-by: Stefan Dösinger <stefandoesinger@gmx.at>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Dösinger 2016-08-07 20:22:50 +01:00 committed by Alexandre Julliard
parent eb5ed66aec
commit 426a9efc3a
4 changed files with 124 additions and 12 deletions

View File

@ -25,6 +25,8 @@
static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *);
static DEVMODEW registry_mode; static DEVMODEW registry_mode;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
struct create_window_thread_param struct create_window_thread_param
{ {
HWND window; HWND window;
@ -8455,6 +8457,19 @@ done:
DestroyWindow(window); 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) static void test_offscreen_overlay(void)
{ {
IDirectDrawSurface *overlay, *offscreen, *primary; 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); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr);
hr = IDirectDrawSurface_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); 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. */ /* Try to overlay the primary with a non-overlay surface. */
hr = IDirectDrawSurface_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL); hr = IDirectDrawSurface_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL);
@ -8534,7 +8550,7 @@ done:
static void test_overlay_rect(void) static void test_overlay_rect(void)
{ {
IDirectDrawSurface *overlay, *primary; IDirectDrawSurface *overlay, *primary = NULL;
DDSURFACEDESC surface_desc; DDSURFACEDESC surface_desc;
RECT rect = {0, 0, 64, 64}; RECT rect = {0, 0, 64, 64};
IDirectDraw *ddraw; IDirectDraw *ddraw;
@ -8571,6 +8587,13 @@ static void test_overlay_rect(void)
hr = IDirectDrawSurface_ReleaseDC(primary, dc); hr = IDirectDrawSurface_ReleaseDC(primary, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); 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 /* 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 * used. This is not true in Windows Vista and earlier, but changed in
* Windows 7. */ * 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_x, "Got unexpected pos_x %d.\n", pos_x);
ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y); ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y);
IDirectDrawSurface_Release(primary);
IDirectDrawSurface_Release(overlay); IDirectDrawSurface_Release(overlay);
done: done:
if (primary)
IDirectDrawSurface_Release(primary);
IDirectDraw_Release(ddraw); IDirectDraw_Release(ddraw);
DestroyWindow(window); DestroyWindow(window);
} }
@ -9051,6 +9075,7 @@ START_TEST(ddraw1)
{ {
IDirectDraw *ddraw; IDirectDraw *ddraw;
DEVMODEW current_mode; DEVMODEW current_mode;
HMODULE dwmapi;
if (!(ddraw = create_ddraw())) if (!(ddraw = create_ddraw()))
{ {
@ -9071,6 +9096,9 @@ START_TEST(ddraw1)
return; return;
} }
if ((dwmapi = LoadLibraryA("dwmapi.dll")))
pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled");
test_coop_level_create_device_window(); test_coop_level_create_device_window();
test_clipper_blt(); test_clipper_blt();
test_coop_level_d3d_state(); test_coop_level_d3d_state();

View File

@ -27,6 +27,8 @@
static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *);
static DEVMODEW registry_mode; static DEVMODEW registry_mode;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
struct create_window_thread_param struct create_window_thread_param
{ {
HWND window; HWND window;
@ -9567,6 +9569,19 @@ done:
DestroyWindow(window); 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) static void test_offscreen_overlay(void)
{ {
IDirectDrawSurface *overlay, *offscreen, *primary; 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); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr);
hr = IDirectDrawSurface_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); 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. */ /* Try to overlay the primary with a non-overlay surface. */
hr = IDirectDrawSurface_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL); hr = IDirectDrawSurface_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL);
@ -9646,7 +9662,7 @@ done:
static void test_overlay_rect(void) static void test_overlay_rect(void)
{ {
IDirectDrawSurface *overlay, *primary; IDirectDrawSurface *overlay, *primary = NULL;
DDSURFACEDESC surface_desc; DDSURFACEDESC surface_desc;
RECT rect = {0, 0, 64, 64}; RECT rect = {0, 0, 64, 64};
IDirectDraw2 *ddraw; IDirectDraw2 *ddraw;
@ -9683,6 +9699,13 @@ static void test_overlay_rect(void)
hr = IDirectDrawSurface_ReleaseDC(primary, dc); hr = IDirectDrawSurface_ReleaseDC(primary, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); 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 /* 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 * used. This is not true in Windows Vista and earlier, but changed in
* Windows 7. */ * 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_x, "Got unexpected pos_x %d.\n", pos_x);
ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y); ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y);
IDirectDrawSurface_Release(primary);
IDirectDrawSurface_Release(overlay); IDirectDrawSurface_Release(overlay);
done: done:
if (primary)
IDirectDrawSurface_Release(primary);
IDirectDraw2_Release(ddraw); IDirectDraw2_Release(ddraw);
DestroyWindow(window); DestroyWindow(window);
} }
@ -10224,6 +10248,7 @@ START_TEST(ddraw2)
{ {
IDirectDraw2 *ddraw; IDirectDraw2 *ddraw;
DEVMODEW current_mode; DEVMODEW current_mode;
HMODULE dwmapi;
if (!(ddraw = create_ddraw())) if (!(ddraw = create_ddraw()))
{ {
@ -10244,6 +10269,9 @@ START_TEST(ddraw2)
return; return;
} }
if ((dwmapi = LoadLibraryA("dwmapi.dll")))
pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled");
test_coop_level_create_device_window(); test_coop_level_create_device_window();
test_clipper_blt(); test_clipper_blt();
test_coop_level_d3d_state(); test_coop_level_d3d_state();

View File

@ -27,6 +27,8 @@
static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *);
static DEVMODEW registry_mode; static DEVMODEW registry_mode;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
struct vec2 struct vec2
{ {
float x, y; float x, y;
@ -10734,6 +10736,19 @@ done:
DestroyWindow(window); 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) static void test_offscreen_overlay(void)
{ {
IDirectDrawSurface4 *overlay, *offscreen, *primary; 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); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr);
hr = IDirectDrawSurface4_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); 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. */ /* Try to overlay the primary with a non-overlay surface. */
hr = IDirectDrawSurface4_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL); hr = IDirectDrawSurface4_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL);
@ -10813,7 +10829,7 @@ done:
static void test_overlay_rect(void) static void test_overlay_rect(void)
{ {
IDirectDrawSurface4 *overlay, *primary; IDirectDrawSurface4 *overlay, *primary = NULL;
DDSURFACEDESC2 surface_desc; DDSURFACEDESC2 surface_desc;
RECT rect = {0, 0, 64, 64}; RECT rect = {0, 0, 64, 64};
IDirectDraw4 *ddraw; IDirectDraw4 *ddraw;
@ -10850,6 +10866,13 @@ static void test_overlay_rect(void)
hr = IDirectDrawSurface4_ReleaseDC(primary, dc); hr = IDirectDrawSurface4_ReleaseDC(primary, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); 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 /* 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 * used. This is not true in Windows Vista and earlier, but changed in
* Windows 7. */ * 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_x, "Got unexpected pos_x %d.\n", pos_x);
ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y); ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y);
IDirectDrawSurface4_Release(primary);
IDirectDrawSurface4_Release(overlay); IDirectDrawSurface4_Release(overlay);
done: done:
if (primary)
IDirectDrawSurface4_Release(primary);
IDirectDraw4_Release(ddraw); IDirectDraw4_Release(ddraw);
DestroyWindow(window); DestroyWindow(window);
} }
@ -11540,6 +11564,7 @@ START_TEST(ddraw4)
{ {
IDirectDraw4 *ddraw; IDirectDraw4 *ddraw;
DEVMODEW current_mode; DEVMODEW current_mode;
HMODULE dwmapi;
if (!(ddraw = create_ddraw())) if (!(ddraw = create_ddraw()))
{ {
@ -11560,6 +11585,9 @@ START_TEST(ddraw4)
return; return;
} }
if ((dwmapi = LoadLibraryA("dwmapi.dll")))
pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled");
test_process_vertices(); test_process_vertices();
test_coop_level_create_device_window(); test_coop_level_create_device_window();
test_clipper_blt(); test_clipper_blt();

View File

@ -28,6 +28,8 @@ static HRESULT (WINAPI *pDirectDrawCreateEx)(GUID *guid, void **ddraw, REFIID ii
static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *); static BOOL is_ddraw64 = sizeof(DWORD) != sizeof(DWORD *);
static DEVMODEW registry_mode; static DEVMODEW registry_mode;
static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *);
struct vec2 struct vec2
{ {
float x, y; float x, y;
@ -11063,6 +11065,19 @@ done:
DestroyWindow(window); 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) static void test_offscreen_overlay(void)
{ {
IDirectDrawSurface7 *overlay, *offscreen, *primary; 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); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n",hr);
hr = IDirectDrawSurface7_UpdateOverlay(overlay, NULL, offscreen, NULL, DDOVER_SHOW, NULL); 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. */ /* Try to overlay the primary with a non-overlay surface. */
hr = IDirectDrawSurface7_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL); hr = IDirectDrawSurface7_UpdateOverlay(offscreen, NULL, primary, NULL, DDOVER_SHOW, NULL);
@ -11142,7 +11158,7 @@ done:
static void test_overlay_rect(void) static void test_overlay_rect(void)
{ {
IDirectDrawSurface7 *overlay, *primary; IDirectDrawSurface7 *overlay, *primary = NULL;
DDSURFACEDESC2 surface_desc; DDSURFACEDESC2 surface_desc;
RECT rect = {0, 0, 64, 64}; RECT rect = {0, 0, 64, 64};
IDirectDraw7 *ddraw; IDirectDraw7 *ddraw;
@ -11179,6 +11195,13 @@ static void test_overlay_rect(void)
hr = IDirectDrawSurface7_ReleaseDC(primary, dc); hr = IDirectDrawSurface7_ReleaseDC(primary, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); 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 /* 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 * used. This is not true in Windows Vista and earlier, but changed in
* Windows 7. */ * 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_x, "Got unexpected pos_x %d.\n", pos_x);
ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y); ok(!pos_y, "Got unexpected pos_y %d.\n", pos_y);
IDirectDrawSurface7_Release(primary);
IDirectDrawSurface7_Release(overlay); IDirectDrawSurface7_Release(overlay);
done: done:
if (primary)
IDirectDrawSurface7_Release(primary);
IDirectDraw7_Release(ddraw); IDirectDraw7_Release(ddraw);
DestroyWindow(window); DestroyWindow(window);
} }
@ -11860,6 +11884,7 @@ static void test_draw_primitive(void)
START_TEST(ddraw7) START_TEST(ddraw7)
{ {
HMODULE module = GetModuleHandleA("ddraw.dll"); HMODULE module = GetModuleHandleA("ddraw.dll");
HMODULE dwmapi;
IDirectDraw7 *ddraw; IDirectDraw7 *ddraw;
DEVMODEW current_mode; DEVMODEW current_mode;
@ -11888,6 +11913,9 @@ START_TEST(ddraw7)
return; return;
} }
if ((dwmapi = LoadLibraryA("dwmapi.dll")))
pDwmIsCompositionEnabled = (void *)GetProcAddress(dwmapi, "DwmIsCompositionEnabled");
test_process_vertices(); test_process_vertices();
test_coop_level_create_device_window(); test_coop_level_create_device_window();
test_clipper_blt(); test_clipper_blt();