ddraw/tests: Port test for adding the same light to viewports multiple times for ddraw2.

Signed-off-by: Paul Gofman <gofmanp@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Paul Gofman 2019-03-22 14:17:47 +03:00 committed by Alexandre Julliard
parent 9bd6b2c2bf
commit 927d509aa2
1 changed files with 18 additions and 11 deletions

View File

@ -7048,20 +7048,20 @@ static void test_lighting(void)
{&mat_nonaffine, translatedquad, 0x000000ff, "Lit quad with non-affine matrix"}, {&mat_nonaffine, translatedquad, 0x000000ff, "Lit quad with non-affine matrix"},
}; };
HWND window; IDirect3DViewport2 *viewport, *viewport2;
IDirect3D2 *d3d;
IDirect3DDevice2 *device;
IDirectDraw2 *ddraw;
IDirectDrawSurface *rt;
IDirect3DViewport2 *viewport;
IDirect3DMaterial2 *material;
IDirect3DLight *light;
D3DMATERIALHANDLE mat_handle; D3DMATERIALHANDLE mat_handle;
IDirect3DMaterial2 *material;
IDirect3DDevice2 *device;
IDirectDrawSurface *rt;
IDirect3DLight *light;
D3DLIGHT2 light_desc; D3DLIGHT2 light_desc;
HRESULT hr; IDirectDraw2 *ddraw;
IDirect3D2 *d3d;
D3DCOLOR color; D3DCOLOR color;
ULONG refcount; ULONG refcount;
unsigned int i; unsigned int i;
HWND window;
HRESULT hr;
window = create_window(); window = create_window();
ddraw = create_ddraw(); ddraw = create_ddraw();
@ -7158,9 +7158,16 @@ static void test_lighting(void)
U4(light_desc.dcvColor).a = 1.0f; U4(light_desc.dcvColor).a = 1.0f;
U3(light_desc.dvDirection).z = 1.0f; U3(light_desc.dvDirection).z = 1.0f;
hr = IDirect3DLight_SetLight(light, (D3DLIGHT *)&light_desc); hr = IDirect3DLight_SetLight(light, (D3DLIGHT *)&light_desc);
ok(SUCCEEDED(hr), "Failed to set light, hr %#x.\n", hr); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DViewport2_AddLight(viewport, light); hr = IDirect3DViewport2_AddLight(viewport, light);
ok(SUCCEEDED(hr), "Failed to add a light to the viewport, hr %#x.\n", hr); ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
hr = IDirect3DViewport2_AddLight(viewport, light);
ok(hr == D3DERR_LIGHTHASVIEWPORT, "Got unexpected hr %#x.\n", hr);
viewport2 = create_viewport(device, 0, 0, 640, 480);
hr = IDirect3DViewport2_AddLight(viewport2, light);
ok(hr == D3DERR_LIGHTHASVIEWPORT, "Got unexpected hr %#x.\n", hr);
destroy_viewport(device, viewport2);
hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET); hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);