d3d9/tests: Add more tests for calling stateblock methods while recording.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1684b01118
commit
bfe911e86c
|
@ -10548,10 +10548,11 @@ cleanup:
|
|||
|
||||
static void test_begin_end_state_block(void)
|
||||
{
|
||||
IDirect3DStateBlock9 *stateblock;
|
||||
IDirect3DStateBlock9 *stateblock, *stateblock2;
|
||||
IDirect3DDevice9 *device;
|
||||
IDirect3D9 *d3d;
|
||||
ULONG refcount;
|
||||
DWORD value;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -10566,33 +10567,61 @@ static void test_begin_end_state_block(void)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Should succeed. */
|
||||
hr = IDirect3DDevice9_BeginStateBlock(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin stateblock, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
/* Calling BeginStateBlock() while recording should return
|
||||
* D3DERR_INVALIDCALL. */
|
||||
hr = IDirect3DDevice9_BeginStateBlock(device);
|
||||
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, FALSE);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
/* Should succeed. */
|
||||
stateblock = (IDirect3DStateBlock9 *)0xdeadbeef;
|
||||
hr = IDirect3DDevice9_EndStateBlock(device, &stateblock);
|
||||
ok(SUCCEEDED(hr), "Failed to end stateblock, hr %#x.\n", hr);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
ok(!!stateblock && stateblock != (IDirect3DStateBlock9 *)0xdeadbeef,
|
||||
"Got unexpected stateblock %p.\n", stateblock);
|
||||
IDirect3DStateBlock9_Release(stateblock);
|
||||
|
||||
/* Calling EndStateBlock() while not recording should return
|
||||
* D3DERR_INVALIDCALL. stateblock should not be touched. */
|
||||
stateblock = (IDirect3DStateBlock9 *)0xdeadbeef;
|
||||
hr = IDirect3DDevice9_EndStateBlock(device, &stateblock);
|
||||
stateblock2 = (IDirect3DStateBlock9 *)0xdeadbeef;
|
||||
hr = IDirect3DDevice9_EndStateBlock(device, &stateblock2);
|
||||
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
ok(stateblock == (IDirect3DStateBlock9 *)0xdeadbeef,
|
||||
"Got unexpected stateblock %p.\n", stateblock);
|
||||
ok(stateblock2 == (IDirect3DStateBlock9 *)0xdeadbeef,
|
||||
"Got unexpected stateblock %p.\n", stateblock2);
|
||||
|
||||
hr = IDirect3DDevice9_GetRenderState(device, D3DRS_LIGHTING, &value);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
ok(value == TRUE, "Got unexpected value %#x.\n", value);
|
||||
|
||||
hr = IDirect3DDevice9_BeginStateBlock(device);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_BeginStateBlock(device);
|
||||
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DStateBlock9_Apply(stateblock);
|
||||
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DStateBlock9_Capture(stateblock);
|
||||
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_CreateStateBlock(device, D3DSBT_ALL, &stateblock2);
|
||||
todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_GetRenderState(device, D3DRS_LIGHTING, &value);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
ok(value == TRUE, "Got unexpected value %#x.\n", value);
|
||||
|
||||
hr = IDirect3DDevice9_EndStateBlock(device, &stateblock2);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DStateBlock9_Apply(stateblock2);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_GetRenderState(device, D3DRS_LIGHTING, &value);
|
||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||
todo_wine ok(value == TRUE, "Got unexpected value %#x.\n", value);
|
||||
|
||||
IDirect3DStateBlock9_Release(stateblock);
|
||||
IDirect3DStateBlock9_Release(stateblock2);
|
||||
refcount = IDirect3DDevice9_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
todo_wine ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
IDirect3D9_Release(d3d);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue