Fix smoke gaps: recorder target + VK translation, player enum + null guard (#11)

This commit is contained in:
minsung
2026-04-07 17:30:53 +09:00
parent a0609f8f0e
commit 139fbbc0bc
10 changed files with 515 additions and 15 deletions

View File

@@ -153,6 +153,66 @@ baselines:
Assert.Single(s.Baselines);
}
[Fact]
public void PlayerEngine_NullTarget_SkipsWithoutCalling()
{
var engine = new PlayerEngine();
var host = new FakePlayerHost();
var scenario = new Scenario
{
Steps =
{
new Step { Kind = StepKind.Click, Target = null },
new Step { Kind = StepKind.Drag, Target = null },
new Step { Kind = StepKind.Type, Target = null, Value = "hello" },
},
};
engine.Run(scenario, host);
Assert.Empty(host.Clicks);
Assert.Empty(host.Drags);
Assert.Empty(host.Types);
Assert.Empty(host.Failures);
}
[Fact]
public void PlayerEngine_WheelKind_DoesNotThrow()
{
var engine = new PlayerEngine();
var host = new FakePlayerHost();
var scenario = new Scenario
{
Steps =
{
new Step { Kind = StepKind.Wheel, Value = "-120" },
new Step { Kind = StepKind.Focus },
},
};
engine.Run(scenario, host);
Assert.Empty(host.Failures);
}
[Fact]
public void ScenarioLoader_ParsesWheelAndFocusKinds()
{
const string yaml = """
name: wheel-focus
steps:
- kind: wheel
value: "-120"
- kind: focus
target:
uia_path: "Window/Edit"
offset: [0.5, 0.5]
""";
var s = ScenarioLoader.LoadFromString(yaml);
Assert.Equal(2, s.Steps.Count);
Assert.Equal(StepKind.Wheel, s.Steps[0].Kind);
Assert.Equal(StepKind.Focus, s.Steps[1].Kind);
}
private static string LocateEngineSource([CallerFilePath] string here = "")
{
// here = .../tests/Recordingtest.Player.Tests/PlayerEngineTests.cs