Unit 8. Re-houses the shipped TASK 22 offset in the dock:
- slider −200…+200 ms, snapping to 5 ms ticks (the existing property still clamps and persists)
- readable readout: "0 ms (aligned)" when right, signed otherwise ("+50 ms", "−120 ms")
- presets 0 / +50 / +100; 0 IS the detent — a button is easier to hit than a snap, and "the lip-sync
is right" deserves one click.
Guard: SyncBayTests pins the binding, the readout, the presets and the snapping, and that the
offset stays the persisted property (no second source of truth).
31 lines
1.3 KiB
C#
31 lines
1.3 KiB
C#
using Xunit;
|
|
using ytLive.ViewModels;
|
|
|
|
namespace ytLive.Tests;
|
|
|
|
/// <summary>The LIP-SYNC bay re-houses the offset that shipped as TASK 22, with the two things the
|
|
/// dock asks of it: a readable readout ("0 ms (aligned)") and 0 as a one-click detent. The offset
|
|
/// itself is clamped and persisted by the existing property — this pins the surface.
|
|
/// </summary>
|
|
public class SyncBayTests
|
|
{
|
|
[Fact]
|
|
public void The_lip_sync_bay_uses_the_persisted_offset_with_a_zero_detent()
|
|
{
|
|
var dock = SourceAssert.Text("Controls", "AudioDock.xaml");
|
|
Assert.Contains("Value=\"{Binding AudioSyncOffsetMs, Mode=TwoWay}\"", dock);
|
|
Assert.Contains("Text=\"{Binding SyncOffsetLabel}\"", dock);
|
|
Assert.Contains("Click=\"SyncPreset_Click\"", dock);
|
|
Assert.Contains("Tag=\"0\"", dock);
|
|
Assert.Contains("Minimum=\"-200\" Maximum=\"200\"", dock);
|
|
|
|
// The readout names the good state, and signs the others the way a person reads them.
|
|
Assert.Matches(@"IsSnapToTickEnabled=""True""", dock);
|
|
|
|
var type = typeof(MainViewModel);
|
|
Assert.NotNull(type.GetProperty("AudioSyncOffsetMs"));
|
|
Assert.NotNull(type.GetProperty("SyncOffsetLabel"));
|
|
Assert.NotNull(type.GetMethod("SetSyncOffset", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance));
|
|
}
|
|
}
|