using System.Windows; using Xunit; namespace ytLive.Tests; /// /// The Rename Recording modal (the creator-reported dialog shown when a recording /// is ended, so it can be saved under a readable name) cut off its file-name textbox /// — and once the height was bumped 20% the Cancel/Save button row was revealed as /// previously obscured too. Height raised 230 → 304 (+20% then another +10%); this /// test renders the real dialog and asserts the textbox bottom edge AND the button /// row sit inside the client area instead of clipping. /// [Collection("RealApp")] public sealed class RenameRecordingDialogSizingTests { private readonly RealAppHost _app; public RenameRecordingDialogSizingTests(RealAppHost app) => _app = app; [Fact] public void DialogHeight_CoversTextboxAndButtonRow_WithoutClipping() { _app.Run(Run); } private void Run() { var dialog = new RenameRecordingDialog("rec-2026-09-18"); try { Assert.Equal(304, 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 boxBottom = box.TransformToAncestor(client) .TransformBounds(new Rect(box.RenderSize)).Bottom; Assert.True(boxBottom <= client.ActualHeight, $"textbox bottom ({boxBottom:0.##}) must sit inside the client area " + $"({client.ActualHeight:0.##}) — the dialog is clipping the name box"); var save = (FrameworkElement)client.FindName("SaveRecordingButton")!; var saveBottom = save.TransformToAncestor(client) .TransformBounds(new Rect(save.RenderSize)).Bottom; Assert.True(saveBottom <= client.ActualHeight, $"Save button bottom ({saveBottom:0.##}) must sit inside the client area " + $"({client.ActualHeight:0.##}) — the button row is obscured"); } finally { dialog.Close(); } } }