the todo_wines should go away at the same patch that implements the features.
On 6/26/19 11:30 PM, Conor McCarthy wrote:
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com
dlls/dxgi/tests/dxgi.c | 84 +++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 41 deletions(-)
diff --git a/dlls/dxgi/tests/dxgi.c b/dlls/dxgi/tests/dxgi.c index aae829d..b2c8773 100644 --- a/dlls/dxgi/tests/dxgi.c +++ b/dlls/dxgi/tests/dxgi.c @@ -2295,28 +2295,18 @@ static void test_swapchain_fullscreen_state(IDXGISwapChain *swapchain, heap_free(output_monitor_info); }
-static void test_set_fullscreen(void) +static void test_set_fullscreen(IUnknown *device, BOOL is_d3d12) { struct swapchain_fullscreen_state initial_state; DXGI_SWAP_CHAIN_DESC swapchain_desc; IDXGISwapChain *swapchain; IDXGIFactory *factory; IDXGIAdapter *adapter;
- IDXGIDevice *device;
- IDXGIOutput *output; ULONG refcount; HRESULT hr;
- if (!(device = create_device(0)))
- {
skip("Failed to create device.\n");
return;
- }
- hr = IDXGIDevice_GetAdapter(device, &adapter);
- ok(SUCCEEDED(hr), "GetAdapter failed, hr %#x.\n", hr);
- hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
- ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
get_factory(device, is_d3d12, &factory);
swapchain_desc.BufferDesc.Width = 800; swapchain_desc.BufferDesc.Height = 600;
@@ -2328,16 +2318,28 @@ static void test_set_fullscreen(void) swapchain_desc.SampleDesc.Count = 1; swapchain_desc.SampleDesc.Quality = 0; swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
- swapchain_desc.BufferCount = 1;
- swapchain_desc.BufferCount = is_d3d12 ? 2 : 1; swapchain_desc.OutputWindow = CreateWindowA("static", "dxgi_test", 0, 0, 0, 400, 200, 0, 0, 0, 0); swapchain_desc.Windowed = TRUE;
- swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
swapchain_desc.SwapEffect = is_d3d12 ? DXGI_SWAP_EFFECT_FLIP_DISCARD : DXGI_SWAP_EFFECT_DISCARD; swapchain_desc.Flags = 0;
memset(&initial_state, 0, sizeof(initial_state)); capture_fullscreen_state(&initial_state.fullscreen_state, swapchain_desc.OutputWindow); hr = IDXGIFactory_CreateSwapChain(factory, (IUnknown *)device, &swapchain_desc, &swapchain); ok(SUCCEEDED(hr), "CreateSwapChain failed, hr %#x.\n", hr);
hr = IDXGISwapChain_GetContainingOutput(swapchain, &output);
ok(SUCCEEDED(hr) || broken(hr == DXGI_ERROR_UNSUPPORTED), /* Win 7 testbot */
"GetContainingOutput failed, hr %#x.\n", hr);
if (FAILED(hr))
{
skip("Could not get output.\n");
goto done;
}
hr = IDXGIOutput_GetParent(output, &IID_IDXGIAdapter, (void **)&adapter);
ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
IDXGIOutput_Release(output);
check_swapchain_fullscreen_state(swapchain, &initial_state); hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL); ok(SUCCEEDED(hr) || hr == DXGI_ERROR_NOT_CURRENTLY_AVAILABLE
@@ -2346,7 +2348,7 @@ static void test_set_fullscreen(void) if (FAILED(hr)) { skip("Could not change fullscreen state.\n");
goto done;
} hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);goto free_adapter;
@@ -2406,17 +2408,16 @@ static void test_set_fullscreen(void) check_swapchain_fullscreen_state(swapchain, &initial_state); test_swapchain_fullscreen_state(swapchain, adapter, &initial_state);
+free_adapter:
- IDXGIAdapter_Release(adapter);
done: refcount = IDXGISwapChain_Release(swapchain); ok(!refcount, "IDXGISwapChain has %u references left.\n", refcount); check_window_fullscreen_state(swapchain_desc.OutputWindow, &initial_state.fullscreen_state); DestroyWindow(swapchain_desc.OutputWindow);
- IDXGIAdapter_Release(adapter);
- refcount = IDXGIDevice_Release(device);
- ok(!refcount, "Device has %u references left.\n", refcount); refcount = IDXGIFactory_Release(factory);
- ok(!refcount, "Factory has %u references left.\n", refcount);
- ok(refcount == !is_d3d12, "Got unexpected refcount %u.\n", refcount);
}
static void test_default_fullscreen_target_output(void) @@ -4136,7 +4137,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12) skip("Test %u: Could not change fullscreen state.\n", i); continue; }
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0); todo_wine_if(!is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); hr = IDXGISwapChain_Present(swapchain, 0, flags[i]);
@@ -4144,23 +4145,23 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12) output = NULL; fullscreen = FALSE; hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, &output);
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
todo_wine_if(is_d3d12) ok(!!output, "Test %u: Got unexpected output.\n", i);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
ok(!!output, "Test %u: Got unexpected output.\n", i); if (output) IDXGIOutput_ReleaseOwnership(output); /* Still fullscreen. */ fullscreen = FALSE; hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i); /* Calling IDXGISwapChain_Present() will exit fullscreen. */ hr = IDXGISwapChain_Present(swapchain, 0, flags[i]); ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); fullscreen = TRUE; hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); /* Now fullscreen mode is exited. */ if (!flags[i] && !is_d3d12) /* Still fullscreen on vista and 2008. */
@@ -4179,11 +4180,11 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12) * compositing. D3d12 fullscreen mode acts just like borderless * fullscreen window mode. */ hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL);
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); fullscreen = FALSE; hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i); hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0); todo_wine_if(!is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); hr = IDXGISwapChain_Present(swapchain, 0, flags[i]);
@@ -4198,8 +4199,8 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); fullscreen = FALSE; hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
todo_wine_if(is_d3d12) ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ok(fullscreen, "Test %u: Got unexpected fullscreen status.\n", i); /* A visible, but with bottom z-order window still causes the * swapchain to exit fullscreen mode. */ SetWindowPos(occluding_window, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
@@ -4212,7 +4213,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12) * for d3d12. */ fullscreen = TRUE; hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); todo_wine_if(!is_d3d12) ok(is_d3d12 ? fullscreen : !fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
@@ -4224,7 +4225,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12)
fullscreen = TRUE; hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); if (flags[i] == DXGI_PRESENT_TEST) todo_wine_if(!is_d3d12) ok(is_d3d12 ? fullscreen : !fullscreen, "Test %u: Got unexpected fullscreen status.\n", i);
@@ -4248,7 +4249,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12) * IDXGISwapChain_GetFullscreenState() before IDXGISwapChain_Present(). */ ShowWindow(occluding_window, SW_HIDE); hr = IDXGISwapChain_SetFullscreenState(swapchain, TRUE, NULL);
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); ShowWindow(occluding_window, SW_SHOW); hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0);
@@ -4283,7 +4284,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12) } fullscreen = TRUE; hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); todo_wine ok(!fullscreen, "Test %u: Got unexpected fullscreen status.\n", i); DestroyWindow(occluding_window);
@@ -4293,7 +4294,7 @@ static void test_swapchain_present(IUnknown *device, BOOL is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
hr = IDXGISwapChain_SetFullscreenState(swapchain, FALSE, NULL);
todo_wine_if(is_d3d12) ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
}ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr); hr = IDXGISwapChain_ResizeBuffers(swapchain, 0, 0, 0, DXGI_FORMAT_UNKNOWN, 0); ok(hr == S_OK, "Test %u: Got unexpected hr %#x.\n", i, hr);
@@ -5534,11 +5535,11 @@ static void test_output_ownership(IUnknown *device, BOOL is_d3d12) skip("Failed to change fullscreen state.\n"); goto done; }
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); fullscreen = FALSE; hr = IDXGISwapChain_GetFullscreenState(swapchain, &fullscreen, NULL);
- todo_wine_if(is_d3d12) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- todo_wine_if(is_d3d12) ok(fullscreen, "Got unexpected fullscreen state.\n");
- ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- ok(fullscreen, "Got unexpected fullscreen state.\n"); if (is_d3d12) wait_vidpn_exclusive_ownership(&check_ownership_desc, STATUS_SUCCESS, FALSE); else
@@ -5697,7 +5698,6 @@ START_TEST(dxgi)
/* These tests use full-screen swapchains, so shouldn't run in parallel. */ test_create_swapchain();
- test_set_fullscreen(); test_default_fullscreen_target_output(); test_inexact_modes(); test_gamma_control();
@@ -5705,6 +5705,7 @@ START_TEST(dxgi) test_swapchain_window_messages(); test_swapchain_window_styles(); test_window_association();
- run_on_d3d10(test_set_fullscreen); run_on_d3d10(test_resize_target); run_on_d3d10(test_swapchain_resize); run_on_d3d10(test_swapchain_present);
@@ -5727,6 +5728,7 @@ START_TEST(dxgi) ID3D12Debug_Release(debug); }
- run_on_d3d12(test_set_fullscreen); run_on_d3d12(test_resize_target); run_on_d3d12(test_swapchain_resize); run_on_d3d12(test_swapchain_present);