Paul Vriens : dinput/tests: Fix a few intermittent test failures.

Alexandre Julliard julliard at winehq.org
Thu Oct 15 08:54:29 CDT 2009


Module: wine
Branch: master
Commit: 5a40c65cfeadf7c7126a5560b115016744fd2d93
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5a40c65cfeadf7c7126a5560b115016744fd2d93

Author: Paul Vriens <Paul.Vriens.Wine at gmail.com>
Date:   Thu Oct 15 09:20:00 2009 +0200

dinput/tests: Fix a few intermittent test failures.

---

 dlls/dinput/tests/mouse.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/dlls/dinput/tests/mouse.c b/dlls/dinput/tests/mouse.c
index 520a867..09b2b27 100644
--- a/dlls/dinput/tests/mouse.c
+++ b/dlls/dinput/tests/mouse.c
@@ -71,6 +71,7 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd)
     HRESULT hr;
     LPDIRECTINPUTDEVICE pMouse = NULL;
     DIMOUSESTATE m_state;
+    HWND hwnd2;
 
     hr = IDirectInput_CreateDevice(pDI, &GUID_SysMouse, &pMouse, NULL);
     ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %08x\n", hr);
@@ -89,8 +90,10 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd)
     ok(hr == S_FALSE, "IDirectInputDevice_Acquire() should have failed: %08x\n", hr);
 
     /* Foreground coop level requires window to have focus */
-    /* This should make dinput loose mouse input */
-    SetActiveWindow( 0 );
+    /* Create a temporary window, this should make dinput
+     * loose mouse input */
+    hwnd2 = CreateWindow("static", "Temporary", WS_VISIBLE,
+                         10, 210, 200, 200, NULL, NULL, NULL, NULL);
 
     hr = IDirectInputDevice_GetDeviceState(pMouse, sizeof(m_state), &m_state);
     ok(hr == DIERR_NOTACQUIRED, "GetDeviceState() should have failed: %08x\n", hr);
@@ -105,6 +108,8 @@ static void test_acquire(LPDIRECTINPUT pDI, HWND hwnd)
     ok(hr == S_OK, "Acquire() failed: %08x\n", hr);
 
     if (pMouse) IUnknown_Release(pMouse);
+
+    DestroyWindow( hwnd2 );
 }
 
 static void mouse_tests(void)




More information about the wine-cvs mailing list