Files
LlamaCasty/ytLive.Tests/BrandLogoPreviewTests.cs
T
gramps a35ec0c5f8 refactor(settings): a pull-out drawer, with Zoom as a category — and the menu moves to the wordmark
Creator directive, 2026-11-01. Settings stopped being a centred modal.

- **Drawer** (Controls/SettingsDrawer): hosted in PreviewPane's pull-out stack, 320px, the same
  animated-width pattern as Stream Settings / YPP / Socials / TEST, opened by the gear rail tab
  on a single left click. SettingsDrawerOpen is exclusive with the other four, both directions.
  This also removes the modal's MaxHeight-700 scroll problem for good: the drawer is the height
  of the preview.
- **Categories**: headings with controls indented beneath them. Zoom now owns *Zoom view shape*
  (Circle / Phone / Tablet) and *Zoom box follows*; Recordings, Brand logo and Scene transition
  are their own categories.
- **The app menu moved to the LlamaCasty wordmark** (right-click → Report Bug / Feature Request /
  About). Left-click still opens About. The gear tab no longer carries a menu at all, so clicking
  it does exactly one thing.

OverlayHost keeps only the Bug / Feature / About panels; its brand-logo handlers and the dev-panel
injection moved with the settings block. BrandLogoPreviewTests follows the control (same assertions,
new path). Release 0 warnings; 15 tests pass across brand logo, zoom, entitlement and preview
history.
2026-11-01 09:16:27 -08:00

61 lines
2.7 KiB
C#

using Xunit;
namespace ytLive.Tests;
/// <summary>The creator (2026-10-30): in App Settings the brand-logo field is only a file NAME,
/// which says nothing about the picture, so "myopic users like myself" cannot confirm what is
/// set. The field now carries a thumbnail — hover enlarges it, a click collapses it.
///
/// <para>The ONE test covers both halves: the XAML wiring that routes hover/leave/click, and the
/// control's own open/close behaviour (a Popup is a separate window, so only this seam can
/// observe it). Runs inside the real App because the control resolves theme resources at load.</para></summary>
[Collection("RealApp")]
public class BrandLogoPreviewTests
{
private readonly RealAppHost _app;
public BrandLogoPreviewTests(RealAppHost app) => _app = app;
[Fact]
public void Hovering_the_thumbnail_opens_the_enlarged_preview_and_a_click_collapses_it()
{
// 1. Wiring: the thumbnail is image-bound and hidden when no image is set, the enlarged
// popup shows the same source at a readable size, and every gesture reaches a handler.
var xaml = SourceAssert.Text("Controls", "SettingsDrawer.xaml");
Assert.Contains("x:Name=\"BrandLogoThumbImage\"", xaml);
Assert.Contains("{Binding BrandLogoPreviewImage}", xaml);
Assert.Contains("NotNullToVis", xaml);
Assert.Contains("x:Name=\"BrandLogoPreviewPopup\"", xaml);
Assert.Contains("MaxWidth=\"420\"", xaml);
foreach (var handler in new[]
{
"MouseEnter=\"BrandLogoThumb_MouseEnter\"",
"MouseLeave=\"BrandLogoThumb_MouseLeave\"",
"MouseLeftButtonUp=\"BrandLogoThumb_Click\"",
"MouseLeave=\"BrandLogoPreviewPopup_MouseLeave\"",
})
Assert.Contains(handler, xaml);
// 2. Behaviour on the real control.
_app.Run(() =>
{
// A Popup refuses to open until its placement target is in a live visual tree, so the
// control is hosted in a real window — the same condition the app provides.
var host = new ytLive.Controls.SettingsDrawer();
var window = new System.Windows.Window { Content = host, Width = 420, Height = 420 };
window.Show();
try
{
Assert.False(host.IsBrandLogoPreviewOpen);
host.OpenBrandLogoPreview();
Assert.True(host.IsBrandLogoPreviewOpen, "hovering the thumbnail must open the enlargement");
host.CloseBrandLogoPreview();
Assert.False(host.IsBrandLogoPreviewOpen, "a click must collapse it again");
}
finally { window.Close(); }
});
}
}