Files
LlamaCasty/ytLive.Tests/SceneCatalogTests.cs
T
gramps 4b9a8e515f Control Surface UX: pill toggle, background rename, per-scene properties
- Sliding pill toggle (green ON / red OFF) replaces checkbox
- Geometry mismatch error for custom backgrounds
- Backdrop -> Background: C# rename, SQL column rename with migration
- Source.IsBackground: new -> override (fixes WPF binding)
- Legacy 'Backdrop' display name migrated to 'Background'
- Per-scene UseDefaultBackground + CustomBackgroundPath
- Asset files renamed backdrop -> background
- StagedScene/LiveScene split, thumbnail strip, edit gating
- TransitionService (Cut/Fade/Move)
- Context menu: Capture Desktop, Refresh Desktop
- Resolution badge removed, ON-AIR status light added
2026-08-22 18:10:59 -07:00

78 lines
2.6 KiB
C#

using Xunit;
using ytLive.Models;
using ytLive.ViewModels;
namespace ytLive.Tests;
/// <summary>
/// The app is a five-scene product: Starting/Live/BRB/Chat/Ending. Scenes are
/// worked on by name; you can delete them but never add beyond the set, and the
/// live background belongs to Live alone.
/// </summary>
public class SceneCatalogTests
{
[Fact]
public void SceneCatalog_Defines_The_Five_Canonical_Scenes()
{
Assert.Equal(
new[] { "Starting", "Live", "BRB", "Chat", "Ending" },
SceneCatalog.All);
}
[Theory]
[InlineData("Starting", true)]
[InlineData("Live", true)]
[InlineData("BRB", true)]
[InlineData("Chat", true)]
[InlineData("Ending", true)]
[InlineData("live", true)]
[InlineData("My Scene", false)]
[InlineData("", false)]
[InlineData(null, false)]
public void SceneCatalog_IsCanonical_Matches_By_Name(string? name, bool expected)
{
Assert.Equal(expected, SceneCatalog.IsCanonical(name));
}
[Theory]
[InlineData("Starting", false)]
[InlineData("Live", true)]
[InlineData("BRB", false)]
[InlineData("Chat", false)]
[InlineData("Ending", false)]
public void SceneCatalog_HasBackground_Only_For_Live(string name, bool expected)
{
Assert.Equal(expected, SceneCatalog.HasBackground(name));
}
[Fact]
public void EnforceBackgroundPolicy_Removes_Background_From_NonLive_Scenes()
{
var chat = new Scene { Name = "Chat", HasBackground = true };
var live = new Scene { Name = "Live", HasBackground = true };
var chatBackground = MainViewModel.EnsureBackground(chat)!;
var liveBackground = MainViewModel.EnsureBackground(live)!;
Assert.Contains(chat.Elements, e => ReferenceEquals(e, chatBackground));
MainViewModel.EnforceBackgroundPolicy(new[] { chat, live });
Assert.False(chat.HasBackground);
Assert.DoesNotContain(chat.Elements, e => e is Source { IsBackground: true });
Assert.True(live.HasBackground);
Assert.Contains(live.Elements, e => ReferenceEquals(e, liveBackground));
}
[Fact]
public void EnforceBackgroundPolicy_Marks_Live_And_Clears_A_Pre_Policy_Database()
{
var starting = new Scene { Name = "Starting", HasBackground = true };
MainViewModel.EnsureBackground(starting);
var live = new Scene { Name = "Live", HasBackground = false };
MainViewModel.EnforceBackgroundPolicy(new[] { starting, live });
Assert.False(starting.HasBackground);
Assert.True(live.HasBackground);
}
}