Files
LlamaCasty/ytLive.Tests/ScoreboardLayerTests.cs
T
gramps 8caee21b9a fix(scoreboard): the strip finally reaches the preview, and dev labels are orange
"Clicking on everything produces no visible effect" — the cause was upstream of the controls, and it
is the same defect as the invisible alert box (TASK 47):

- `Source.DisplaySource` returned `VideoImageSource` only for ChatBox / WebSource / MediaSource /
  AlertBox. The scoreboard's frame was rendered and published, then never displayed.
- the preview's Image has a per-type Visibility trigger for each of those and none for IsScoreboard,
  so even a correct DisplaySource would have stayed collapsed.

Both are fixed, and the layer test now pins the frame-source list AND the trigger so the pair cannot
drift apart again.

Dev-only affordances are ORANGE from now on (creator ruling): "Simulate (dev)" is a TextBlock in
Brush.Attention, so a development control can never be mistaken for product. The panel test pins the
colour.
2026-10-30 15:05:33 -07:00

39 lines
1.8 KiB
C#

using System.Linq;
using Xunit;
using ytLive.Models;
using ytLive.ViewModels;
namespace ytLive.Tests;
/// <summary>The scoreboard is a LAYER, not a special widget: it must appear as a source type, carry
/// the full-width strip geometry, be resolvable on the output path like a chat box, and hook the
/// session lifecycle so its numbers are session-scoped.</summary>
public class ScoreboardLayerTests
{
[Fact]
public void The_scoreboard_is_a_real_source_with_strip_geometry_and_a_resolver()
{
Assert.Contains("Scoreboard", System.Enum.GetNames<SourceType>());
// Geometry: full width, a strip's height, bottom by default.
var sources = SourceAssert.Text("ViewModels", "MainViewModel.Sources.cs");
Assert.Contains("SourceType.Scoreboard ? 1920", sources);
Assert.Contains("SourceType.Scoreboard ? 56", sources);
Assert.Contains("SourceType.Scoreboard ? 1024", sources);
// The output resolver knows how to produce its frame (same shape as the chat box/alert box).
var resolver = SourceAssert.Text("ViewModels", "MainViewModel.cs");
Assert.Contains("Source { Type: SourceType.Scoreboard } => _scoreboardPresenter?.Frame", resolver);
// The PREVIEW must show the strip: its frame is a runtime frame-source and its Image needs
// the visibility trigger. Missing either made every property change look inert (2026-10-30).
var source = SourceAssert.Text("Models", "Source.cs");
Assert.Contains("or SourceType.AlertBox or SourceType.Scoreboard", source);
Assert.Contains("IsScoreboard", SourceAssert.Text("Controls", "PreviewPane.xaml"));
// Session lifecycle: every start clears the tallies.
var ops = SourceAssert.Text("ViewModels", "MainViewModel.Streaming.Operations.cs");
Assert.Contains("StartScoreboardSession();", ops);
}
}