Zhiyi Zhang : dxgi/tests: Test IDXGISwapChain_GetContainingOutput() after Alt+Enter.
Alexandre Julliard
julliard at winehq.org
Wed May 13 16:29:54 CDT 2020
Module: wine
Branch: master
Commit: f904e9af1b5b3c3c429f6f90835680e35c089504
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f904e9af1b5b3c3c429f6f90835680e35c089504
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Tue May 12 20:48:58 2020 +0800
dxgi/tests: Test IDXGISwapChain_GetContainingOutput() after Alt+Enter.
Signed-off-by: Zhiyi Zhang <zzhang 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 | 89 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 88 insertions(+), 1 deletion(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c
index dd00be1e8c..e8dfa036e0 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);
More information about the wine-cvs
mailing list