@@ -303,7 +303,7 @@ public void Actions_WhenShortcutsEnabled_CanConsumeInput(bool legacyComposites)
303303 [Category("Actions Priority")]
304304 [TestCase("ctrl", "x", true)]
305305 [TestCase("ctrl", "x", false)]
306- public void Actions_PressingShortcutSequenceAtSameTime_TriggersbothShortcutsDueToNoPriority (string sharedModifier, string binding1, bool legacyComposites)
306+ public void Actions_PressingModifierShortcutWithSameBinding_TriggersHighestPriorityAction (string sharedModifier, string binding1, bool legacyComposites)
307307 {
308308 InputSystem.settings.shortcutKeysConsumeInput = true;
309309 var keyboard = InputSystem.AddDevice<Keyboard>();
@@ -336,29 +336,27 @@ public void Actions_PressingShortcutSequenceAtSameTime_TriggersbothShortcutsDueT
336336
337337 [Test]
338338 [Category("Actions Priority")]
339- [TestCase("ctrl", "shift", "x", "c", false)]
340- public void Actions_PressingTwoShortcutsSequenceAtSameTime_TriggersOneShortcutDueToPriority(string sharedModifier, string sharedModifier2, string binding1, string binding2,
341- bool legacyComposites)
339+ [TestCase("ctrl", "shift", "x", false)]
340+ public void Actions_PressingTwoShortcutAtSameTime_TriggersOneShortcutDueToPriority(string sharedModifier, string sharedModifier2, string binding1, bool legacyComposites)
342341 {
343342 InputSystem.settings.shortcutKeysConsumeInput = true;
344-
345343 var keyboard = InputSystem.AddDevice<Keyboard>();
346- var action1 = new InputAction();
344+
345+ var map = new InputActionMap("map");
346+ var action1 = map.AddAction("action1");
347347 action1.AddCompositeBinding((legacyComposites ? "ButtonWithOneModifier" : "OneModifier") + "(overrideModifiersNeedToBePressedFirst)")
348348 .With("Modifier", "<Keyboard>/" + sharedModifier)
349349 .With(legacyComposites ? "Button" : "Binding", "<Keyboard>/" + binding1);
350350
351- var action2 = new InputAction( );
351+ var action2 = map.AddAction("action2" );
352352 action2.AddCompositeBinding((legacyComposites ? "ButtonWithOneModifier" : "OneModifier") + "(overrideModifiersNeedToBePressedFirst)")
353353 .With("Modifier", "<Keyboard>/" + sharedModifier2)
354- .With(legacyComposites ? "Button" : "Binding", "<Keyboard>/" + binding2 );
354+ .With(legacyComposites ? "Button" : "Binding", "<Keyboard>/" + binding1 );
355355
356- // TODO: Priority not working, not sure why FIX THIS
357356 action1.Priority = 0;
358357 action2.Priority = 1;
359358
360- action1.Enable();
361- action2.Enable();
359+ map.Enable();
362360
363361 var action1WasPerformed = false;
364362 action1.performed += _ => action1WasPerformed = true;
@@ -367,12 +365,12 @@ public void Actions_PressingTwoShortcutsSequenceAtSameTime_TriggersOneShortcutDu
367365 Assert.That(action2.WasPerformedThisFrame(), Is.False);
368366
369367 Press((ButtonControl)keyboard[sharedModifier], queueEventOnly: true);
370- Press((ButtonControl)keyboard[binding1], queueEventOnly: true);
371368 Press((ButtonControl)keyboard[sharedModifier2], queueEventOnly: true);
372- Press((ButtonControl)keyboard[binding2]);
369+ Press((ButtonControl)keyboard[binding1], queueEventOnly: true);
370+ InputSystem.Update();
373371
374372 // Action1 won't be performed due to the priority being below action2
375- Assert.That(action1WasPerformed, Is.True );
373+ Assert.That(action1WasPerformed, Is.False );
376374 Assert.That(action2.WasPerformedThisFrame(), Is.True);
377375 }
378376
0 commit comments