Files
recordingtest/tests/Recordingtest.Player.Tests/FakePlayerHost.cs
minsung 11eb92b2b2 feat: camera-restore + LauncherUI UX 개선 + player fallback 강화 (#15)
camera-restore:
- IEngineStateProvider.SetCamera 반사 쓰기 (HmegDirectStateProvider)
- POST /camera/restore (BridgeHttpServer, StateRouter)
- Recorder --sidecar-url + camera_snapshot 캡처
- UiaPlayerHost.TryRestoreCamera, PlayerEngine 재생 전 복원
- 149 tests

LauncherUI (#15):
- Sidecar URL 체크박스 + 입력란 (녹화/재생 모두 연동)
- 재생 속도 슬라이더 (0.25x~4.0x, 기본 1.0x)
- 빌드 타임스탬프 타이틀바 표시
- 녹화 완료 후 RecordNameBox 초기화
- UiAnalysisWindow 추가

PlayerEngine (#15):
- CancellationToken 지원 (중단 버튼 동작)
- Focus 스텝 early return (no-op, issue #11)
- Type/Drag unresolvable UIA path fallback
- SpeedMultiplier 옵션

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-13 18:37:13 +09:00

51 lines
2.1 KiB
C#

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));
public List<TimeSpan> Delays { get; } = new();
public void Delay(TimeSpan duration) => Delays.Add(duration);
// Camera restore tracking
public record CameraRestoreCall(double[] Eye, double[] Target, double[] Up, double Fov);
public List<CameraRestoreCall> CameraRestoreCalls { get; } = new();
public bool CameraRestoreResult { get; set; } = true;
public bool TryRestoreCamera(double[] eye, double[] target, double[] up, double fov)
{
CameraRestoreCalls.Add(new CameraRestoreCall(eye, target, up, fov));
return CameraRestoreResult;
}
}