diff --git a/tests/Titano.App.Tests/Import/ImportScreenSmokeTests.cs b/tests/Titano.App.Tests/Import/ImportScreenSmokeTests.cs index aa5ae1fc..55835471 100644 --- a/tests/Titano.App.Tests/Import/ImportScreenSmokeTests.cs +++ b/tests/Titano.App.Tests/Import/ImportScreenSmokeTests.cs @@ -71,7 +71,7 @@ public sealed class ImportScreenSmokeTests Assert.True(Fits(TextFor(app, file.SourceText)), "a file's name on the card is shown whole"); Assert.True(Fits(TextFor(app, file.DestinationText)), "a file's new name is shown whole"); Assert.True(Fits(TextFor(app, import.Details.Rows[0].SourceText)), "a session heading is shown whole"); - Assert.Within(Left(app, TextFor(app, Loc.L("Import.Details.Column.Action"))), 0, Left(app, TextFor(app, file.ActionText)), 0, 1, + Assert.Within(Left(app, TextFor(app, Loc.L("Import.Details.Column.Action"))), 0, Left(app, TextFor(app, file.ActionText)), 0, 2, "the Action header lines up with its cells"); AssertEveryButtonIsNamed(app); @@ -139,7 +139,7 @@ public sealed class ImportScreenSmokeTests var import = app.Shell.Import; await ShowAsync(app, "plan"); Assert.Equal(ImportPhase.Ready, import.Phase); - Assert.Equal(FlowDirection.RightToLeft, Window.GetWindow(View(app))!.FlowDirection); + Assert.Equal(FlowDirection.RightToLeft, WindowOf(app).FlowDirection); Assert.Equal(FlowDirection.LeftToRight, Named(app, "FolderPathBox").FlowDirection); Assert.Equal(FlowDirection.LeftToRight, Named(app, "GapBox").FlowDirection); foreach (var template in app.FindAll().Where(t => EditBehavior.GetField(t) is { } f && (f == import.FolderTemplate || f == import.FileTemplate))) @@ -183,7 +183,7 @@ public sealed class ImportScreenSmokeTests /// The size CI captures at (and the window's minimum width): nothing may be cut there. private static async Task UseCaptureSizeAsync(ScreenSmokeTests.SampleApp app) { - var window = Window.GetWindow(View(app))!; + var window = WindowOf(app); window.Width = 1200; window.Height = 788; await SettleAsync(app); @@ -191,7 +191,7 @@ public sealed class ImportScreenSmokeTests private static async Task SettleAsync(ScreenSmokeTests.SampleApp app) { - var window = Window.GetWindow(View(app))!; + var window = WindowOf(app); window.UpdateLayout(); await window.Dispatcher.InvokeAsync(() => { }, System.Windows.Threading.DispatcherPriority.ApplicationIdle); window.UpdateLayout(); @@ -241,6 +241,8 @@ public sealed class ImportScreenSmokeTests } } + private static Window WindowOf(ScreenSmokeTests.SampleApp app) => Window.GetWindow(app.FindAll().First())!; + private static ImportView View(ScreenSmokeTests.SampleApp app) => app.FindAll().First(v => v.IsVisible); private static bool IsInImport(DependencyObject element) => FindAncestor(element) is not null; @@ -283,7 +285,7 @@ public sealed class ImportScreenSmokeTests VisualTreeHelper.GetDpi(text).PixelsPerDip); if (text.TextWrapping != TextWrapping.NoWrap) { - formatted.MaxTextWidth = System.Math.Max(1, text.ActualWidth - text.Padding.Left - text.Padding.Right); + formatted.MaxTextWidth = System.Math.Max(1, text.ActualWidth - text.Padding.Left - text.Padding.Right + 1); return formatted.Height <= text.ActualHeight + 0.5; } return formatted.WidthIncludingTrailingWhitespace <= text.ActualWidth - text.Padding.Left - text.Padding.Right + 1;