Implement player PoC (#7)

This commit is contained in:
minsung
2026-04-07 14:28:11 +09:00
parent d486cbb4d9
commit f17e764678
12 changed files with 727 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
namespace Recordingtest.Player.Tests;
internal sealed class FakePlayerHost : IPlayerHost
{
public Func<string, ResolvedElement?> ResolveImpl { get; set; } =
_ => new ResolvedElement(new ElementBounds(100, 200, 50, 40), null);
public Func<string, bool> WaitForImpl { get; set; } = _ => true;
public List<ScreenPoint> Clicks { get; } = new();
public List<string> Types { get; } = new();
public List<(ScreenPoint From, ScreenPoint To)> Drags { get; } = new();
public List<string> Hotkeys { get; } = new();
public List<(int AfterStep, string SaveAs)> Checkpoints { get; } = new();
public List<(int StepIndex, string Reason)> Failures { get; } = new();
public List<string> Resolved { get; } = new();
public List<string> WaitedFor { get; } = new();
public ResolvedElement? ResolveElement(string uiaPath, TimeSpan timeout)
{
Resolved.Add(uiaPath);
return ResolveImpl(uiaPath);
}
public bool WaitFor(string waitForHint, TimeSpan timeout)
{
WaitedFor.Add(waitForHint);
return WaitForImpl(waitForHint);
}
public void Click(ScreenPoint point) => Clicks.Add(point);
public void Type(string text) => Types.Add(text);
public void Drag(ScreenPoint from, ScreenPoint to) => Drags.Add((from, to));
public void Hotkey(string keys) => Hotkeys.Add(keys);
public void CaptureCheckpoint(int afterStep, string saveAs) =>
Checkpoints.Add((afterStep, saveAs));
public void CaptureFailureArtifacts(int stepIndex, string reason) =>
Failures.Add((stepIndex, reason));
}