From 3c2bb0f87c48faf17adc5f2ae8a1229043b7ee70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Wed, 23 Feb 2022 17:49:39 +0100 Subject: [PATCH] dinput/tests: Add tests for IGamepadStatics_get_Gamepads. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Showing that HID gamepads aren't listed as WGI gamepads. Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- dlls/dinput/tests/joystick8.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c index d98faf7d3ee..f01bed08030 100644 --- a/dlls/dinput/tests/joystick8.c +++ b/dlls/dinput/tests/joystick8.c @@ -3271,11 +3271,14 @@ static void test_windows_gaming_input(void) .InputReportByteLength = 8, }; static const WCHAR *controller_class_name = RuntimeClass_Windows_Gaming_Input_RawGameController; + static const WCHAR *gamepad_class_name = RuntimeClass_Windows_Gaming_Input_Gamepad; IRawGameController *raw_controller, *tmp_raw_controller; IVectorView_RawGameController *controllers_view; IRawGameControllerStatics *controller_statics; WCHAR cwd[MAX_PATH], tempdir[MAX_PATH]; + IVectorView_Gamepad *gamepads_view; + IGamepadStatics *gamepad_statics; IGameController *game_controller; UINT32 size; HSTRING str; @@ -3331,6 +3334,21 @@ static void test_windows_gaming_input(void) goto done; } + /* HID gamepads aren't exposed as WGI gamepads on Windows */ + + hr = WindowsCreateString( gamepad_class_name, wcslen( gamepad_class_name ), &str ); + ok( hr == S_OK, "WindowsCreateString returned %#lx\n", hr ); + hr = RoGetActivationFactory( str, &IID_IGamepadStatics, (void **)&gamepad_statics ); + ok( hr == S_OK, "RoGetActivationFactory returned %#lx\n", hr ); + WindowsDeleteString( str ); + hr = IGamepadStatics_get_Gamepads( gamepad_statics, &gamepads_view ); + ok( hr == S_OK, "get_Gamepads returned %#lx\n", hr ); + hr = IVectorView_Gamepad_get_Size( gamepads_view, &size ); + ok( hr == S_OK, "get_Size returned %#lx\n", hr ); + ok( size == 0, "got size %u\n", size ); + IVectorView_Gamepad_Release( gamepads_view ); + IGamepadStatics_Release( gamepad_statics ); + check_runtimeclass( raw_controller, RuntimeClass_Windows_Gaming_Input_RawGameController ); check_interface( raw_controller, &IID_IUnknown, TRUE ); check_interface( raw_controller, &IID_IInspectable, TRUE );