dxgi/tests: Introduce create_window().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2019-08-14 16:34:36 +04:30 committed by Alexandre Julliard
parent f4ae6f537f
commit d9835f4d0c
1 changed files with 20 additions and 13 deletions

View File

@ -517,6 +517,16 @@ static void wait_vidpn_exclusive_ownership_(unsigned int line,
"Got unexpected status %#x, expected %#x.\n", status, expected); "Got unexpected status %#x, expected %#x.\n", status, expected);
} }
static HWND create_window(void)
{
RECT r = {0, 0, 640, 480};
AdjustWindowRect(&r, WS_OVERLAPPEDWINDOW | WS_VISIBLE, FALSE);
return CreateWindowA("static", "dxgi_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0, 0, r.right - r.left, r.bottom - r.top, NULL, NULL, NULL, NULL);
}
static IDXGIAdapter *create_adapter(void) static IDXGIAdapter *create_adapter(void)
{ {
IDXGIFactory4 *factory4; IDXGIFactory4 *factory4;
@ -2446,8 +2456,8 @@ static void test_default_fullscreen_target_output(void)
hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory); hr = IDXGIAdapter_GetParent(adapter, &IID_IDXGIFactory, (void **)&factory);
ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr); ok(SUCCEEDED(hr), "GetParent failed, hr %#x.\n", hr);
swapchain_desc.BufferDesc.Width = 100; swapchain_desc.BufferDesc.Width = 640;
swapchain_desc.BufferDesc.Height = 100; swapchain_desc.BufferDesc.Height = 480;
swapchain_desc.BufferDesc.RefreshRate.Numerator = 60; swapchain_desc.BufferDesc.RefreshRate.Numerator = 60;
swapchain_desc.BufferDesc.RefreshRate.Denominator = 60; swapchain_desc.BufferDesc.RefreshRate.Denominator = 60;
swapchain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; swapchain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
@ -2457,8 +2467,7 @@ static void test_default_fullscreen_target_output(void)
swapchain_desc.SampleDesc.Quality = 0; swapchain_desc.SampleDesc.Quality = 0;
swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapchain_desc.BufferCount = 1; swapchain_desc.BufferCount = 1;
swapchain_desc.OutputWindow = CreateWindowA("static", "dxgi_test", swapchain_desc.OutputWindow = create_window();
WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, 100, 100, 0, 0, 0, 0);
swapchain_desc.Windowed = TRUE; swapchain_desc.Windowed = TRUE;
swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
swapchain_desc.Flags = 0; swapchain_desc.Flags = 0;
@ -3488,8 +3497,7 @@ static void test_swapchain_resize(IUnknown *device, BOOL is_d3d12)
get_factory(device, is_d3d12, &factory); get_factory(device, is_d3d12, &factory);
window = CreateWindowA("static", "dxgi_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, window = create_window();
0, 0, 640, 480, NULL, NULL, NULL, NULL);
ret = GetClientRect(window, &client_rect); ret = GetClientRect(window, &client_rect);
ok(ret, "Failed to get client rect.\n"); ok(ret, "Failed to get client rect.\n");
@ -3861,8 +3869,7 @@ static void test_swapchain_parameters(void)
skip("Failed to create device.\n"); skip("Failed to create device.\n");
return; return;
} }
window = CreateWindowA("static", "dxgi_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, window = create_window();
0, 0, 640, 480, 0, 0, 0, 0);
hr = IDXGIDevice_QueryInterface(device, &IID_IUnknown, (void **)&obj); hr = IDXGIDevice_QueryInterface(device, &IID_IUnknown, (void **)&obj);
ok(hr == S_OK, "IDXGIDevice does not implement IUnknown.\n"); ok(hr == S_OK, "IDXGIDevice does not implement IUnknown.\n");
@ -4339,7 +4346,7 @@ static void test_swapchain_backbuffer_index(IUnknown *device, BOOL is_d3d12)
swapchain_desc.SampleDesc.Quality = 0; swapchain_desc.SampleDesc.Quality = 0;
swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapchain_desc.BufferCount = 4; swapchain_desc.BufferCount = 4;
swapchain_desc.OutputWindow = CreateWindowA("static", "dxgi_test", 0, 0, 0, 400, 200, 0, 0, 0, 0); swapchain_desc.OutputWindow = create_window();
swapchain_desc.Windowed = TRUE; swapchain_desc.Windowed = TRUE;
swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
swapchain_desc.Flags = 0; swapchain_desc.Flags = 0;
@ -4449,7 +4456,7 @@ static void test_swapchain_formats(IUnknown *device, BOOL is_d3d12)
swapchain_desc.SampleDesc.Quality = 0; swapchain_desc.SampleDesc.Quality = 0;
swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapchain_desc.BufferCount = 4; swapchain_desc.BufferCount = 4;
swapchain_desc.OutputWindow = CreateWindowA("static", "dxgi_test", 0, 0, 0, 400, 200, 0, 0, 0, 0); swapchain_desc.OutputWindow = create_window();
swapchain_desc.Windowed = TRUE; swapchain_desc.Windowed = TRUE;
swapchain_desc.Flags = 0; swapchain_desc.Flags = 0;
@ -5208,8 +5215,8 @@ static void test_gamma_control(void)
ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr);
IDXGIOutput_Release(output); IDXGIOutput_Release(output);
swapchain_desc.BufferDesc.Width = 800; swapchain_desc.BufferDesc.Width = 640;
swapchain_desc.BufferDesc.Height = 600; swapchain_desc.BufferDesc.Height = 480;
swapchain_desc.BufferDesc.RefreshRate.Numerator = 60; swapchain_desc.BufferDesc.RefreshRate.Numerator = 60;
swapchain_desc.BufferDesc.RefreshRate.Denominator = 60; swapchain_desc.BufferDesc.RefreshRate.Denominator = 60;
swapchain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; swapchain_desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
@ -5219,7 +5226,7 @@ static void test_gamma_control(void)
swapchain_desc.SampleDesc.Quality = 0; swapchain_desc.SampleDesc.Quality = 0;
swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapchain_desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapchain_desc.BufferCount = 1; swapchain_desc.BufferCount = 1;
swapchain_desc.OutputWindow = CreateWindowA("static", "dxgi_test", 0, 0, 0, 400, 200, 0, 0, 0, 0); swapchain_desc.OutputWindow = create_window();
swapchain_desc.Windowed = TRUE; swapchain_desc.Windowed = TRUE;
swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; swapchain_desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
swapchain_desc.Flags = 0; swapchain_desc.Flags = 0;