d3d8/tests: Port test_checkdevicemultisampletype() from d3d9.

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Matteo Bruni 2016-01-28 00:15:47 +01:00 committed by Alexandre Julliard
parent 7fd7516922
commit 5baa8f0d18
1 changed files with 56 additions and 0 deletions

View File

@ -790,6 +790,61 @@ cleanup:
DestroyWindow(window);
}
static void test_checkdevicemultisampletype(void)
{
IDirect3D8 *d3d;
HWND window;
HRESULT hr;
window = CreateWindowA("d3d8_test_wc", "d3d8_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, NULL, NULL, NULL, NULL);
ok(!!window, "Failed to create a window.\n");
d3d = Direct3DCreate8(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES) == D3DERR_NOTAVAILABLE)
{
skip("Multisampling not supported for D3DFMT_X8R8G8B8, skipping test.\n");
goto cleanup;
}
hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_UNKNOWN, TRUE, D3DMULTISAMPLE_NONE);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
65536, TRUE, D3DMULTISAMPLE_NONE);
todo_wine ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_NONE);
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_X8R8G8B8, FALSE, D3DMULTISAMPLE_NONE);
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_2_SAMPLES);
ok(SUCCEEDED(hr), "Got unexpected hr %#x.\n", hr);
/* We assume D3DMULTISAMPLE_15_SAMPLES is never supported in practice. */
hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_15_SAMPLES);
ok(hr == D3DERR_NOTAVAILABLE, "Got unexpected hr %#x.\n", hr);
hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_X8R8G8B8, TRUE, 65536);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
hr = IDirect3D8_CheckDeviceMultiSampleType(d3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL,
D3DFMT_DXT5, TRUE, D3DMULTISAMPLE_2_SAMPLES);
ok(hr == D3DERR_NOTAVAILABLE, "Got unexpected hr %#x.\n", hr);
cleanup:
IDirect3D8_Release(d3d);
DestroyWindow(window);
}
static void test_cursor(void)
{
HMODULE user32_handle = GetModuleHandleA("user32.dll");
@ -7786,6 +7841,7 @@ START_TEST(device)
test_swapchain();
test_refcount();
test_mipmap_levels();
test_checkdevicemultisampletype();
test_cursor();
test_cursor_pos();
test_states();