using Xunit; using ytLive.Helpers; using ytLive.Services.Audio; using ytLive.ViewModels; namespace ytLive.Tests; /// The TRAX bay shows the track, plays/pauses it, and carries a level — but no meter: /// nothing measures the bed, and a decorative ladder would be a lie. Its fader moves a gain the /// player actually applies, separate from the desktop-mute follow. /// public class TraxBayTests { [Fact] public void The_trax_bay_binds_the_track_level_and_play_state_without_inventing_a_meter() { var dock = SourceAssert.Text("Controls", "AudioDock.xaml"); Assert.Contains("Text=\"{Binding TraxTrackLabel}\"", dock); Assert.Contains("Value=\"{Binding TraxVolumeDb, Mode=TwoWay}\"", dock); Assert.Contains("Text=\"{Binding TraxVolumeDbLabel}\"", dock); Assert.Contains("Binding=\"{Binding IsMusicPlaying}\" Value=\"True\"", dock); Assert.Contains("Click=\"TraxPlayPause_Click\"", dock); // No ladder in the TRAX bay: nothing measures the bed, so there is nothing honest to show. var traxBay = dock[dock.IndexOf("Text=\"TRAX\"", System.StringComparison.Ordinal) ..dock.IndexOf("Text=\"LIP-SYNC\"", System.StringComparison.Ordinal)]; Assert.Contains("TraxTrackLabel", traxBay); Assert.DoesNotContain("SegmentMeter", traxBay); foreach (var name in new[] { "TraxVolumeDb", "TraxVolumeDbLabel", "TraxTrackLabel", "IsTraxDucking" }) Assert.NotNull(typeof(MainViewModel).GetProperty(name)); // The player gained a real user level, separate from the mute-follow LocalGain. Assert.NotNull(typeof(ITraxPlayer).GetProperty("UserGain")); Assert.NotNull(typeof(MusicPlayer).GetProperty("UserGain")); // Unity means the bed's design level, and the fader's scale is the same one as the others. Assert.Equal(0, GainDb.ToDb(1f), 6); Assert.Contains("∞", GainDb.Label(GainDb.FloorDb)); // true silence, not "-60.0" } }