Fix smoke 2차 gaps: hotkey tests, focus filter, viewport picking (#13)
Gap E — Hotkey named key - UiaPlayerHost: extract ParsedHotkey record + ParseHotkey static - HotkeyParseTests: 8 tests (enter/tab/a/ctrl+c/ctrl+shift+s/f5/alt+f4/empty) Gap F — recorder focus_change SUT filter - FocusEventFilter.ShouldAccept static rule (same/zero/unknown/unknown-sut) - Program.cs wires it inside RegisterFocusChangedEvent callback - FocusEventFilterTests: 4 tests Gap G — viewport picking foreign-process fallback - IWindowPointSource + WindowPointResolver pure resolver - FlaUiPointSource wired in Program.cs (best-effort hit test, honest partial for live SUT) - WindowPointResolverTests: 5 tests Tests: 77 → 94, build 0/0 (TreatWarningsAsErrors preserved). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
71
tests/Recordingtest.Player.Tests/HotkeyParseTests.cs
Normal file
71
tests/Recordingtest.Player.Tests/HotkeyParseTests.cs
Normal file
@@ -0,0 +1,71 @@
|
||||
using FlaUI.Core.WindowsAPI;
|
||||
using Xunit;
|
||||
|
||||
namespace Recordingtest.Player.Tests;
|
||||
|
||||
public class HotkeyParseTests
|
||||
{
|
||||
[Fact]
|
||||
public void Enter_NoMods_ReturnsReturnKey()
|
||||
{
|
||||
var p = UiaPlayerHost.ParseHotkey("enter");
|
||||
Assert.Empty(p.Modifiers);
|
||||
Assert.Equal(VirtualKeyShort.RETURN, p.Main);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tab_NoMods_ReturnsTabKey()
|
||||
{
|
||||
var p = UiaPlayerHost.ParseHotkey("tab");
|
||||
Assert.Empty(p.Modifiers);
|
||||
Assert.Equal(VirtualKeyShort.TAB, p.Main);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SingleChar_a_ReturnsAKey()
|
||||
{
|
||||
var p = UiaPlayerHost.ParseHotkey("a");
|
||||
Assert.Empty(p.Modifiers);
|
||||
Assert.Equal((VirtualKeyShort)'A', p.Main);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CtrlC_ReturnsControlModPlusC()
|
||||
{
|
||||
var p = UiaPlayerHost.ParseHotkey("ctrl+c");
|
||||
Assert.Equal(new[] { VirtualKeyShort.CONTROL }, p.Modifiers);
|
||||
Assert.Equal((VirtualKeyShort)'C', p.Main);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CtrlShiftS_ReturnsBothModsPlusS()
|
||||
{
|
||||
var p = UiaPlayerHost.ParseHotkey("ctrl+shift+s");
|
||||
Assert.Equal(new[] { VirtualKeyShort.CONTROL, VirtualKeyShort.SHIFT }, p.Modifiers);
|
||||
Assert.Equal((VirtualKeyShort)'S', p.Main);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void F5_ReturnsF5Key()
|
||||
{
|
||||
var p = UiaPlayerHost.ParseHotkey("f5");
|
||||
Assert.Empty(p.Modifiers);
|
||||
Assert.Equal((VirtualKeyShort)(0x70 + 4), p.Main);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AltF4_ReturnsAltPlusF4()
|
||||
{
|
||||
var p = UiaPlayerHost.ParseHotkey("alt+f4");
|
||||
Assert.Equal(new[] { VirtualKeyShort.ALT }, p.Modifiers);
|
||||
Assert.Equal((VirtualKeyShort)(0x70 + 3), p.Main);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Empty_ReturnsNoModsNoMain()
|
||||
{
|
||||
var p = UiaPlayerHost.ParseHotkey("");
|
||||
Assert.Empty(p.Modifiers);
|
||||
Assert.Null(p.Main);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user