Reported: the ticker was painting OVER the socials. The coupling rule existed and was tested (ScoreboardLayout.ResolveEdges) but nothing ever CALLED it — the strip's Y still came from its own preference, so both bars landed on the south edge. Now the resolution runs at publish time: the social bar keeps its side, the scoreboard takes the other one, and its Y follows from that edge. The pair re-sorts whenever the social bar moves (the preview click-toggle) or shows/hides, because the rule is "resolve from what is visible", not a stored pairing. The layer also gains an Edge preference (Top/Bottom) in its properties, labelled "socials take the other" — a preference, never a claim on an occupied edge. Also stabilised the opacity assertion: it samples a plate-only pixel 5px from the left edge instead of the first semi-transparent pixel it finds (which could be anti-aliased text).
51 lines
2.3 KiB
C#
51 lines
2.3 KiB
C#
using Xunit;
|
|
using ytLive.Models;
|
|
using ytLive.ViewModels;
|
|
|
|
namespace ytLive.Tests;
|
|
|
|
/// <summary>DEBUG-only affordance (creator 2026-10-30): push sample events so the strip is provable
|
|
/// in the PREVIEW before a real stream. The sample must travel the real recorder, so what it paints
|
|
/// is what live events paint — a fake renderer would prove nothing.</summary>
|
|
public class ScoreboardSimulationTests
|
|
{
|
|
[Fact]
|
|
public void The_dev_sample_feeds_the_real_recorder_and_the_toggle_is_debug_only()
|
|
{
|
|
// The sample goes through the recorder a stream uses, and lands all four tallies.
|
|
var recorder = new ScoreboardRecorder();
|
|
ScoreboardSample.Inject(recorder);
|
|
|
|
Assert.True(recorder.IsRunning);
|
|
var state = recorder.State;
|
|
Assert.Equal(4, state.NewMembers); // 1 paid + a gift of 3
|
|
Assert.Equal(3, state.LastGiftCount);
|
|
Assert.Equal("giftgiver", state.LastGifterName);
|
|
Assert.Equal(1, state.MilestoneCount);
|
|
Assert.Equal(12.34, state.SessionTotal.Total, 2);
|
|
Assert.Equal("$12.34", state.LastSuperChatDisplay);
|
|
|
|
// A toggle OFF clears back to an empty session (so the empty state is visible too).
|
|
recorder.StartSession();
|
|
Assert.Equal(0, recorder.State.NewMembers);
|
|
|
|
// Simulate OVERRIDES the master "show" switch: the dev toggle must work even when the
|
|
// product setting is off.
|
|
var vmSource = SourceAssert.Text("ViewModels", "MainViewModel.Scoreboard.cs");
|
|
Assert.Contains("_scoreboardEnabled || _scoreboardSimulate", vmSource);
|
|
|
|
// The control exists and is gated on the build, not on a runtime flag.
|
|
var panel = SourceAssert.Text("Controls", "LeftPanel.xaml");
|
|
Assert.Contains("ScoreboardSimulate", panel);
|
|
Assert.Contains("IsDevelopmentBuild", panel);
|
|
|
|
var type = typeof(MainViewModel);
|
|
Assert.NotNull(type.GetProperty("ScoreboardSimulate"));
|
|
Assert.NotNull(type.GetProperty("IsDevelopmentBuild"));
|
|
// DEBUG-gated at compile time, so a Release build has no dev control at all.
|
|
Assert.Contains("#if DEBUG", vmSource);
|
|
Assert.Contains("private const bool DevelopmentBuild = true;", vmSource);
|
|
Assert.Contains("private const bool DevelopmentBuild = false;", vmSource);
|
|
}
|
|
}
|