fix: arm held Command on activation and animate number overlays
This commit is contained in:
@@ -30,3 +30,37 @@ import Testing
|
||||
let afterReset = shortcuts.reveal(at: 20)
|
||||
#expect(!afterReset)
|
||||
}
|
||||
|
||||
@Test(arguments: [false, true])
|
||||
func commandHeldAtActivationArmsWithoutAModifierEvent(resultsInitiallyEligible: Bool) {
|
||||
var shortcuts = CommandNumberShortcuts()
|
||||
let activation = shortcuts.update(commandOnly: true, eligible: resultsInitiallyEligible, at: 10)
|
||||
let afterDiscovery = shortcuts.update(commandOnly: true, eligible: true, at: 10.1)
|
||||
let spaceReleased = shortcuts.update(commandOnly: true, eligible: true, at: 10.2)
|
||||
#expect(activation == resultsInitiallyEligible)
|
||||
#expect(afterDiscovery == !resultsInitiallyEligible && !spaceReleased)
|
||||
let heldAt = resultsInitiallyEligible ? 10.0 : 10.1
|
||||
let early = shortcuts.reveal(at: heldAt + 0.999)
|
||||
let revealed = shortcuts.reveal(at: heldAt + 1)
|
||||
#expect(!early && revealed)
|
||||
}
|
||||
|
||||
@Test func commandShortcutCancellationSurvivesEligibilityAndSpaceReleaseSamples() {
|
||||
var shortcuts = CommandNumberShortcuts()
|
||||
_ = shortcuts.update(commandOnly: true, eligible: true, at: 10)
|
||||
shortcuts.cancel()
|
||||
_ = shortcuts.update(commandOnly: true, eligible: false, at: 10.2)
|
||||
let afterDiscovery = shortcuts.update(commandOnly: true, eligible: true, at: 10.3)
|
||||
let spaceReleased = shortcuts.update(commandOnly: true, eligible: true, at: 10.4)
|
||||
let cancelled = shortcuts.reveal(at: 12)
|
||||
#expect(!afterDiscovery && !spaceReleased && !cancelled && !shortcuts.isHolding)
|
||||
_ = shortcuts.update(commandOnly: false, eligible: true, at: 12.1)
|
||||
let freshHold = shortcuts.update(commandOnly: true, eligible: true, at: 13)
|
||||
let revealed = shortcuts.reveal(at: 14)
|
||||
#expect(freshHold && revealed)
|
||||
shortcuts.cancel()
|
||||
shortcuts.reset() // Reopening the launcher starts a new activation session.
|
||||
let reopened = shortcuts.update(commandOnly: true, eligible: true, at: 15)
|
||||
let reopenedVisible = shortcuts.reveal(at: 16)
|
||||
#expect(reopened && reopenedVisible)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user