[PATCH 1/3] d3d9/tests: Fix test_cursor() (v2).
Stefan Dösinger
stefan at codeweavers.com
Tue Nov 25 03:16:53 CST 2014
Version 2: Move the CreateWindow ok() call to the proper place.
Native didn't change the GDI cursor because the window was hidden and
the device not fullscreen. With a visible window native changes the
cursor on ShowCursor like Wine does.
The old test happened to pass on Wine because the server returned the
cursor handle from a different input queue. Setting the foreground
window (e.g. by calling SetForegroundWindow or by creating a fullscreen
device like the next patch does before test_cursor runs) changed this
behavior and caused the test to fail.
---
dlls/d3d9/tests/device.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 35dad62..33b5998 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -1535,15 +1535,20 @@ static void test_cursor(void)
HCURSOR cur;
HWND window;
HRESULT hr;
+ BOOL ret;
+
+ window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
+ 0, 0, 640, 480, NULL, NULL, NULL, NULL);
+ ok(!!window, "Failed to create a window.\n");
+ ret = SetCursorPos(50, 50);
+ ok(ret, "Failed to set cursor position.\n");
+ flush_events();
memset(&info, 0, sizeof(info));
info.cbSize = sizeof(info);
ok(GetCursorInfo(&info), "GetCursorInfo failed\n");
cur = info.hCursor;
- window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW,
- 0, 0, 640, 480, NULL, NULL, NULL, NULL);
- ok(!!window, "Failed to create a window.\n");
d3d = Direct3DCreate9(D3D_SDK_VERSION);
ok(!!d3d, "Failed to create a D3D object.\n");
if (!(device = create_device(d3d, window, NULL)))
@@ -1587,12 +1592,11 @@ static void test_cursor(void)
hr = IDirect3DDevice9_ShowCursor(device, TRUE);
ok(hr == TRUE, "IDirect3DDevice9_ShowCursor returned %08x\n", hr);
- /* GDI cursor unchanged */
memset(&info, 0, sizeof(info));
info.cbSize = sizeof(info);
ok(GetCursorInfo(&info), "GetCursorInfo failed\n");
ok(info.flags & CURSOR_SHOWING, "The gdi cursor is hidden (%08x)\n", info.flags);
- ok(info.hCursor == cur, "The cursor handle is %p\n", info.hCursor); /* unchanged */
+ ok(info.hCursor != cur, "The cursor handle is %p\n", info.hCursor);
refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
--
2.0.4
More information about the wine-patches
mailing list