[PATCH 6/6] dinput/tests: Merge mouse.c tests into device.c.

Rémi Bernon wine at gitlab.winehq.org
Wed Jun 8 08:59:57 CDT 2022


From: Rémi Bernon <rbernon at codeweavers.com>

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/tests/Makefile.in |   3 +-
 dlls/dinput/tests/device.c    | 182 +++++++++++++++++++++++++
 dlls/dinput/tests/mouse.c     | 242 ----------------------------------
 3 files changed, 183 insertions(+), 244 deletions(-)
 delete mode 100644 dlls/dinput/tests/mouse.c

diff --git a/dlls/dinput/tests/Makefile.in b/dlls/dinput/tests/Makefile.in
index b8d0f1c4335..32cfb306524 100644
--- a/dlls/dinput/tests/Makefile.in
+++ b/dlls/dinput/tests/Makefile.in
@@ -22,5 +22,4 @@ SOURCES = \
 	hotplug.c \
 	joystick.c \
 	joystick8.c \
-	keyboard.c \
-	mouse.c
+	keyboard.c
diff --git a/dlls/dinput/tests/device.c b/dlls/dinput/tests/device.c
index 84a993f958d..339f4a025b9 100644
--- a/dlls/dinput/tests/device.c
+++ b/dlls/dinput/tests/device.c
@@ -1598,13 +1598,19 @@ static void test_sys_mouse( DWORD version )
         },
     };
     DIDEVICEOBJECTINSTANCEW objinst = {0};
+    DIDEVICEOBJECTDATA objdata = {0};
     DIDEVICEINSTANCEW devinst = {0};
     BOOL old_localized = localized;
     IDirectInputDevice8W *device;
+    HWND hwnd, tmp_hwnd, child;
     DIDEVCAPS caps = {0};
+    DIMOUSESTATE state;
     ULONG res, ref;
+    HANDLE event;
+    DWORD count;
     HRESULT hr;
     GUID guid;
+    int i;
 
     if (FAILED(create_dinput_device( version, &GUID_SysMouse, &device ))) return;
 
@@ -1852,6 +1858,182 @@ static void test_sys_mouse( DWORD version )
     check_member( objinst, expect_objects[3], "%#04x", wExponent );
     check_member( objinst, expect_objects[3], "%u", wReportId );
 
+
+    SetCursorPos( 60, 60 );
+
+    hwnd = CreateWindowW( L"static", L"static", WS_POPUP | WS_VISIBLE,
+                          50, 50, 200, 200, NULL, NULL, NULL, NULL );
+    ok( !!hwnd, "CreateWindowW failed, error %lu\n", GetLastError() );
+    flush_events();
+
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_FOREGROUND );
+    ok( hr == DIERR_INVALIDPARAM, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_FOREGROUND|DISCL_EXCLUSIVE );
+    ok( hr == E_HANDLE, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE );
+    ok( hr == E_HANDLE, "SetCooperativeLevel returned %#lx\n", hr );
+
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_BACKGROUND );
+    ok( hr == DIERR_INVALIDPARAM, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_BACKGROUND|DISCL_EXCLUSIVE );
+    ok( hr == E_HANDLE, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, NULL, DISCL_BACKGROUND|DISCL_NONEXCLUSIVE );
+    ok( hr == DI_OK, "SetCooperativeLevel returned %#lx\n", hr );
+
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_FOREGROUND );
+    ok( hr == DIERR_INVALIDPARAM, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_FOREGROUND|DISCL_EXCLUSIVE );
+    ok( hr == DI_OK, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE );
+    ok( hr == DI_OK, "SetCooperativeLevel returned %#lx\n", hr );
+
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND );
+    ok( hr == DIERR_INVALIDPARAM, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND|DISCL_EXCLUSIVE );
+    ok( hr == DIERR_UNSUPPORTED, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_BACKGROUND|DISCL_NONEXCLUSIVE );
+    ok( hr == DI_OK, "SetCooperativeLevel returned %#lx\n", hr );
+
+    child = CreateWindowW( L"static", L"static", WS_CHILD | WS_VISIBLE,
+                           10, 10, 50, 50, hwnd, NULL, NULL, NULL );
+    ok( !!child, "CreateWindowW failed, error %lu\n", GetLastError() );
+    flush_events();
+
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, child, DISCL_FOREGROUND );
+    ok( hr == DIERR_INVALIDPARAM, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, child, DISCL_FOREGROUND|DISCL_EXCLUSIVE );
+    ok( hr == E_HANDLE, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, child, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE );
+    ok( hr == E_HANDLE, "SetCooperativeLevel returned %#lx\n", hr );
+
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, child, DISCL_BACKGROUND );
+    ok( hr == DIERR_INVALIDPARAM, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, child, DISCL_BACKGROUND|DISCL_EXCLUSIVE );
+    ok( hr == E_HANDLE, "SetCooperativeLevel returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, child, DISCL_BACKGROUND|DISCL_NONEXCLUSIVE );
+    ok( hr == E_HANDLE, "SetCooperativeLevel returned %#lx\n", hr );
+
+    DestroyWindow( child );
+
+
+    event = CreateEventW( NULL, FALSE, FALSE, NULL );
+    ok( !!event, "CreateEventW failed, error %lu\n", GetLastError() );
+    hr = IDirectInputDevice8_SetEventNotification( device, event );
+    ok( hr == DI_OK, "SetEventNotification returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetCooperativeLevel( device, hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND );
+    ok( hr == DI_OK, "SetCooperativeLevel returned %#lx\n", hr );
+
+    prop_dword.dwData = 5;
+    prop_dword.diph.dwHow = DIPH_DEVICE;
+    prop_dword.diph.dwObj = 0;
+    hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, (LPCDIPROPHEADER)&prop_dword );
+    ok( hr == DI_OK, "SetProperty returned %#lx\n", hr );
+    hr = IDirectInputDevice8_SetDataFormat( device, &c_dfDIMouse );
+    ok( hr == DI_OK, "SetDataFormat returned %#lx\n", hr );
+    hr = IDirectInputDevice8_Unacquire( device );
+    ok( hr == DI_NOEFFECT, "Unacquire returned %#lx\n", hr );
+    hr = IDirectInputDevice8_Acquire( device );
+    ok( hr == DI_OK, "Acquire returned %#lx\n", hr );
+    hr = IDirectInputDevice8_Acquire( device );
+    ok( hr == DI_NOEFFECT, "Acquire returned %#lx\n", hr );
+
+
+    tmp_hwnd = CreateWindowW( L"static", L"static", WS_POPUP | WS_VISIBLE,
+                              50, 250, 200, 200, NULL, NULL, NULL, NULL );
+    ok( !!tmp_hwnd, "CreateWindowW failed, error %lu\n", GetLastError() );
+    flush_events();
+
+    hr = IDirectInputDevice8_GetDeviceState( device, sizeof(state), &state );
+    ok( hr == DIERR_NOTACQUIRED, "GetDeviceState  returned %#lx\n", hr );
+
+    hr = IDirectInputDevice8_Acquire( device );
+    ok( hr == DIERR_OTHERAPPHASPRIO, "Acquire returned %#lx\n", hr );
+
+    SetActiveWindow( hwnd );
+    flush_events();
+
+    hr = IDirectInputDevice8_SetProperty( device, DIPROP_BUFFERSIZE, (LPCDIPROPHEADER)&prop_dword );
+    ok( hr == DI_OK, "SetProperty returned %#lx\n", hr );
+
+    hr = IDirectInputDevice8_Acquire( device );
+    ok( hr == DI_OK, "Acquire returned %#lx\n", hr );
+
+    mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 );
+    res = WaitForSingleObject( event, 100 );
+    if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */
+    {
+        mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 );
+        res = WaitForSingleObject( event, 100 );
+    }
+    ok( !res, "WaitForSingleObject returned %#lx\n", res );
+
+    count = 1;
+    hr = IDirectInputDevice8_GetDeviceData( device, sizeof(objdata), &objdata, &count, 0 );
+    ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
+    ok( count == 1, "got count %lu\n", count );
+
+    mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 );
+    res = WaitForSingleObject( event, 100 );
+    ok( !res, "WaitForSingleObject returned %#lx\n", res );
+
+    hr = IDirectInputDevice8_Unacquire( device );
+    ok( hr == DI_OK, "Unacquire returned %#lx\n", hr );
+    count = 1;
+    hr = IDirectInputDevice8_GetDeviceData( device, sizeof(objdata), &objdata, &count, 0 );
+    ok( hr == (version < 0x800 ? DI_OK : DIERR_NOTACQUIRED), "GetDeviceData returned %#lx\n", hr );
+    ok( count == 1, "got count %lu\n", count );
+
+    hr = IDirectInputDevice8_Acquire( device );
+    ok( hr == DI_OK, "Acquire returned %#lx\n", hr );
+
+    mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 );
+    res = WaitForSingleObject( event, 100 );
+    if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */
+    {
+        mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 );
+        res = WaitForSingleObject( event, 100 );
+    }
+    ok( !res, "WaitForSingleObject returned %#lx\n", res );
+
+    hr = IDirectInputDevice8_Unacquire( device );
+    ok( hr == DI_OK, "Unacquire returned %#lx\n", hr );
+
+    hr = IDirectInputDevice8_Acquire( device );
+    ok( hr == DI_OK, "Acquire returned %#lx\n", hr );
+    count = 1;
+    hr = IDirectInputDevice8_GetDeviceData( device, sizeof(objdata), &objdata, &count, 0 );
+    ok( hr == (version < 0x800 ? DI_OK : DI_BUFFEROVERFLOW), "GetDeviceData returned %#lx\n", hr );
+    ok( count == 1, "got count %lu\n", count );
+
+    mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 );
+    res = WaitForSingleObject( event, 100 );
+    if (res == WAIT_TIMEOUT) /* Acquire is asynchronous */
+    {
+        mouse_event( MOUSEEVENTF_MOVE, 10, 10, 0, 0 );
+        res = WaitForSingleObject( event, 100 );
+    }
+    ok( !res, "WaitForSingleObject returned %#lx\n", res );
+
+    for (i = 0; i < 2; i++)
+    {
+        mouse_event( MOUSEEVENTF_MOVE, 10 + i, 10 + i, 0, 0 );
+        res = WaitForSingleObject( event, 100 );
+        ok( !res, "WaitForSingleObject returned %#lx\n", res );
+    }
+
+    count = 1;
+    hr = IDirectInputDevice8_GetDeviceData( device, sizeof(objdata), &objdata, &count, 0 );
+    ok( hr == (version < 0x800 ? DI_OK : DI_BUFFEROVERFLOW), "GetDeviceData returned %#lx\n", hr );
+    count = 1;
+    hr = IDirectInputDevice8_GetDeviceData( device, sizeof(objdata), &objdata, &count, 0 );
+    ok( hr == DI_OK, "GetDeviceData returned %#lx\n", hr );
+    ok( count == 1, "got count %lu\n", count );
+
+    DestroyWindow( tmp_hwnd );
+
+    CloseHandle( event );
+    DestroyWindow( hwnd );
+
     ref = IDirectInputDevice8_Release( device );
     ok( ref == 0, "Release returned %ld\n", ref );
 
