Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/d3d9/tests/device.c | 63 +++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 17 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index f79f26125c..652b81ae11 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -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); }