Commit 9994cf8a authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d8/tests: Use a separate device for lighting_test().

parent 00630f67
...@@ -174,12 +174,16 @@ static void test_sanity(IDirect3DDevice8 *device) ...@@ -174,12 +174,16 @@ static void test_sanity(IDirect3DDevice8 *device)
ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
} }
static void lighting_test(IDirect3DDevice8 *device) static void lighting_test(void)
{ {
HRESULT hr;
DWORD fvf = D3DFVF_XYZ | D3DFVF_DIFFUSE;
DWORD nfvf = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_NORMAL; DWORD nfvf = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_NORMAL;
DWORD color; DWORD fvf = D3DFVF_XYZ | D3DFVF_DIFFUSE;
IDirect3DDevice8 *device;
IDirect3D8 *d3d;
D3DCOLOR color;
ULONG refcount;
HWND window;
HRESULT hr;
static const struct vertex unlitquad[] = static const struct vertex unlitquad[] =
{ {
...@@ -218,6 +222,16 @@ static void lighting_test(IDirect3DDevice8 *device) ...@@ -218,6 +222,16 @@ static void lighting_test(IDirect3DDevice8 *device)
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f,
}}}; }}};
window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
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, window, TRUE)))
{
skip("Failed to create a D3D device, skipping tests.\n");
goto done;
}
hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0, 0); hr = IDirect3DDevice8_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0, 0);
ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %#08x\n", hr); ok(hr == D3D_OK, "IDirect3DDevice8_Clear failed with %#08x\n", hr);
...@@ -293,8 +307,11 @@ static void lighting_test(IDirect3DDevice8 *device) ...@@ -293,8 +307,11 @@ static void lighting_test(IDirect3DDevice8 *device)
IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL); IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); refcount = IDirect3DDevice8_Release(device);
ok(hr == D3D_OK, "IDirect3DDevice8_SetRenderState returned %#08x\n", hr); ok(!refcount, "Device has %u references left.\n", refcount);
done:
IDirect3D8_Release(d3d);
DestroyWindow(window);
} }
static void clear_test(void) static void clear_test(void)
...@@ -4998,7 +5015,6 @@ START_TEST(visual) ...@@ -4998,7 +5015,6 @@ START_TEST(visual)
test_sanity(device_ptr); test_sanity(device_ptr);
depth_clamp_test(device_ptr); depth_clamp_test(device_ptr);
lighting_test(device_ptr);
refcount = IDirect3DDevice8_Release(device_ptr); refcount = IDirect3DDevice8_Release(device_ptr);
ok(!refcount, "Device has %u references left.\n", refcount); ok(!refcount, "Device has %u references left.\n", refcount);
...@@ -5006,6 +5022,7 @@ cleanup: ...@@ -5006,6 +5022,7 @@ cleanup:
IDirect3D8_Release(d3d); IDirect3D8_Release(d3d);
DestroyWindow(window); DestroyWindow(window);
lighting_test();
clear_test(); clear_test();
fog_test(); fog_test();
z_range_test(); z_range_test();
......
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