fix(recording-dialog): +20% height so the file-name box is not clipped; unhook full-screen hook on shutdown

RenameRecordingDialog was 230px tall for ~225px of stacked content —
the file-name textbox clipped (old client area ~193px). Height is now 276
(+20%). Integration test shows the real dialog in the app host and asserts
the textbox bottom edge stays inside the client area; the dialog's Icon moved
to the explicit /ytLive;component/ URLC form MainWindow already uses so tests
can construct it (root-relative /Assets/... only resolves in production via
Application.ResourceAssembly).

Dependency fix: MainViewModel.Shutdown() now calls
_fullScreenDetector.StopWatching(). The global EVENT_SYSTEM_FOREGROUND hook
was never unhooked; after VM collection the next foreground event invoked a
garbage-collected WinEventProc delegate, crashing the whole test run. Harmless
in production (exits the process) but fatal in the multi-window test host.

Reference: WPF WinEvent hook lifecycle guidance — SetWinEventHook callbacks
must be unhooked before the owning object is collected (obs-projector
fullscreen-detection pattern).
This commit is contained in:
2026-09-18 08:33:13 -07:00
parent c11788574e
commit 0d0e55de31
4 changed files with 76 additions and 14 deletions
@@ -0,0 +1,49 @@
using System.Windows;
using Xunit;
namespace ytLive.Tests;
/// <summary>
/// The Rename Recording modal (creator-reported, 2026-09-18) cut off the file-name
/// textbox: the fixed window was too short for its stacked content. The height is
/// bumped 20% (230 → 276); this test renders the real dialog and asserts the textbox
/// bottom edge lands inside the client area instead of clipping.
/// </summary>
[Collection("RealApp")]
public sealed class RenameRecordingDialogSizingTests
{
private readonly RealAppHost _app;
public RenameRecordingDialogSizingTests(RealAppHost app) => _app = app;
[Fact]
public void DialogHeight_Bumps20Percent_AndNameBoxIsNotClipped()
{
_app.Run(Run);
}
private void Run()
{
var dialog = new RenameRecordingDialog("rec-2026-09-18");
try
{
Assert.Equal(276, dialog.Height);
dialog.Show();
dialog.UpdateLayout();
var box = dialog.NameBox;
Assert.True(box.ActualWidth > 0, "file-name textbox must have a real layout");
var client = (FrameworkElement)dialog.Content;
var bottom = box.TransformToAncestor(client)
.TransformBounds(new Rect(box.RenderSize)).Bottom;
Assert.True(bottom <= client.ActualHeight,
$"textbox bottom ({bottom:0.##}) must sit inside the client area " +
$"({client.ActualHeight:0.##}) — the dialog is clipping the name box");
}
finally
{
dialog.Close();
}
}
}