Files
LlamaCasty/ytLive.Tests/TraxBayTests.cs
T
gramps f8e4f2cf29 ui(audio): master meter centred and biggest; TRAX gets its own bay and meter
Creator rulings, 2026-11-01.

- Master strip is 44px (from 36) and its meter is now the largest on screen: 420x14 with 32
  segments, centred under the preview, with a 12px MASTER label — bigger than the 9px bay
  labels. L/R imbalance is a flag on the left, MONO and the session clock on the right.
- The kbps / fps / dropped counters are gone from that line: the live readouts already sit
  above the preview, and the duplicate was noise rather than telemetry.
- TRAX is its own bay (MIC | GAME | TRAX | LIP-SYNC) with its own meter bound to
  TraxMeterFraction. It lived inside the game bay with no ladder, which meant whether the bed
  was actually playing could not be answered from the dock — and the player already measures
  its own output.
- Lip-sync is narrow (0.45 star) since it is one slider and three presets; the three sound bays
  are equal width, so their meters keep the same relative size.

AudioDockLayout moves with it (156 = 112 + 44; collapsed 44) and the layout test is updated.
TraxBayTests now asserts the opposite of the old ruling: the bay HAS a meter, and the game bay
no longer carries it.
2026-11-01 13:48:28 -08:00

58 lines
3.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Xunit;
using ytLive.Helpers;
using ytLive.Services.Audio;
using ytLive.ViewModels;
namespace ytLive.Tests;
/// <summary>The TRAX bay shows the track, plays/pauses it, and carries a level. It got its OWN bay
/// and its own meter on 2026-11-01 (creator ruling): the player measures its real output, so the
/// ladder is not decorative, and living inside the game bay hid whether the bed was playing.
/// Its fader moves a gain the player actually applies, separate from the desktop-mute follow.
/// </summary>
public class TraxBayTests
{
[Fact]
public void The_trax_bay_is_its_own_bay_with_a_real_meter()
{
var dock = SourceAssert.Text("Controls", "AudioDock.xaml");
Assert.Contains("Text=\"{Binding TraxTrackLabel}\"", dock);
// KISS (creator 2026-10-30): background music is one number and two ±5 dB buttons, not a
// channel strip — and it has no ladder of its own, because the desktop bed already carries it.
Assert.Contains("Click=\"TraxStepDown_Click\"", dock);
Assert.Contains("Click=\"TraxStepUp_Click\"", dock);
Assert.Contains("IsEnabled=\"{Binding CanLowerTrax}\"", dock);
Assert.Contains("IsEnabled=\"{Binding CanRaiseTrax}\"", dock);
Assert.Contains("Text=\"{Binding TraxVolumeDbLabel}\"", dock);
Assert.Contains("Binding=\"{Binding IsMusicPlaying}\" Value=\"True\"", dock);
Assert.Contains("Click=\"TraxPlayPause_Click\"", dock);
// TRAX is its own bay, between GAME and LIP-SYNC, and it carries a real ladder bound to the
// player's own level — "is the bed making sound" is not answerable from a play glyph.
var traxRow = dock[dock.IndexOf("<!-- TRAX: its own bay", System.StringComparison.Ordinal)
..dock.IndexOf("<!-- LIP-SYNC", System.StringComparison.Ordinal)];
Assert.Contains("TraxTrackLabel", traxRow);
Assert.Contains("SegmentMeter", traxRow);
Assert.Contains("Level=\"{Binding TraxMeterFraction}\"", traxRow);
// …and the GAME bay no longer embeds it.
var gameBay = dock[dock.IndexOf("<!-- GAME / PC", System.StringComparison.Ordinal)
..dock.IndexOf("<!-- TRAX: its own bay", System.StringComparison.Ordinal)];
Assert.DoesNotContain("TraxTrackLabel", gameBay);
foreach (var name in new[] { "TraxVolumeDb", "TraxVolumeDbLabel", "TraxTrackLabel", "CanRaiseTrax", "CanLowerTrax" })
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(ITraxPlayer).GetProperty("Level"));
Assert.NotNull(typeof(MusicPlayer).GetProperty("UserGain"));
// It starts as background: −50 dB, and the ±5 dB steps are how it moves.
Assert.Equal(-50, MainViewModel.TraxDefaultDb);
Assert.Equal(5, MainViewModel.TraxStepDb);
Assert.Equal(0, GainDb.ToDb(1f), 6);
Assert.Contains("∞", GainDb.Label(GainDb.FloorDb)); // true silence, not "-60.0"
}
}