=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: dxgi/tests: Fix potential crashes in test_get_containing_output().

Alexandre Julliard julliard at winehq.org
Wed Mar 6 15:29:41 CST 2019


Module: wine
Branch: master
Commit: 670062ae3329d8e43cb974277ca873ed779be3aa
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=670062ae3329d8e43cb974277ca873ed779be3aa

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Wed Mar  6 14:19:52 2019 +0100

dxgi/tests: Fix potential crashes in test_get_containing_output().

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dxgi/tests/dxgi.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index e630a49..a7e60c6 100644
--- a/dlls/dxgi/tests/dxgi.c
+++ b/dlls/dxgi/tests/dxgi.c
@@ -1963,20 +1963,23 @@ static void test_get_containing_output(void)
         {
             ret = SetWindowPos(swapchain_desc.OutputWindow, 0, points[i].x, points[i].y,
                     0, 0, SWP_NOSIZE | SWP_NOZORDER);
-            ok(ret, "SetWindowPos failed.\n");
+            ok(ret, "Faled to set window position.\n");
 
             monitor = MonitorFromWindow(swapchain_desc.OutputWindow, MONITOR_DEFAULTTONEAREST);
-            ok(!!monitor, "MonitorFromWindow failed.\n");
+            ok(!!monitor, "Failed to get monitor from window.\n");
 
             monitor_info.cbSize = sizeof(monitor_info);
             ret = GetMonitorInfoW(monitor, (MONITORINFO *)&monitor_info);
             ok(ret, "Failed to get monitor info.\n");
 
             hr = IDXGISwapChain_GetContainingOutput(swapchain, &output);
-            ok(SUCCEEDED(hr), "GetContainingOutput failed, hr %#x.\n", hr);
+            ok(hr == S_OK || broken(hr == DXGI_ERROR_UNSUPPORTED),
+                    "Failed to get containing output, hr %#x.\n", hr);
+            if (hr == DXGI_ERROR_UNSUPPORTED)
+                continue;
             ok(!!output, "Got unexpected containing output %p.\n", output);
             hr = IDXGIOutput_GetDesc(output, &output_desc);
-            ok(SUCCEEDED(hr), "GetDesc failed, hr %#x.\n", hr);
+            ok(hr == S_OK, "Failed to get output desc, hr %#x.\n", hr);
             refcount = IDXGIOutput_Release(output);
             ok(!refcount, "IDXGIOutput has %u references left.\n", refcount);
 




More information about the wine-cvs mailing list