Rémi Bernon : dinput/tests: Add tests for IRawGameControllerStatics_FromGameController.

Alexandre Julliard julliard at winehq.org
Thu Feb 24 15:33:41 CST 2022


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Wed Feb 23 17:49:38 2022 +0100

dinput/tests: Add tests for IRawGameControllerStatics_FromGameController.

And check the RawGameController IGameController interface.

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

---

 dlls/dinput/tests/joystick8.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/dlls/dinput/tests/joystick8.c b/dlls/dinput/tests/joystick8.c
index 959f91aae78..d98faf7d3ee 100644
--- a/dlls/dinput/tests/joystick8.c
+++ b/dlls/dinput/tests/joystick8.c
@@ -3272,10 +3272,11 @@ static void test_windows_gaming_input(void)
     };
     static const WCHAR *controller_class_name = RuntimeClass_Windows_Gaming_Input_RawGameController;
 
+    IRawGameController *raw_controller, *tmp_raw_controller;
     IVectorView_RawGameController *controllers_view;
     IRawGameControllerStatics *controller_statics;
     WCHAR cwd[MAX_PATH], tempdir[MAX_PATH];
-    IRawGameController *raw_controller;
+    IGameController *game_controller;
     UINT32 size;
     HSTRING str;
     HRESULT hr;
@@ -3339,7 +3340,26 @@ static void test_windows_gaming_input(void)
     check_interface( raw_controller, &IID_IGameController, TRUE );
     check_interface( raw_controller, &IID_IGamepad, FALSE );
 
+    hr = IRawGameController_QueryInterface( raw_controller, &IID_IGameController, (void **)&game_controller );
+    ok( hr == S_OK, "QueryInterface returned %#lx\n", hr );
+
+    check_runtimeclass( game_controller, RuntimeClass_Windows_Gaming_Input_RawGameController );
+    check_interface( game_controller, &IID_IUnknown, TRUE );
+    check_interface( game_controller, &IID_IInspectable, TRUE );
+    check_interface( game_controller, &IID_IAgileObject, TRUE );
+    check_interface( game_controller, &IID_IRawGameController, TRUE );
+    check_interface( game_controller, &IID_IRawGameController2, TRUE );
+    check_interface( game_controller, &IID_IGameController, TRUE );
+    check_interface( game_controller, &IID_IGamepad, FALSE );
+
+    hr = IRawGameControllerStatics_FromGameController( controller_statics, game_controller, &tmp_raw_controller );
+    ok( hr == S_OK, "FromGameController returned %#lx\n", hr );
+    ok( tmp_raw_controller == raw_controller, "got unexpected IGameController interface\n" );
+    IRawGameController_Release( tmp_raw_controller );
+
+    IGameController_Release( game_controller );
     IRawGameController_Release( raw_controller );
+
     IRawGameControllerStatics_Release( controller_statics );
 
 done:




More information about the wine-cvs mailing list