[PATCH 4/6] d3d8/tests: Add test for render target device mismatch.
Józef Kucia
jkucia at codeweavers.com
Tue Jan 3 06:46:31 CST 2017
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
dlls/d3d8/tests/device.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 59 insertions(+)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 2b38f17..2dbf9d8 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -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));
}
--
2.7.3
More information about the wine-patches
mailing list