fix bug - popup windows show hiding logic
Pull request / build (pull_request) Successful in 39s

This commit is contained in:
2026-08-12 18:12:08 +05:00
parent 6259dbd6b3
commit 87266e6c13
13 changed files with 503 additions and 442 deletions
@@ -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);
}
}