ddraw/tests: Add test for clip planes limits.
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:
parent
45ded87cf4
commit
462bbf4d20
|
@ -13297,6 +13297,82 @@ static void test_compute_sphere_visibility(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_clip_planes_limits(void)
|
||||
{
|
||||
IDirect3DDevice7 *device;
|
||||
D3DDEVICEDESC7 caps;
|
||||
unsigned int i;
|
||||
ULONG refcount;
|
||||
float plane[4];
|
||||
HWND window;
|
||||
DWORD state;
|
||||
HRESULT hr;
|
||||
|
||||
window = create_window();
|
||||
if (!(device = create_device(window, DDSCL_NORMAL)))
|
||||
{
|
||||
skip("Failed to create 3D device.\n");
|
||||
DestroyWindow(window);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&caps, 0, sizeof(caps));
|
||||
hr = IDirect3DDevice7_GetCaps(device, &caps);
|
||||
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
|
||||
|
||||
trace("Max user clip planes: %u.\n", caps.wMaxUserClipPlanes);
|
||||
|
||||
for (i = 0; i < D3DMAXUSERCLIPPLANES; ++i)
|
||||
{
|
||||
memset(plane, 0xff, sizeof(plane));
|
||||
hr = IDirect3DDevice7_GetClipPlane(device, i, plane);
|
||||
todo_wine_if(i >= caps.wMaxUserClipPlanes)
|
||||
{
|
||||
ok(hr == D3D_OK, "Failed to get clip plane %u, hr %#x.\n", i, hr);
|
||||
ok(!plane[0] && !plane[1] && !plane[2] && !plane[3],
|
||||
"Got unexpected plane %u: %.8e, %.8e, %.8e, %.8e.\n",
|
||||
i, plane[0], plane[1], plane[2], plane[3]);
|
||||
}
|
||||
}
|
||||
|
||||
plane[0] = 2.0f;
|
||||
plane[1] = 8.0f;
|
||||
plane[2] = 5.0f;
|
||||
for (i = 0; i < D3DMAXUSERCLIPPLANES; ++i)
|
||||
{
|
||||
plane[3] = i;
|
||||
hr = IDirect3DDevice7_SetClipPlane(device, i, plane);
|
||||
todo_wine_if(i >= caps.wMaxUserClipPlanes)
|
||||
ok(hr == D3D_OK, "Failed to set clip plane %u, hr %#x.\n", i, hr);
|
||||
}
|
||||
for (i = 0; i < D3DMAXUSERCLIPPLANES; ++i)
|
||||
{
|
||||
memset(plane, 0xff, sizeof(plane));
|
||||
hr = IDirect3DDevice7_GetClipPlane(device, i, plane);
|
||||
todo_wine_if(i >= caps.wMaxUserClipPlanes)
|
||||
ok(hr == D3D_OK, "Failed to get clip plane %u, hr %#x.\n", i, hr);
|
||||
todo_wine_if(i >= caps.wMaxUserClipPlanes)
|
||||
ok(plane[0] == 2.0f && plane[1] == 8.0f && plane[2] == 5.0f && plane[3] == i,
|
||||
"Got unexpected plane %u: %.8e, %.8e, %.8e, %.8e.\n",
|
||||
i, plane[0], plane[1], plane[2], plane[3]);
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_CLIPPLANEENABLE, 0xffffffff);
|
||||
ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_GetRenderState(device, D3DRENDERSTATE_CLIPPLANEENABLE, &state);
|
||||
ok(SUCCEEDED(hr), "Failed to get render state, hr %#x.\n", hr);
|
||||
ok(state == 0xffffffff, "Got unexpected state %#x.\n", state);
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_CLIPPLANEENABLE, 0x80000000);
|
||||
ok(SUCCEEDED(hr), "Failed to set render state, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_GetRenderState(device, D3DRENDERSTATE_CLIPPLANEENABLE, &state);
|
||||
ok(SUCCEEDED(hr), "Failed to get render state, hr %#x.\n", hr);
|
||||
ok(state == 0x80000000, "Got unexpected state %#x.\n", state);
|
||||
|
||||
refcount = IDirect3DDevice7_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
START_TEST(ddraw7)
|
||||
{
|
||||
HMODULE module = GetModuleHandleA("ddraw.dll");
|
||||
|
@ -13414,4 +13490,5 @@ START_TEST(ddraw7)
|
|||
test_ck_operation();
|
||||
test_vb_refcount();
|
||||
test_compute_sphere_visibility();
|
||||
test_clip_planes_limits();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue