Rémi Bernon : dinput8/tests: Add some HID joystick IDirectInputDevice8_Initialize tests.

Alexandre Julliard julliard at winehq.org
Mon Sep 20 16:26:21 CDT 2021


Module: wine
Branch: master
Commit: ae9f7b0364684d11276656f4429681ceb3854c1e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ae9f7b0364684d11276656f4429681ceb3854c1e

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon Sep 20 10:57:23 2021 +0200

dinput8/tests: Add some HID joystick IDirectInputDevice8_Initialize tests.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dinput8/tests/hid.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/dlls/dinput8/tests/hid.c b/dlls/dinput8/tests/hid.c
index 62ab11d02c8..0456b8f8de1 100644
--- a/dlls/dinput8/tests/hid.c
+++ b/dlls/dinput8/tests/hid.c
@@ -3638,6 +3638,7 @@ static void test_simple_joystick(void)
     ULONG i, res, ref;
     HRESULT hr;
     WCHAR *tmp;
+    GUID guid;
     HWND hwnd;
 
     GetCurrentDirectoryW( ARRAY_SIZE(cwd), cwd );
@@ -3698,6 +3699,31 @@ static void test_simple_joystick(void)
     hr = IDirectInput8_CreateDevice( di, &expect_guid_product, &device, NULL );
     ok( hr == DI_OK, "IDirectInput8_CreateDevice returned %#x\n", hr );
 
+    hr = IDirectInputDevice8_Initialize( device, instance, 0x0700, &GUID_NULL );
+    todo_wine
+    ok( hr == DIERR_BETADIRECTINPUTVERSION, "IDirectInputDevice8_Initialize returned %#x\n", hr );
+    hr = IDirectInputDevice8_Initialize( device, instance, DIRECTINPUT_VERSION, NULL );
+    todo_wine
+    ok( hr == E_POINTER, "IDirectInputDevice8_Initialize returned %#x\n", hr );
+    hr = IDirectInputDevice8_Initialize( device, NULL, DIRECTINPUT_VERSION, &GUID_NULL );
+    todo_wine
+    ok( hr == DIERR_INVALIDPARAM, "IDirectInputDevice8_Initialize returned %#x\n", hr );
+    hr = IDirectInputDevice8_Initialize( device, instance, DIRECTINPUT_VERSION, &GUID_NULL );
+    todo_wine
+    ok( hr == REGDB_E_CLASSNOTREG, "IDirectInputDevice8_Initialize returned %#x\n", hr );
+
+    hr = IDirectInputDevice8_Initialize( device, instance, DIRECTINPUT_VERSION, &devinst.guidInstance );
+    ok( hr == DI_OK, "IDirectInputDevice8_Initialize returned %#x\n", hr );
+    guid = devinst.guidInstance;
+    memset( &devinst, 0, sizeof(devinst) );
+    devinst.dwSize = sizeof(DIDEVICEINSTANCEW);
+    hr = IDirectInputDevice8_GetDeviceInfo( device, &devinst );
+    ok( hr == DI_OK, "IDirectInputDevice8_GetDeviceInfo returned %#x\n", hr );
+    ok( IsEqualGUID( &guid, &devinst.guidInstance ), "got %s expected %s\n", debugstr_guid( &guid ),
+        debugstr_guid( &devinst.guidInstance ) );
+    hr = IDirectInputDevice8_Initialize( device, instance, DIRECTINPUT_VERSION, &devinst.guidProduct );
+    ok( hr == DI_OK, "IDirectInputDevice8_Initialize returned %#x\n", hr );
+
     hr = IDirectInputDevice8_GetDeviceInfo( device, NULL );
     ok( hr == E_POINTER, "IDirectInputDevice8_GetDeviceInfo returned %#x\n", hr );
     devinst.dwSize = sizeof(DIDEVICEINSTANCEW) + 1;




More information about the wine-cvs mailing list