The scoreboard is fed by the signed-in channel (chat events + channel stats), so offering its switches to a signed-out user is a dead control. The whole block now binds IsEnabled to IsConnected and shows one line — "Sign in to YouTube to use the scoreboard." — instead of looking broken. Nothing extra is needed to re-enable: IsConnected already raises on sign-in/out, so the block comes alive the moment the session lands. Guard: ScoreboardPropertiesTests asserts the IsEnabled binding, the signed-out hint and that the hint is gated by the inverse converter.
65 lines
3.1 KiB
C#
65 lines
3.1 KiB
C#
using System.Reflection;
|
|
using Xunit;
|
|
using ytLive.ViewModels;
|
|
|
|
namespace ytLive.Tests;
|
|
|
|
/// <summary>The scoreboard's look and its eight fact switches live in the LAYER PROPERTIES, and the
|
|
/// panel must use the app's widgets — a hand-painted control is the TASK 58/63 defect, and the
|
|
/// guard that catches it is here because the type-based sweep cannot see a bespoke picker.</summary>
|
|
public class ScoreboardPropertiesTests
|
|
{
|
|
[Fact]
|
|
public void The_scoreboard_properties_are_themed_controls_bound_to_the_layer_surface()
|
|
{
|
|
var panel = SourceAssert.Text("Controls", "LeftPanel.xaml");
|
|
|
|
// Gated on the selected layer being a scoreboard.
|
|
Assert.Contains("SelectedElement.IsScoreboard", panel);
|
|
|
|
// Signed out: the whole block is inert (the board is fed by the signed-in channel), with a
|
|
// one-line explanation. Signing in re-enables it through the ordinary IsConnected raise.
|
|
var block = panel[panel.IndexOf("Scoreboard config", System.StringComparison.Ordinal)..];
|
|
block = block[..block.IndexOf("<!-- Countdown config -->", System.StringComparison.Ordinal)];
|
|
Assert.Contains("IsEnabled=\"{Binding IsConnected}\"", block);
|
|
Assert.Contains("Sign in to YouTube to use the scoreboard.", block);
|
|
Assert.Contains("InverseBoolToVis", block);
|
|
|
|
// The master switch sits in the same panel: off hides the strip and stops the polling.
|
|
Assert.Contains("ScoreboardEnabled", panel);
|
|
|
|
// The eight fact switches.
|
|
foreach (var binding in new[]
|
|
{
|
|
"ScoreboardShowSubscribers", "ScoreboardShowWatchHours", "ScoreboardShowSuperChats",
|
|
"ScoreboardShowNewMembers", "ScoreboardShowMilestones", "ScoreboardShowLastMember",
|
|
"ScoreboardShowLastSuperChat", "ScoreboardShowLastGift",
|
|
})
|
|
Assert.Contains(binding, panel);
|
|
|
|
// Look controls: text colour, plate colour, plate opacity, text size.
|
|
foreach (var binding in new[]
|
|
{
|
|
"ScoreboardTextColor", "ScoreboardBackgroundColor",
|
|
"ScoreboardBackgroundOpacity", "ScoreboardFontSize",
|
|
})
|
|
Assert.Contains(binding, panel);
|
|
|
|
// Theme widgets only: the colour pickers are the app's drop-down (YtComboBox), never a
|
|
// hand-built menu, and the toggles are YtCheckBox.
|
|
Assert.Contains("Style=\"{StaticResource YtComboBox}\"", block);
|
|
Assert.Contains("Style=\"{StaticResource YtCheckBox}\"", block);
|
|
Assert.DoesNotContain("ContextMenu", block);
|
|
|
|
// The VM surface exists for every binding above (a typo would bind to nothing silently).
|
|
var type = typeof(MainViewModel);
|
|
foreach (var name in new[]
|
|
{
|
|
"ScoreboardTextColor", "ScoreboardBackgroundColor", "ScoreboardBackgroundOpacity",
|
|
"ScoreboardFontSize", "ScoreboardColorOptions", "ScoreboardShowSubscribers",
|
|
"ScoreboardEnabled",
|
|
})
|
|
Assert.NotNull(type.GetProperty(name));
|
|
}
|
|
}
|