Commit 32450ee6 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

d3d9/tests: Allow passing a resolution to reset_device in d3d9ex.

parent 38548df0
......@@ -132,19 +132,27 @@ done:
return device;
}
static HRESULT reset_device(IDirect3DDevice9Ex *device, HWND device_window, BOOL windowed)
static HRESULT reset_device(IDirect3DDevice9Ex *device, const struct device_desc *desc)
{
D3DPRESENT_PARAMETERS present_parameters = {0};
present_parameters.Windowed = windowed;
present_parameters.hDeviceWindow = device_window;
present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
present_parameters.BackBufferWidth = 1024;
present_parameters.BackBufferHeight = 768;
present_parameters.BackBufferWidth = 640;
present_parameters.BackBufferHeight = 480;
present_parameters.BackBufferFormat = D3DFMT_A8R8G8B8;
present_parameters.SwapEffect = D3DSWAPEFFECT_DISCARD;
present_parameters.hDeviceWindow = NULL;
present_parameters.Windowed = TRUE;
present_parameters.EnableAutoDepthStencil = TRUE;
present_parameters.AutoDepthStencilFormat = D3DFMT_D24S8;
if (desc)
{
present_parameters.BackBufferWidth = desc->width;
present_parameters.BackBufferHeight = desc->height;
present_parameters.hDeviceWindow = desc->device_window;
present_parameters.Windowed = !(desc->flags & CREATE_DEVICE_FULLSCREEN);
}
return IDirect3DDevice9_Reset(device, &present_parameters);
}
......@@ -1110,7 +1118,7 @@ static void test_reset_resources(void)
IDirect3DSurface9_Release(surface);
}
hr = reset_device(device, window, TRUE);
hr = reset_device(device, NULL);
ok(SUCCEEDED(hr), "Failed to reset device.\n");
hr = IDirect3DDevice9_GetBackBuffer(device, 0, 0, D3DBACKBUFFER_TYPE_MONO, &rt);
......@@ -1284,7 +1292,9 @@ static void test_lost_device(void)
hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL);
ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
hr = reset_device(device, window, FALSE);
desc.width = 1024;
desc.height = 768;
hr = reset_device(device, &desc);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_TestCooperativeLevel(device);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
......@@ -1297,7 +1307,8 @@ static void test_lost_device(void)
hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL);
ok(hr == S_PRESENT_OCCLUDED, "Got unexpected hr %#x.\n", hr);
hr = reset_device(device, window, TRUE);
desc.flags = 0;
hr = reset_device(device, &desc);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_TestCooperativeLevel(device);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
......@@ -1310,7 +1321,7 @@ static void test_lost_device(void)
hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL);
todo_wine ok(hr == S_PRESENT_MODE_CHANGED, "Got unexpected hr %#x.\n", hr);
hr = reset_device(device, window, TRUE);
hr = reset_device(device, &desc);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_TestCooperativeLevel(device);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
......@@ -1349,7 +1360,8 @@ static void test_lost_device(void)
hr = IDirect3DDevice9Ex_CheckDeviceState(device, NULL);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = reset_device(device, window, FALSE);
desc.flags = CREATE_DEVICE_FULLSCREEN;
hr = reset_device(device, &desc);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DDevice9Ex_TestCooperativeLevel(device);
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
......@@ -1977,8 +1989,8 @@ static void test_wndproc_windowed(void)
filter_messages = focus_window;
device_desc.device_window = device_window;
device_desc.width = 640;
device_desc.height = 480;
device_desc.width = registry_mode.dmPelsWidth;
device_desc.height = registry_mode.dmPelsHeight;
device_desc.flags = 0;
if (!(device = create_device(focus_window, &device_desc)))
{
......@@ -2002,7 +2014,8 @@ static void test_wndproc_windowed(void)
filter_messages = NULL;
hr = reset_device(device, device_window, FALSE);
device_desc.flags = CREATE_DEVICE_FULLSCREEN;
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC);
......@@ -2012,7 +2025,8 @@ static void test_wndproc_windowed(void)
proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC);
ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc);
hr = reset_device(device, device_window, TRUE);
device_desc.flags = 0;
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC);
......@@ -2039,7 +2053,8 @@ static void test_wndproc_windowed(void)
filter_messages = NULL;
hr = reset_device(device, focus_window, FALSE);
device_desc.flags = CREATE_DEVICE_FULLSCREEN;
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC);
......@@ -2049,7 +2064,8 @@ static void test_wndproc_windowed(void)
proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC);
ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc);
hr = reset_device(device, focus_window, TRUE);
device_desc.flags = 0;
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC);
......@@ -2074,7 +2090,8 @@ static void test_wndproc_windowed(void)
filter_messages = NULL;
hr = reset_device(device, device_window, FALSE);
device_desc.flags = CREATE_DEVICE_FULLSCREEN;
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC);
......@@ -2084,7 +2101,8 @@ static void test_wndproc_windowed(void)
proc = GetWindowLongPtrA(focus_window, GWLP_WNDPROC);
ok(proc != (LONG_PTR)test_proc, "Expected wndproc != %#lx.\n", (LONG_PTR)test_proc);
hr = reset_device(device, device_window, TRUE);
device_desc.flags = 0;
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
proc = GetWindowLongPtrA(device_window, GWLP_WNDPROC);
......@@ -2197,7 +2215,8 @@ static void test_window_style(void)
focus_rect.left, focus_rect.top, focus_rect.right, focus_rect.bottom,
r.left, r.top, r.right, r.bottom, i);
hr = reset_device(device, device_window, TRUE);
device_desc.flags = 0;
hr = reset_device(device, &device_desc);
ok(SUCCEEDED(hr), "Failed to reset device, hr %#x.\n", hr);
style = GetWindowLongA(device_window, GWL_STYLE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment