Zebediah Figura : d3d9/tests: Add more tests for calling stateblock methods while recording.
Alexandre Julliard
julliard at winehq.org
Wed Apr 3 15:26:20 CDT 2019
Module: wine
Branch: master
Commit: bfe911e86c202adf4e6df807948c0a51d55e555f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=bfe911e86c202adf4e6df807948c0a51d55e555f
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Tue Apr 2 12:42:45 2019 -0500
d3d9/tests: Add more tests for calling stateblock methods while recording.
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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 f79f261..652b81a 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);
}
More information about the wine-cvs
mailing list