[PATCH 2/7] d3d9/tests: Add test for invalid render states.
Józef Kucia
jkucia at codeweavers.com
Wed Jan 27 17:17:47 CST 2016
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
---
A similar test crashes in d3d8.
---
dlls/d3d9/tests/device.c | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index ed5f731..f177532 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -10634,6 +10634,45 @@ static void test_swapchain_parameters(void)
DestroyWindow(window);
}
+static void test_set_render_state(void)
+{
+ IDirect3DDevice9 *device;
+ IDirect3D9 *d3d;
+ ULONG refcount;
+ HWND window;
+ DWORD state;
+ HRESULT hr;
+
+ window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, 640, 480, NULL, NULL, NULL, NULL);
+ d3d = Direct3DCreate9(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");
+ goto done;
+ }
+
+ for (state = D3DRS_BLENDOPALPHA + 1; state <= D3DRS_BLENDOPALPHA + 1000; ++state)
+ {
+ hr = IDirect3DDevice9_SetRenderState(device, state, 0);
+ ok(SUCCEEDED(hr), "SetRenderState failed, state %#x, value 0, hr %#x.\n", state, hr);
+ hr = IDirect3DDevice9_SetRenderState(device, state, 1);
+ ok(SUCCEEDED(hr), "SetRenderState failed, state %#x, value 1, hr %#x.\n", state, hr);
+ }
+
+ hr = IDirect3DDevice9_SetRenderState(device, 0xffffffff, 0);
+ ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr);
+ hr = IDirect3DDevice9_SetRenderState(device, 0xffffffff, 1);
+ ok(SUCCEEDED(hr), "SetRenderState failed, hr %#x.\n", hr);
+
+ refcount = IDirect3DDevice9_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+done:
+ IDirect3D9_Release(d3d);
+ DestroyWindow(window);
+}
+
START_TEST(device)
{
WNDCLASSA wc = {0};
@@ -10746,6 +10785,7 @@ START_TEST(device)
test_lost_device();
test_resource_priority();
test_swapchain_parameters();
+ test_set_render_state();
UnregisterClassA("d3d9_test_wc", GetModuleHandleA(NULL));
}
--
2.4.10
More information about the wine-patches
mailing list