diff --git a/dlls/dinput/tests/mouse.c b/dlls/dinput/tests/mouse.c
deleted file mode 100644
index 2079c5e1408..00000000000
--- a/dlls/dinput/tests/mouse.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * Copyright (c) 2005 Robert Reif
- * Copyright (c) 2006 Vitaliy Margolen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#define DIRECTINPUT_VERSION 0x0700
-
-#include <stdarg.h>
-#include <stddef.h>
-
-#include "ntstatus.h"
-#define WIN32_NO_STATUS
-#include "windef.h"
-#include "winbase.h"
-
-#define COBJMACROS
-#include "dinput.h"
-
-#include "dinput_test.h"
-
-static const HRESULT SetCoop_null_window[16] =  {
-    E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG,
-    E_INVALIDARG, E_HANDLE,     E_HANDLE,     E_INVALIDARG,
-    E_INVALIDARG, E_HANDLE,     S_OK,         E_INVALIDARG,
-    E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG};
-
-static const HRESULT SetCoop_real_window[16] =  {
-    E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG,
-    E_INVALIDARG, S_OK,         S_OK,         E_INVALIDARG,
-    E_INVALIDARG, E_NOTIMPL,    S_OK,         E_INVALIDARG,
-    E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG};
-
-static const HRESULT SetCoop_child_window[16] =  {
-    E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG,
-    E_INVALIDARG, E_HANDLE,     E_HANDLE,     E_INVALIDARG,
-    E_INVALIDARG, E_HANDLE,     E_HANDLE,     E_INVALIDARG,
-    E_INVALIDARG, E_INVALIDARG, E_INVALIDARG, E_INVALIDARG};
-
-static void flush_events(void)
-{
-    MSG msg;
-    int diff = 200;
-    int min_timeout = 100;
-    DWORD time = GetTickCount() + diff;
-
-    while (diff > 0)
-    {
-        if (MsgWaitForMultipleObjects( 0, NULL, FALSE, min_timeout, QS_ALLINPUT ) == WAIT_TIMEOUT) break;
-        while (PeekMessageA( &msg, 0, 0, 0, PM_REMOVE )) DispatchMessageA( &msg );
-        diff = time - GetTickCount();
-    }
-}
-
-static void test_set_coop(IDirectInputA *pDI, HWND hwnd)
-{
-    HRESULT hr;
-    IDirectInputDeviceA *pMouse = NULL;
-    int i;
-    HWND child;
-
-    hr = IDirectInput_CreateDevice(pDI, &GUID_SysMouse, &pMouse, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
-    if (FAILED(hr)) return;
-
-    for (i=0; i<16; i++)
-    {
-        hr = IDirectInputDevice_SetCooperativeLevel(pMouse, NULL, i);
-        ok(hr == SetCoop_null_window[i], "SetCooperativeLevel(NULL, %d): %#lx\n", i, hr);
-    }
-    for (i=0; i<16; i++)
-    {
-        hr = IDirectInputDevice_SetCooperativeLevel(pMouse, hwnd, i);
-        ok(hr == SetCoop_real_window[i], "SetCooperativeLevel(hwnd, %d): %#lx\n", i, hr);
-    }
-
-    child = CreateWindowA("static", "Title", WS_CHILD | WS_VISIBLE, 10, 10, 50, 50, hwnd, NULL,
-                          NULL, NULL);
-    ok(child != NULL, "err: %lu\n", GetLastError());
-
-    for (i=0; i<16; i++)
-    {
-        hr = IDirectInputDevice_SetCooperativeLevel(pMouse, child, i);
-        ok(hr == SetCoop_child_window[i], "SetCooperativeLevel(child, %d): %#lx\n", i, hr);
-    }
-
-    DestroyWindow(child);
-    if (pMouse) IUnknown_Release(pMouse);
-}
-
-static void test_acquire(IDirectInputA *pDI, HWND hwnd)
-{
-    HRESULT hr;
-    IDirectInputDeviceA *pMouse = NULL;
-    DIMOUSESTATE m_state;
-    HWND hwnd2;
-    DIPROPDWORD di_op;
-    DIDEVICEOBJECTDATA mouse_state;
-    DWORD cnt;
-    int i;
-
-    if (! SetForegroundWindow(hwnd))
-    {
-        skip("Not running as foreground app, skipping acquire tests\n");
-        return;
-    }
-
-    hr = IDirectInput_CreateDevice(pDI, &GUID_SysMouse, &pMouse, NULL);
-    ok(SUCCEEDED(hr), "IDirectInput_CreateDevice() failed: %#lx\n", hr);
-    if (FAILED(hr)) return;
-
-    hr = IDirectInputDevice_SetCooperativeLevel(pMouse, hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
-    ok(hr == S_OK, "SetCooperativeLevel: %#lx\n", hr);
-
-    memset(&di_op, 0, sizeof(di_op));
-    di_op.dwData = 5;
-    di_op.diph.dwHow = DIPH_DEVICE;
-    di_op.diph.dwSize = sizeof(DIPROPDWORD);
-    di_op.diph.dwHeaderSize = sizeof(DIPROPHEADER);
-    hr = IDirectInputDevice_SetProperty(pMouse, DIPROP_BUFFERSIZE, (LPCDIPROPHEADER)&di_op);
-    ok(hr == S_OK, "SetProperty() failed: %#lx\n", hr);
-
-    hr = IDirectInputDevice_SetDataFormat(pMouse, &c_dfDIMouse);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_SetDataFormat() failed: %#lx\n", hr);
-    hr = IDirectInputDevice_Unacquire(pMouse);
-    ok(hr == S_FALSE, "IDirectInputDevice_Unacquire() should have failed: %#lx\n", hr);
-    hr = IDirectInputDevice_Acquire(pMouse);
-    ok(SUCCEEDED(hr), "IDirectInputDevice_Acquire() failed: %#lx\n", hr);
-    hr = IDirectInputDevice_Acquire(pMouse);
-    ok(hr == S_FALSE, "IDirectInputDevice_Acquire() should have failed: %#lx\n", hr);
-
-    /* Foreground coop level requires window to have focus */
-    /* Create a temporary window, this should make dinput
-     * lose mouse input */
-    hwnd2 = CreateWindowA("static", "Temporary", WS_VISIBLE, 10, 210, 200, 200, NULL, NULL, NULL,
-                          NULL);
-    ok(hwnd2 != NULL, "CreateWindowA failed with %lu\n", GetLastError());
-    flush_events();
-
-    hr = IDirectInputDevice_GetDeviceState(pMouse, sizeof(m_state), &m_state);
-    ok(hr == DIERR_NOTACQUIRED, "GetDeviceState() should have failed: %#lx\n", hr);
-
-    hr = IDirectInputDevice_Acquire(pMouse);
-    ok(hr == DIERR_OTHERAPPHASPRIO, "Acquire() should have failed: %#lx\n", hr);
-
-    SetActiveWindow( hwnd );
-    hr = IDirectInputDevice_Acquire(pMouse);
-    ok(hr == S_OK, "Acquire() failed: %#lx\n", hr);
-
-    mouse_event(MOUSEEVENTF_MOVE, 10, 10, 0, 0);
-    cnt = 1;
-    hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
-    ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %#lx cnt:%lu\n", hr, cnt);
-
-    mouse_event(MOUSEEVENTF_MOVE, 10, 10, 0, 0);
-    hr = IDirectInputDevice_Unacquire(pMouse);
-    ok(hr == S_OK, "Failed: %#lx\n", hr);
-    cnt = 1;
-    hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
-    ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %#lx cnt:%lu\n", hr, cnt);
-
-    hr = IDirectInputDevice_Acquire(pMouse);
-    ok(hr == S_OK, "Failed: %#lx\n", hr);
-    mouse_event(MOUSEEVENTF_MOVE, 10, 10, 0, 0);
-    hr = IDirectInputDevice_Unacquire(pMouse);
-    ok(hr == S_OK, "Failed: %#lx\n", hr);
-
-    hr = IDirectInputDevice_Acquire(pMouse);
-    ok(hr == S_OK, "Failed: %#lx\n", hr);
-    cnt = 1;
-    hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
-    ok(hr == S_OK && cnt > 0, "GetDeviceData() failed: %#lx cnt:%lu\n", hr, cnt);
-
-    /* Check for buffer overflow */
-    for (i = 0; i < 6; i++)
-        mouse_event(MOUSEEVENTF_MOVE, 10 + i, 10 + i, 0, 0);
-
-    cnt = 1;
-    hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
-    ok(hr == DI_OK, "GetDeviceData() failed: %#lx cnt:%lu\n", hr, cnt);
-    cnt = 1;
-    hr = IDirectInputDevice_GetDeviceData(pMouse, sizeof(mouse_state), &mouse_state, &cnt, 0);
-    ok(hr == DI_OK && cnt == 1, "GetDeviceData() failed: %#lx cnt:%lu\n", hr, cnt);
-
-    IUnknown_Release(pMouse);
-
-    DestroyWindow( hwnd2 );
-}
-
-static void mouse_tests(void)
-{
-    HRESULT hr;
-    IDirectInputA *pDI = NULL;
-    HWND hwnd;
-    ULONG ref = 0;
-
-    hr = DirectInputCreateA(instance, DIRECTINPUT_VERSION, &pDI, NULL);
-    if (hr == DIERR_OLDDIRECTINPUTVERSION)
-    {
-        skip("Tests require a newer dinput version\n");
-        return;
-    }
-    ok(SUCCEEDED(hr), "DirectInputCreateA() failed: %#lx\n", hr);
-    if (FAILED(hr)) return;
-
-    hwnd = CreateWindowA("static", "Title", WS_OVERLAPPEDWINDOW, 10, 10, 200, 200, NULL, NULL,
-                         NULL, NULL);
-    ok(hwnd != NULL, "err: %lu\n", GetLastError());
-    if (hwnd)
-    {
-        ShowWindow(hwnd, SW_SHOW);
-
-        test_set_coop(pDI, hwnd);
-        test_acquire(pDI, hwnd);
-
-        DestroyWindow(hwnd);
-    }
-    if (pDI) ref = IUnknown_Release(pDI);
-    ok(!ref, "IDirectInput_Release() reference count = %lu\n", ref);
-}
-
-START_TEST(mouse)
-{
-    dinput_test_init();
-
-    mouse_tests();
-
-    dinput_test_exit();
-}
-- 
GitLab

https://gitlab.winehq.org/wine/wine/-/merge_requests/208



More information about the wine-devel mailing list