[PATCH 5/5] dinput/tests: Add some IRawGameController2 interface tests.

Rémi Bernon rbernon at codeweavers.com
Wed Feb 23 10:49:40 CST 2022


Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/dinput/tests/joystick8.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c
index f01bed08030..ddc88ff56fe 100644
--- a/dlls/dinput/tests/joystick8.c
+++ b/dlls/dinput/tests/joystick8.c
@@ -3273,14 +3273,17 @@ static void test_windows_gaming_input(void)
     static const WCHAR *controller_class_name = RuntimeClass_Windows_Gaming_Input_RawGameController;
     static const WCHAR *gamepad_class_name = RuntimeClass_Windows_Gaming_Input_Gamepad;
 
+    IVectorView_SimpleHapticsController *haptics_controllers;
     IRawGameController *raw_controller, *tmp_raw_controller;
     IVectorView_RawGameController *controllers_view;
     IRawGameControllerStatics *controller_statics;
     WCHAR cwd[MAX_PATH], tempdir[MAX_PATH];
+    IRawGameController2 *raw_controller2;
     IVectorView_Gamepad *gamepads_view;
     IGamepadStatics *gamepad_statics;
     IGameController *game_controller;
-    UINT32 size;
+    UINT32 size, length;
+    const WCHAR *buffer;
     HSTRING str;
     HRESULT hr;
 
@@ -3376,6 +3379,33 @@ static void test_windows_gaming_input(void)
     IRawGameController_Release( tmp_raw_controller );
 
     IGameController_Release( game_controller );
+
+    hr = IRawGameController_QueryInterface( raw_controller, &IID_IRawGameController2, (void **)&raw_controller2 );
+    ok( hr == S_OK, "QueryInterface returned %#lx\n", hr );
+
+    hr = IRawGameController2_get_DisplayName( raw_controller2, &str );
+    ok( hr == S_OK, "get_DisplayName returned %#lx\n", hr );
+    buffer = WindowsGetStringRawBuffer( str, &length );
+    ok( !wcscmp( buffer, L"Xbox 360 Controller for Windows" ),
+            "get_DisplayName returned %s\n", debugstr_wn(buffer, length) );
+    WindowsDeleteString( str );
+
+    hr = IRawGameController2_get_NonRoamableId( raw_controller2, &str );
+    ok( hr == S_OK, "get_NonRoamableId returned %#lx\n", hr );
+    buffer = WindowsGetStringRawBuffer( str, &length );
+    ok( !wcscmp( buffer, L"{wgi/nrid/GmVbh^-FUL-nQOi-FgZbDiP-0Q8R1k-9ocj5N-}" ),
+            "get_NonRoamableId returned %s\n", debugstr_wn(buffer, length) );
+    WindowsDeleteString( str );
+
+    hr = IRawGameController2_get_SimpleHapticsControllers( raw_controller2, &haptics_controllers );
+    ok( hr == S_OK, "get_SimpleHapticsControllers returned %#lx\n", hr );
+    hr = IVectorView_SimpleHapticsController_get_Size( haptics_controllers, &length );
+    ok( hr == S_OK, "get_Size returned %#lx\n", hr );
+    ok( length == 0, "got length %u\n", length );
+    IVectorView_SimpleHapticsController_Release( haptics_controllers );
+
+    IRawGameController2_Release( raw_controller2 );
+
     IRawGameController_Release( raw_controller );
 
     IRawGameControllerStatics_Release( controller_statics );
-- 
2.34.1




More information about the wine-devel mailing list