Module: wine Branch: master Commit: 74b3f9e3afc5837fbb804f9491298418e127b8c5 URL: https://source.winehq.org/git/wine.git/?a=commit;h=74b3f9e3afc5837fbb804f949...
Author: Zebediah Figura z.figura12@gmail.com Date: Wed Apr 3 21:18:41 2019 -0500
d3d8/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
---
dlls/d3d8/tests/device.c | 57 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 15 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index c5ec9aa..f0acd9f 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -7231,10 +7231,11 @@ cleanup:
static void test_begin_end_state_block(void) { + DWORD stateblock, stateblock2; IDirect3DDevice8 *device; - DWORD stateblock; IDirect3D8 *d3d; ULONG refcount; + DWORD value; HWND window; HRESULT hr;
@@ -7249,28 +7250,54 @@ static void test_begin_end_state_block(void) return; }
- /* Should succeed. */ hr = IDirect3DDevice8_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 = IDirect3DDevice8_BeginStateBlock(device); - ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + hr = IDirect3DDevice8_SetRenderState(device, D3DRS_LIGHTING, FALSE); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
- /* Should succeed. */ stateblock = 0xdeadbeef; hr = IDirect3DDevice8_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 != 0xdeadbeef, "Got unexpected stateblock %#x.\n", stateblock); - IDirect3DDevice8_DeleteStateBlock(device, stateblock);
- /* Calling EndStateBlock() while not recording should return - * D3DERR_INVALIDCALL. stateblock should not be touched. */ - stateblock = 0xdeadbeef; - hr = IDirect3DDevice8_EndStateBlock(device, &stateblock); + stateblock2 = 0xdeadbeef; + hr = IDirect3DDevice8_EndStateBlock(device, &stateblock2); ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); - ok(stateblock == 0xdeadbeef, "Got unexpected stateblock %#x.\n", stateblock); + ok(stateblock2 == 0xdeadbeef, "Got unexpected stateblock %#x.\n", stateblock2); + + hr = IDirect3DDevice8_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 = IDirect3DDevice8_BeginStateBlock(device); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice8_BeginStateBlock(device); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice8_ApplyStateBlock(device, stateblock); + todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice8_CaptureStateBlock(device, stateblock); + todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice8_CreateStateBlock(device, D3DSBT_ALL, &stateblock2); + todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice8_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 = IDirect3DDevice8_EndStateBlock(device, &stateblock2); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice8_ApplyStateBlock(device, stateblock2); + ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr); + + hr = IDirect3DDevice8_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);
refcount = IDirect3DDevice8_Release(device); ok(!refcount, "Device has %u references left.\n", refcount);