Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- dlls/dxgi/tests/dxgi.c | 89 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c index dd00be1e8cf..e8dfa036e08 100644 --- a/dlls/dxgi/tests/dxgi.c +++ b/dlls/dxgi/tests/dxgi.c @@ -2095,9 +2095,9 @@ static HMONITOR get_primary_if_right_side_secondary(const DXGI_OUTPUT_DESC *outp static void test_get_containing_output(void) { unsigned int adapter_idx, output_idx, output_count; + DXGI_OUTPUT_DESC output_desc, output_desc2; DXGI_SWAP_CHAIN_DESC swapchain_desc; IDXGIOutput *output, *output2; - DXGI_OUTPUT_DESC output_desc; MONITORINFOEXW monitor_info; IDXGISwapChain *swapchain; IDXGIFactory *factory; @@ -2369,6 +2369,93 @@ static void test_get_containing_output(void) hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL); ok(hr == S_OK, "SetFullscreenState failed, hr %#x.\n", hr);
+ /* Test GetContainingOutput after a full screen swapchain is made windowed by pressing + * Alt+Enter, then move it to another output and use Alt+Enter to enter full screen */ + output = NULL; + output2 = NULL; + for (adapter_idx = 0; SUCCEEDED(IDXGIFactory_EnumAdapters(factory, adapter_idx, &adapter)); + ++adapter_idx) + { + for (output_idx = 0; SUCCEEDED(IDXGIAdapter_EnumOutputs(adapter, output_idx, + output ? &output2 : &output)); ++output_idx) + { + if (output2) + break; + } + + IDXGIAdapter_Release(adapter); + if (output2) + break; + } + + if (output && output2) + { + hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, output); + IDXGIOutput_Release(output); + if (FAILED(hr)) + { + skip("SetFullscreenState failed, hr %#x.\n", hr); + IDXGIOutput_Release(output2); + goto done; + } + + /* Post an Alt + VK_RETURN WM_SYSKEYDOWN to leave full screen on the first output */ + PostMessageA(swapchain_desc.OutputWindow, WM_SYSKEYDOWN, VK_RETURN, + (MapVirtualKeyA(VK_RETURN, MAPVK_VK_TO_VSC) << 16) | 0x20000001); + flush_events(); + hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL); + ok(hr == S_OK, "GetFullscreenState failed, hr %#x.\n", hr); + ok(!fullscreen, "Expect swapchain not full screen.\n"); + + /* Move the swapchain output window to the second output */ + hr = IDXGIOutput_GetDesc(output2, &output_desc2); + ok(hr == S_OK, "GetDesc failed, hr %#x.\n", hr); + ret = SetWindowPos(swapchain_desc.OutputWindow, 0, output_desc2.DesktopCoordinates.left, + output_desc2.DesktopCoordinates.top, 0, 0, SWP_NOSIZE | SWP_NOZORDER); + ok(ret, "SetWindowPos failed.\n"); + + /* Post an Alt + VK_RETURN WM_SYSKEYDOWN to enter full screen on the second output */ + PostMessageA(swapchain_desc.OutputWindow, WM_SYSKEYDOWN, VK_RETURN, + (MapVirtualKeyA(VK_RETURN, MAPVK_VK_TO_VSC) << 16) | 0x20000001); + flush_events(); + output = NULL; + hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, &output); + ok(hr == S_OK, "GetFullscreenState failed, hr %#x.\n", hr); + ok(fullscreen, "Expect swapchain full screen.\n"); + ok(!!output, "Expect output not NULL.\n"); + hr = IDXGIOutput_GetDesc(output, &output_desc); + ok(hr == S_OK, "GetDesc failed, hr %#x.\n", hr); + hr = IDXGIOutput_GetDesc(output2, &output_desc2); + ok(hr == S_OK, "GetDesc failed, hr %#x.\n", hr); + todo_wine ok(!lstrcmpW(output_desc.DeviceName, output_desc2.DeviceName), + "Expect device name %s, got %s.\n", wine_dbgstr_w(output_desc2.DeviceName), + wine_dbgstr_w(output_desc.DeviceName)); + IDXGIOutput_Release(output); + + output = NULL; + hr = IDXGISwapChain_GetContainingOutput(swapchain, &output); + ok(hr == S_OK, "GetContainingOutput failed, hr %#x.\n", hr); + hr = IDXGIOutput_GetDesc(output, &output_desc); + ok(hr == S_OK, "GetDesc failed, hr %#x.\n", hr); + hr = IDXGIOutput_GetDesc(output2, &output_desc2); + ok(hr == S_OK, "GetDesc failed, hr %#x.\n", hr); + todo_wine ok(!lstrcmpW(output_desc.DeviceName, output_desc2.DeviceName), + "Expect device name %s, got %s.\n", wine_dbgstr_w(output_desc2.DeviceName), + wine_dbgstr_w(output_desc.DeviceName)); + + hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL); + ok(hr == S_OK, "SetFullscreenState failed, hr %#x.\n", hr); + } + else + { + skip("This test requires two outputs.\n"); + } + + if (output) + IDXGIOutput_Release(output); + if (output2) + IDXGIOutput_Release(output2); + done: refcount = IDXGISwapChain_Release(swapchain); ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=71597
Your paranoid android.
=== w2008s64 (32 bit report) ===
dxgi: dxgi.c:5528: Test failed: Got unexpected message 0x1a, hwnd 001200FA, wparam 0x18, lparam 0x7e518.
=== w1064v1507 (32 bit report) ===
dxgi: dxgi.c:5528: Test failed: Got unexpected message 0x31f, hwnd 000F0050, wparam 0x1, lparam 0.