This commit is contained in:
@@ -232,6 +232,32 @@ public sealed class CapsLockHotkeyServiceTests
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A hold is never announced for a key that has already been let go.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// The countdown started by the press can still be delivered just after the
|
||||
/// release: Windows does not withdraw a WM_TIMER it has already posted. Taken at
|
||||
/// face value it turned a tap into a hold — the popup came up showing the layout
|
||||
/// the tap was about to change away from, and the switch followed it.
|
||||
///
|
||||
/// The tick is driven straight in here rather than waited for, because the point is
|
||||
/// the one ordering a real clock will not reproduce on demand.
|
||||
/// </remarks>
|
||||
[Fact]
|
||||
public void A_hold_is_not_announced_after_the_key_has_been_released()
|
||||
{
|
||||
using var harness = Harness.Create(holdMilliseconds: 10_000);
|
||||
|
||||
harness.Press();
|
||||
harness.Release();
|
||||
|
||||
harness.ForceHoldTick();
|
||||
Pump.Drain();
|
||||
|
||||
Assert.Equal(["tap"], harness.Events);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The service together with its settings and the list of events that happened.
|
||||
/// </summary>
|
||||
@@ -271,6 +297,9 @@ public sealed class CapsLockHotkeyServiceTests
|
||||
|
||||
internal void Release() => Pump.Run(() => Service.HandleKeyEvent(CapsLock, isKeyDown: false));
|
||||
|
||||
/// <summary>Delivers the hold countdown by hand, the way a late WM_TIMER does.</summary>
|
||||
internal void ForceHoldTick() => Pump.Run(Service.HandleHoldElapsed);
|
||||
|
||||
public void Dispose() => Pump.Run(Service.Dispose);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user