- Source.IsBrandLogo persisted (additive migration); layer healed on load, removal blocked - Image stored as an asset; settings keep the asset id and file name - App Settings: Brand Logo file field with Browse - Default placement top-left; per-scene eye uses the existing element visibility Test: BrandLogoTests; layout/background tests pass (34). Not pushed.
59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
using System;
|
|
using System.Linq;
|
|
using Xunit;
|
|
using ytLive.Models;
|
|
using ytLive.Services;
|
|
using ytLive.ViewModels;
|
|
|
|
namespace ytLive.Tests;
|
|
|
|
/// <summary>
|
|
/// The brand logo is one locked image layer per scene, directly above the background.
|
|
/// </summary>
|
|
[Collection("RealApp")]
|
|
public sealed class BrandLogoTests
|
|
{
|
|
private readonly RealAppHost _app;
|
|
|
|
public BrandLogoTests(RealAppHost app) => _app = app;
|
|
|
|
[Fact]
|
|
public void Every_Scene_Gets_One_Brand_Logo_Directly_Above_The_Background()
|
|
{
|
|
_app.Run(Run);
|
|
}
|
|
|
|
private static void Run()
|
|
{
|
|
var tempDb = System.IO.Path.Combine(System.IO.Path.GetTempPath(), $"ytLlive-brand-{Guid.NewGuid():N}.db");
|
|
MainViewModel.LayoutPathOverride = tempDb;
|
|
try
|
|
{
|
|
using (var schema = new LayoutStore(tempDb)) { }
|
|
Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools();
|
|
|
|
var vm = new MainViewModel();
|
|
|
|
foreach (var scene in vm.Scenes)
|
|
{
|
|
var logos = scene.Elements.OfType<Source>().Where(s => s.IsBrandLogo).ToList();
|
|
Assert.Single(logos);
|
|
var index = scene.Elements.IndexOf(logos[0]);
|
|
var background = scene.Elements.OfType<Source>().First(s => s.IsBackground);
|
|
Assert.Equal(scene.Elements.IndexOf(background) + 1, index);
|
|
}
|
|
|
|
var staged = vm.StagedScene!;
|
|
var logo = staged.Elements.OfType<Source>().First(s => s.IsBrandLogo);
|
|
vm.RemoveElement(logo);
|
|
Assert.Contains(logo, staged.Elements);
|
|
}
|
|
finally
|
|
{
|
|
MainViewModel.LayoutPathOverride = null;
|
|
Microsoft.Data.Sqlite.SqliteConnection.ClearAllPools();
|
|
try { System.IO.File.Delete(tempDb); } catch { }
|
|
}
|
|
}
|
|
}
|