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>
68 lines
2.3 KiB
C#
68 lines
2.3 KiB
C#
using System.Net;
|
|
using Recordingtest.Bridge;
|
|
using Recordingtest.Sut.EgBim.PluginHost;
|
|
using Xunit;
|
|
|
|
namespace Recordingtest.Sut.EgBim.PluginHost.Tests;
|
|
|
|
public class StateRouterTests
|
|
{
|
|
private sealed class FixedProvider : IEngineStateProvider
|
|
{
|
|
public IReadOnlyList<string> GetSelectedIds() => new[] { "x", "y" };
|
|
public CameraSnapshot GetCamera() => new(new double[] { 1, 2, 3 }, new double[] { 0, 0, 0 }, new double[] { 0, 0, 1 }, 45);
|
|
public SceneSnapshot GetScene() => new(7, "doc.hmeg");
|
|
public bool GetRenderComplete() => true;
|
|
public void SetCamera(CameraSnapshot snapshot) { /* no-op in tests */ }
|
|
}
|
|
|
|
private sealed class FaultyProvider : IEngineStateProvider
|
|
{
|
|
public IReadOnlyList<string> GetSelectedIds() => throw new InvalidOperationException("boom");
|
|
public CameraSnapshot GetCamera() => throw new InvalidOperationException();
|
|
public SceneSnapshot GetScene() => throw new InvalidOperationException();
|
|
public bool GetRenderComplete() => throw new InvalidOperationException();
|
|
public void SetCamera(CameraSnapshot snapshot) => throw new InvalidOperationException();
|
|
}
|
|
|
|
[Fact]
|
|
public void StateRouter_SelectionPath_UsesProvider_ReturnsJson()
|
|
{
|
|
var r = new StateRouter(new FixedProvider(), 38080);
|
|
var (status, body) = r.Route("/selection");
|
|
Assert.Equal(HttpStatusCode.OK, status);
|
|
Assert.Contains("\"selected_ids\":[\"x\",\"y\"]", body);
|
|
}
|
|
|
|
[Fact]
|
|
public void StateRouter_FaultyProvider_ReturnsErrorPayload()
|
|
{
|
|
var r = new StateRouter(new FaultyProvider(), 38080);
|
|
var (_, body) = r.Route("/selection");
|
|
Assert.Contains("\"error\"", body);
|
|
Assert.Contains("boom", body);
|
|
}
|
|
|
|
[Fact]
|
|
public void StateRouter_UnknownPath_Returns404()
|
|
{
|
|
var r = new StateRouter(new FixedProvider(), 38080);
|
|
var (status, _) = r.Route("/nope");
|
|
Assert.Equal(HttpStatusCode.NotFound, status);
|
|
}
|
|
|
|
[Fact]
|
|
public void PortResolver_EnvVarSet_ReturnsEnvPort()
|
|
{
|
|
var p = PortResolver.Resolve(_ => "45000");
|
|
Assert.Equal(45000, p);
|
|
}
|
|
|
|
[Fact]
|
|
public void PortResolver_EnvVarMissing_ReturnsDefault()
|
|
{
|
|
var p = PortResolver.Resolve(_ => null);
|
|
Assert.Equal(PortResolver.DefaultPort, p);
|
|
}
|
|
}
|