From ae9f7b0364684d11276656f4429681ceb3854c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Mon, 20 Sep 2021 10:57:23 +0200 Subject: [PATCH] dinput8/tests: Add some HID joystick IDirectInputDevice8_Initialize tests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- 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;