@@ -66,6 +66,11 @@ private static IEnumerable<TwoInputActionDataWrapper<InputAction, InputAction>>
6666 Action1 = map . SetupTestAction ( "ctrl" , "shift" , "v" ) ,
6767 Action2 = map . SetupTestAction ( "shift" , "v" )
6868 } ;
69+ // yield return new TwoInputActionDataWrapper<InputAction, InputAction>
70+ // {
71+ // Action1 = map.SetupTestAction("ctrl", "enter", "w"),
72+ // Action2 = map.SetupTestAction("alt", "shift", "w")
73+ // };
6974 }
7075
7176 public class TwoInputActionDataWrapper < TInputAction1 , TInputAction2 >
@@ -74,7 +79,14 @@ public class TwoInputActionDataWrapper<TInputAction1, TInputAction2>
7479 public TInputAction2 Action2 ;
7580 }
7681
77- private void PressBindingsForInputActions ( Keyboard keyboard , InputAction action1 , InputAction action2 )
82+ public class ThreeInputActionDataWrapper < TInputAction1 , TInputAction2 , TInputAction3 >
83+ {
84+ public TInputAction1 Action1 ;
85+ public TInputAction2 Action2 ;
86+ public TInputAction3 Action3 ;
87+ }
88+
89+ private void PressBindingsForInputActions ( Keyboard keyboard , InputAction action1 , InputAction action2 , InputAction action3 = null )
7890 {
7991 for ( int i = 0 ; i < action1 . controls . Count ; i ++ )
8092 {
@@ -88,6 +100,15 @@ private void PressBindingsForInputActions(Keyboard keyboard, InputAction action1
88100 Press ( ( ButtonControl ) keyboard [ action2 . controls [ i ] . name ] , queueEventOnly : true ) ;
89101 }
90102
103+ if ( action3 != null )
104+ {
105+ for ( int i = 0 ; i < action2 . controls . Count ; i ++ )
106+ {
107+ Debug . Log ( "action 2 binding pressed: " + action2 . controls [ i ] . name ) ;
108+ Press ( ( ButtonControl ) keyboard [ action2 . controls [ i ] . name ] , queueEventOnly : true ) ;
109+ }
110+ }
111+
91112 InputSystem . Update ( ) ;
92113 }
93114
@@ -363,4 +384,36 @@ public void Actions_Priority_BothActionsWithEqualPriorityFire_WhenThereIsNoConfl
363384 Assert . That ( action1WasPerformed , Is . True ) ;
364385 Assert . That ( action2 . WasPerformedThisFrame ( ) , Is . True ) ;
365386 }
387+
388+ private static IEnumerable < ThreeInputActionDataWrapper < InputAction , InputAction , InputAction > > ThreeInputActionNoConflictingBindingTestCases ( )
389+ {
390+ InputActionMap map = new InputActionMap ( "map" ) ;
391+ yield return new ThreeInputActionDataWrapper < InputAction , InputAction , InputAction >
392+ {
393+ Action1 = map . SetupTestAction ( "alt" , "shift" , "w" ) ,
394+ Action2 = map . SetupTestAction ( "z" ) ,
395+ Action3 = map . SetupTestAction ( "l" ) ,
396+ } ;
397+ }
398+
399+ [ Test ]
400+ [ Category ( "Actions Priority" ) ]
401+ [ Ignore ( "Weird failing case from Anthony" ) ]
402+ [ TestCaseSource ( nameof ( ThreeInputActionNoConflictingBindingTestCases ) ) ]
403+ public void AltShiftW_Only_Triggers_TeamChat ( ThreeInputActionDataWrapper < InputAction , InputAction , InputAction > threeInputActions )
404+ {
405+ var keyboard = InputSystem . AddDevice < Keyboard > ( ) ;
406+ PressBindingsForInputActions ( keyboard , threeInputActions . Action1 , threeInputActions . Action2 ) ;
407+
408+
409+ Assert . That ( threeInputActions . Action1 . WasPerformedThisFrame ( ) , Is . True ) ;
410+
411+ //Assert.IsTrue(threeInputActions.Action1.WasPerformedThisFrame(), "Team chat should be activated by Alt+Shift+W.");
412+ // Assert.IsFalse(moveAction.IsPressed(), "Move should not be activated when Team chat takes priority.");
413+ // Assert.IsFalse(runFastAction.IsPressed(), "Run Fast should not be activated when Team chat takes priority.");
414+
415+ // Release(keyboard.wKey);
416+ // Release(keyboard.leftShiftKey);
417+ // Release(keyboard.altKey);
418+ }
366419}
0 commit comments