Prevents test failure and crash until multi-monitor support is improved.
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- dlls/dxgi/tests/dxgi.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c index 0f256d4c..7a1baa82 100644 --- a/dlls/dxgi/tests/dxgi.c +++ b/dlls/dxgi/tests/dxgi.c @@ -1935,6 +1935,22 @@ done: DestroyWindow(creation_desc.OutputWindow); }
+static HMONITOR get_primary_if_right_side_secondary(const DXGI_OUTPUT_DESC *output_desc) +{ + HMONITOR primary, secondary; + MONITORINFO mi; + POINT pt = {0, 0}; + + primary = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); + pt.x = output_desc->DesktopCoordinates.right; + secondary = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); + mi.cbSize = sizeof(mi); + if (secondary && secondary != primary + && GetMonitorInfoW(primary, &mi) && (mi.dwFlags & MONITORINFOF_PRIMARY)) + return primary; + return NULL; +} + static void test_get_containing_output(void) { unsigned int output_count, output_idx; @@ -1949,6 +1965,7 @@ static void test_get_containing_output(void) IDXGIDevice *device; unsigned int i, j; HMONITOR monitor; + HMONITOR primary; ULONG refcount; HRESULT hr; BOOL ret; @@ -2031,6 +2048,8 @@ static void test_get_containing_output(void) wine_dbgstr_rect(&output_desc.DesktopCoordinates), wine_dbgstr_rect(&monitor_info.rcMonitor));
+ primary = get_primary_if_right_side_secondary(&output_desc); + output_idx = 0; while ((hr = IDXGIAdapter_EnumOutputs(adapter, output_idx, &output)) != DXGI_ERROR_NOT_FOUND) { @@ -2113,9 +2132,11 @@ static void test_get_containing_output(void) ok(ret, "Failed to get monitor info.\n");
hr = IDXGISwapChain_GetContainingOutput(swapchain, &output); + /* Hack to prevent test failures with secondary on the right until multi-monitor support is improved. */ + todo_wine_if(primary && monitor != primary) ok(hr == S_OK || broken(hr == DXGI_ERROR_UNSUPPORTED), "Failed to get containing output, hr %#x.\n", hr); - if (hr == DXGI_ERROR_UNSUPPORTED) + if (hr != S_OK) continue; ok(!!output, "Got unexpected containing output %p.\n", output); hr = IDXGIOutput_GetDesc(output, &output_desc);