@@ -308,7 +308,7 @@ public void Actions_WhenShortcutsEnabled_CanConsumeInput(bool legacyComposites)
308308 public void Actions_PressingShortcutSequenceAtSameTime_TriggersbothShortcutsDueToNoPriority(string sharedModifier, string sharedModifier2, string binding1, string binding2,
309309 bool legacyComposites)
310310 {
311- InputSystem.settings.shortcutKeysConsumeInput = false ;
311+ InputSystem.settings.shortcutKeysConsumeInput = true ;
312312 var keyboard = InputSystem.AddDevice<Keyboard>();
313313
314314 var action1 = new InputAction();
@@ -341,6 +341,9 @@ public void Actions_PressingShortcutSequenceAtSameTime_TriggersbothShortcutsDueT
341341 .With(legacyComposites ? "Button" : "Binding", "<Keyboard>/" + binding2);
342342 }
343343
344+ action1.Priority = 0;
345+ action2.Priority = 1;
346+
344347 action1.Enable();
345348 action2.Enable();
346349
@@ -350,13 +353,15 @@ public void Actions_PressingShortcutSequenceAtSameTime_TriggersbothShortcutsDueT
350353 Assert.That(action2.WasPerformedThisFrame(), Is.False);
351354 if (!string.IsNullOrEmpty(sharedModifier2))
352355 {
353- Assert.That(action1.WasPerformedThisFrame(), Is.False);
354- Assert.That(action2.WasPerformedThisFrame(), Is.False);
355356 Press((ButtonControl)keyboard[sharedModifier2], queueEventOnly: true);
356357 }
357358
359+ Assert.That(action1.WasPerformedThisFrame(), Is.False);
360+ Assert.That(action2.WasPerformedThisFrame(), Is.False);
361+
358362 Press((ButtonControl)keyboard[binding1], queueEventOnly: true);
359- Press((ButtonControl)keyboard[binding2]);
363+ Press((ButtonControl)keyboard[binding2], queueEventOnly: true);
364+ InputSystem.Update();
360365
361366 // Action1 won't be performed due to the priority being below action2
362367 Assert.That(action1.WasPerformedThisFrame(), Is.True);
@@ -382,25 +387,26 @@ public void Actions_PressingTwoShortcutsSequenceAtSameTime_TriggersOneShortcutDu
382387 .With("Modifier", "<Keyboard>/" + sharedModifier2)
383388 .With(legacyComposites ? "Button" : "Binding", "<Keyboard>/" + binding2);
384389
385-
386- action1.Enable();
387- action2.Enable();
388-
389390 // TODO: Priority not working, not sure why FIX THIS
390391 action1.Priority = 0;
391392 action2.Priority = 1;
392393
394+ action1.Enable();
395+ action2.Enable();
396+
397+ var action1WasPerformed = false;
398+ action1.performed += _ => action1WasPerformed = true;
393399
394400 Assert.That(action1.WasPerformedThisFrame(), Is.False);
395401 Assert.That(action2.WasPerformedThisFrame(), Is.False);
396402
397- Press((ButtonControl)keyboard[sharedModifier], queueEventOnly: true);
398- Press((ButtonControl)keyboard[binding1], queueEventOnly: true);
399- Press((ButtonControl)keyboard[sharedModifier2], queueEventOnly: true);
400- Press((ButtonControl)keyboard[binding2]);
403+ Press((ButtonControl)keyboard[sharedModifier], time: 1, queueEventOnly: true);
404+ Press((ButtonControl)keyboard[binding1], time: 1, queueEventOnly: true);
405+ Press((ButtonControl)keyboard[sharedModifier2], 1, queueEventOnly: true);
406+ Press((ButtonControl)keyboard[binding2], time: 1 );
401407
402408 // Action1 won't be performed due to the priority being below action2
403- Assert.That(action1.WasPerformedThisFrame() , Is.True);
409+ Assert.That(action1WasPerformed , Is.True);
404410 Assert.That(action2.WasPerformedThisFrame(), Is.True);
405411 }
406412
0 commit comments