@@ -56,13 +56,60 @@ public void Devices_SupportsiOSGamePad(string product, Type deviceType, Type par
5656 Assert . That ( gamepad . rightTrigger . ReadValue ( ) , Is . EqualTo ( 0.456 ) . Within ( 0.000001 ) ) ;
5757
5858 AssertButtonPress ( gamepad , new iOSGameControllerState ( ) . WithButton ( iOSButton . A ) , gamepad . buttonSouth ) ;
59+ AssertButtonPress ( gamepad , new iOSGameControllerState ( ) . WithButton ( iOSButton . A ) , gamepad . aButton ) ;
5960 AssertButtonPress ( gamepad , new iOSGameControllerState ( ) . WithButton ( iOSButton . X ) , gamepad . buttonWest ) ;
61+ AssertButtonPress ( gamepad , new iOSGameControllerState ( ) . WithButton ( iOSButton . X ) , gamepad . xButton ) ;
6062 AssertButtonPress ( gamepad , new iOSGameControllerState ( ) . WithButton ( iOSButton . Y ) , gamepad . buttonNorth ) ;
63+ AssertButtonPress ( gamepad , new iOSGameControllerState ( ) . WithButton ( iOSButton . Y ) , gamepad . yButton ) ;
6164 AssertButtonPress ( gamepad , new iOSGameControllerState ( ) . WithButton ( iOSButton . B ) , gamepad . buttonEast ) ;
65+ AssertButtonPress ( gamepad , new iOSGameControllerState ( ) . WithButton ( iOSButton . B ) , gamepad . bButton ) ;
6266 AssertButtonPress ( gamepad , new iOSGameControllerState ( ) . WithButton ( iOSButton . LeftShoulder ) , gamepad . leftShoulder ) ;
6367 AssertButtonPress ( gamepad , new iOSGameControllerState ( ) . WithButton ( iOSButton . RightShoulder ) , gamepad . rightShoulder ) ;
6468 }
6569
70+ [ Test ]
71+ [ Category ( "Devices" ) ]
72+ // this is a new test, as we need to assert the Nintendo layout (e.g. buttonSouth == B button)
73+ public void Devices_SupportsProControlleriOS ( )
74+ {
75+ var device = InputSystem . AddDevice (
76+ new InputDeviceDescription
77+ {
78+ interfaceName = "iOS" ,
79+ deviceClass = "iOSGameController" ,
80+ product = "Pro Controller"
81+ } ) ;
82+ Assert . That ( device , Is . TypeOf ( typeof ( SwitchProControlleriOS ) ) ) ;
83+ Assert . That ( device , Is . InstanceOf ( typeof ( Gamepad ) ) ) ;
84+
85+ var gamepad = ( SwitchProControlleriOS ) device ;
86+
87+ InputSystem . QueueStateEvent ( gamepad ,
88+ new iOSGameControllerStateSwappedFaceButtons ( )
89+ . WithButton ( iOSButton . LeftTrigger , true , 0.123f )
90+ . WithButton ( iOSButton . RightTrigger , true , 0.456f )
91+ . WithAxis ( iOSAxis . LeftStickX , 0.789f )
92+ . WithAxis ( iOSAxis . LeftStickY , 0.987f )
93+ . WithAxis ( iOSAxis . RightStickX , 0.654f )
94+ . WithAxis ( iOSAxis . RightStickY , 0.321f ) ) ;
95+ InputSystem . Update ( ) ;
96+
97+ var leftStickDeadzone = gamepad . leftStick . TryGetProcessor < StickDeadzoneProcessor > ( ) ;
98+ var rightStickDeadzone = gamepad . leftStick . TryGetProcessor < StickDeadzoneProcessor > ( ) ;
99+
100+ Assert . That ( gamepad . leftStick . ReadValue ( ) , Is . EqualTo ( leftStickDeadzone . Process ( new Vector2 ( 0.789f , 0.987f ) ) ) ) ;
101+ Assert . That ( gamepad . rightStick . ReadValue ( ) , Is . EqualTo ( rightStickDeadzone . Process ( new Vector2 ( 0.654f , 0.321f ) ) ) ) ;
102+ Assert . That ( gamepad . leftTrigger . ReadValue ( ) , Is . EqualTo ( 0.123 ) . Within ( 0.000001 ) ) ;
103+ Assert . That ( gamepad . rightTrigger . ReadValue ( ) , Is . EqualTo ( 0.456 ) . Within ( 0.000001 ) ) ;
104+ // testing for Pro Controller layout...
105+ AssertButtonPress ( gamepad , new iOSGameControllerStateSwappedFaceButtons ( ) . WithButton ( iOSButton . A ) , gamepad . buttonEast ) ;
106+ AssertButtonPress ( gamepad , new iOSGameControllerStateSwappedFaceButtons ( ) . WithButton ( iOSButton . X ) , gamepad . buttonNorth ) ;
107+ AssertButtonPress ( gamepad , new iOSGameControllerStateSwappedFaceButtons ( ) . WithButton ( iOSButton . Y ) , gamepad . buttonWest ) ;
108+ AssertButtonPress ( gamepad , new iOSGameControllerStateSwappedFaceButtons ( ) . WithButton ( iOSButton . B ) , gamepad . buttonSouth ) ;
109+ AssertButtonPress ( gamepad , new iOSGameControllerStateSwappedFaceButtons ( ) . WithButton ( iOSButton . LeftShoulder ) , gamepad . leftShoulder ) ;
110+ AssertButtonPress ( gamepad , new iOSGameControllerStateSwappedFaceButtons ( ) . WithButton ( iOSButton . RightShoulder ) , gamepad . rightShoulder ) ;
111+ }
112+
66113 [ Test ]
67114 [ Category ( "Devices" ) ]
68115 [ TestCase ( "Gravity" , typeof ( GravitySensor ) ) ]
0 commit comments