Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d9/tests/d3d9ex.c | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
diff --git a/dlls/d3d9/tests/d3d9ex.c b/dlls/d3d9/tests/d3d9ex.c index 77e09c3cee..7c36e6ee64 100644 --- a/dlls/d3d9/tests/d3d9ex.c +++ b/dlls/d3d9/tests/d3d9ex.c @@ -4043,6 +4043,55 @@ static void test_device_caps(void) DestroyWindow(window); }
+static void test_frame_latency(void) +{ + IDirect3DDevice9Ex *device; + ULONG refcount; + UINT latency; + HWND window; + HRESULT hr; + + window = create_window(); + if (!(device = create_device(window, NULL))) + { + skip("Failed to create a D3D device.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice9Ex_GetMaximumFrameLatency(device, &latency); +todo_wine { + ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr); + ok(latency == 3, "Unexpected default max frame latency %u.\n", latency); +} + hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 1); + ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr); + + hr = IDirect3DDevice9Ex_GetMaximumFrameLatency(device, &latency); +todo_wine { + ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr); + ok(latency == 1, "Unexpected max frame latency %u.\n", latency); +} + hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 0); + ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr); + + hr = IDirect3DDevice9Ex_GetMaximumFrameLatency(device, &latency); +todo_wine { + ok(SUCCEEDED(hr), "Failed to get max frame latency, hr %#x.\n", hr); + ok(latency == 3, "Unexpected default max frame latency %u.\n", latency); +} + hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 30); + ok(SUCCEEDED(hr), "Failed to set max frame latency, hr %#x.\n", hr); + + hr = IDirect3DDevice9Ex_SetMaximumFrameLatency(device, 31); +todo_wine + ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#x.\n", hr); + + refcount = IDirect3DDevice9Ex_Release(device); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(d3d9ex) { DEVMODEW current_mode; @@ -4093,4 +4142,5 @@ START_TEST(d3d9ex) test_backbuffer_resize(); test_format_unknown(); test_device_caps(); + test_frame_latency(); }