d3d8/tests: Add test for render target device mismatch.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2017-01-03 13:46:31 +01:00 committed by Alexandre Julliard
parent 6e6b377c22
commit f93fbcad41
1 changed files with 59 additions and 0 deletions

View File

@ -8083,6 +8083,64 @@ done:
DestroyWindow(window);
}
static void test_render_target_device_mismatch(void)
{
IDirect3DDevice8 *device, *device2;
IDirect3DSurface8 *surface, *rt;
IDirect3D8 *d3d;
UINT refcount;
HWND window;
HRESULT hr;
window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, NULL, NULL, NULL, NULL);
d3d = Direct3DCreate8(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, NULL)))
{
skip("Failed to create a D3D device.\n");
IDirect3D8_Release(d3d);
DestroyWindow(window);
return;
}
hr = IDirect3DDevice8_GetRenderTarget(device, &rt);
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
device2 = create_device(d3d, window, NULL);
ok(!!device2, "Failed to create a D3D device.\n");
hr = IDirect3DDevice8_CreateRenderTarget(device2, 640, 480,
D3DFMT_A8R8G8B8, D3DMULTISAMPLE_NONE, FALSE, &surface);
ok(SUCCEEDED(hr), "Failed to create render target, hr %#x.\n", hr);
hr = IDirect3DDevice8_SetRenderTarget(device, surface, NULL);
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
IDirect3DSurface8_Release(surface);
hr = IDirect3DDevice8_GetRenderTarget(device2, &surface);
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
hr = IDirect3DDevice8_SetRenderTarget(device, surface, NULL);
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
IDirect3DSurface8_Release(surface);
hr = IDirect3DDevice8_GetRenderTarget(device, &surface);
ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
todo_wine ok(surface == rt, "Got unexpected render target %p, expected %p.\n", surface, rt);
IDirect3DSurface8_Release(surface);
IDirect3DSurface8_Release(rt);
refcount = IDirect3DDevice8_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
refcount = IDirect3DDevice8_Release(device2);
ok(!refcount, "Device has %u references left.\n", refcount);
IDirect3D8_Release(d3d);
DestroyWindow(window);
}
START_TEST(device)
{
HMODULE d3d8_handle = LoadLibraryA( "d3d8.dll" );
@ -8187,6 +8245,7 @@ START_TEST(device)
test_swapchain_parameters();
test_check_device_format();
test_miptree_layout();
test_render_target_device_mismatch();
UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL));
}