Signed-off-by: Gabriel Ivăncescu gabrielopcode@gmail.com --- dlls/dxgi/tests/dxgi.c | 46 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c index a83964d..a7d36ac 100644 --- a/dlls/dxgi/tests/dxgi.c +++ b/dlls/dxgi/tests/dxgi.c @@ -6049,7 +6049,7 @@ done:
static void test_swapchain_window_styles(void) { - LONG style, exstyle, fullscreen_style, fullscreen_exstyle; + LONG style, exstyle, fullscreen_style, fullscreen_exstyle, expected_style; DXGI_SWAP_CHAIN_DESC swapchain_desc; IDXGISwapChain *swapchain; IDXGIFactory *factory; @@ -6058,6 +6058,7 @@ static void test_swapchain_window_styles(void) ULONG refcount; unsigned int i; HRESULT hr; + BOOL ret;
static const struct { @@ -6225,6 +6226,49 @@ static void test_swapchain_window_styles(void) DestroyWindow(swapchain_desc.OutputWindow); }
+ /* Window changes are always done no matter if it is active or not */ + swapchain_desc.OutputWindow = CreateWindowExA(0, "static", "dxgi_test", + WS_OVERLAPPED | WS_VISIBLE, 0, 0, 400, 200, 0, 0, 0, 0); + + expected_style = WS_OVERLAPPED | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CAPTION; + fullscreen_style = WS_VISIBLE | WS_CLIPSIBLINGS; + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain); + ok(hr == S_OK, "Failed to create swapchain, hr %#x.\n", hr); + + style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE); + exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE); + ok(style == expected_style, "Got style %#x, expected %#x.\n", style, expected_style); + ok(exstyle == WS_EX_WINDOWEDGE, "Got exstyle %#x, expected %#x.\n", exstyle, (DWORD)WS_EX_WINDOWEDGE); + + ret = SetForegroundWindow(GetDesktopWindow()); + ok(ret, "Failed to set foreground window.\n"); + hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL); + ok(hr == S_OK || hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE + || broken(hr == DXGI_ERROR_UNSUPPORTED), /* Win 7 testbot */ + "Failed to set fullscreen state, hr %#x.\n", hr); + if (SUCCEEDED(hr)) + { + style = GetWindowLongA(swapchain_desc.OutputWindow, GWL_STYLE); + exstyle = GetWindowLongA(swapchain_desc.OutputWindow, GWL_EXSTYLE); + todo_wine + ok(style == fullscreen_style, "Got style %#x, expected %#x.\n", style, fullscreen_style); + ok(exstyle == WS_EX_TOPMOST, "Got exstyle %#x, expected %#x.\n", exstyle, (DWORD)WS_EX_TOPMOST); + + hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + } + else + { + skip("Could not change fullscreen state %08x.\n", hr); + } + + refcount = IDXGISwapChain_Release(swapchain); + ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount); + DestroyWindow(swapchain_desc.OutputWindow); + refcount = IDXGIDevice_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); refcount = IDXGIFactory_Release(factory);