From e371b542a349c4423d51390bc87ab4f61626687a Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 6 Oct 2026 07:49:19 +0000 Subject: [PATCH] test(app): RTL and collapsed-rail captures; curve keyboard insertion tests Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC --- src/Titano.App/Shell/ScreenCapture.cs | 45 ++++++++++++++++++- .../Visuals/CurveMathTests.cs | 26 +++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/src/Titano.App/Shell/ScreenCapture.cs b/src/Titano.App/Shell/ScreenCapture.cs index 60073f16..614afbf3 100644 --- a/src/Titano.App/Shell/ScreenCapture.cs +++ b/src/Titano.App/Shell/ScreenCapture.cs @@ -7,6 +7,7 @@ using Titano.App.Archiving; using Titano.App.DesignTime; using Titano.App.Editor; using Titano.App.Import; +using Titano.App.Infrastructure; using Titano.App.Server; using Titano.App.Settings; using Titano.Core.Diagnostics; @@ -17,7 +18,9 @@ namespace Titano.App.Shell; /// /// Titano.exe --capture <dir>: renders every client screen at 1440×900 in the dark and light themes to /// <screen>-<theme>.png from (first run on an empty index, then a populated -/// one, then the sync table with transfers, a conflict and its confirmation), for visual review and phase reports (BRIEF §20.2), then exits. +/// one, then the sync table with transfers, a conflict and its confirmation), plus the Library, the editor's Exposure +/// tab and the import plan in Arabic (*-rtl-dark.png, right to left), for visual review and phase reports +/// (BRIEF §20.2), then exits. /// public static class ScreenCapture { @@ -79,6 +82,9 @@ public static class ScreenCapture written += await SaveAsync(window, directory, "library-list", theme, waitForThumbnails: shell); shell.Library.LayoutIndex = 0; shell.Library.ClearSelectionCommand.Execute(null); + shell.IsRailCollapsed = true; + written += await SaveAsync(window, directory, "library-rail-collapsed", theme, waitForThumbnails: shell); + shell.IsRailCollapsed = false; shell.Navigate(SectionKey.Jobs); if (shell.Jobs.Rows.Count > 0) shell.Jobs.Rows[0].IsExpanded = true; @@ -213,6 +219,8 @@ public static class ScreenCapture foreach (var toast in window.Toasts.Toasts.ToList()) window.Toasts.Dismiss(toast); } + written += await CaptureRightToLeftAsync(window, shell, editor, directory); + // Last, as it stays: an analysis of the sequence running (settings disabled, viewing tools live). await sample.MarkAnalysingAsync(id); await editor.AttachJobsAsync(); @@ -224,6 +232,41 @@ public static class ScreenCapture return written; } + /// + /// The Library, the editor's Exposure tab and the import plan in Arabic, dark: the layout mirrors while photos, + /// charts, the filmstrip and templates stay left to right. English is restored whatever happens. + /// + private static async Task CaptureRightToLeftAsync(MainWindow window, ShellViewModel shell, EditorViewModel editor, string directory) + { + var written = 0; + var frame = editor.CurrentIndex; + ThemeManager.Apply(AppTheme.Dark); + UiLanguage.Apply("ar"); + try + { + DismissToasts(window); + shell.Navigate(SectionKey.Library); + written += await SaveAsync(window, directory, "library-rtl", AppTheme.Dark, waitForThumbnails: shell); + + shell.Navigate(SectionKey.Sequence); + editor.SelectedTab = editor.Exposure; + editor.IsCompare = true; + editor.CurrentIndex = 45; + written += await SaveEditorAsync(window, editor, directory, "sequence-exposure-rtl", AppTheme.Dark); + + await ImportScenes.ShowAsync(shell, "plan"); + DismissToasts(window); + written += await SaveAsync(window, directory, "import-plan-rtl", AppTheme.Dark); + } + finally + { + UiLanguage.Apply("en"); + } + shell.Navigate(SectionKey.Sequence); + editor.CurrentIndex = frame; + return written; + } + private static async Task SaveEditorAsync(Window window, EditorViewModel editor, string directory, string screen, AppTheme theme) { await Settle(window); diff --git a/tests/Titano.App.Tests/Visuals/CurveMathTests.cs b/tests/Titano.App.Tests/Visuals/CurveMathTests.cs index ee5b9abf..74d7ebf7 100644 --- a/tests/Titano.App.Tests/Visuals/CurveMathTests.cs +++ b/tests/Titano.App.Tests/Visuals/CurveMathTests.cs @@ -73,6 +73,32 @@ public sealed class CurveMathTests Assert.False(CurveMath.CanRemove(3, 2, pinEnds: true)); } + [Test] + public void KeyboardInsertionUsesThePlayheadWhenAPointFitsThere() + { + double[] xs = [0, 0.4, 1]; + Assert.Approximately(0.7, CurveMath.KeyboardInsertionX(xs, 1, 0.7, Gap, pinEnds: true), 0); + // On a point, past a pinned end or unset: the middle of the gap after the selection (before it for the last point). + Assert.Approximately(0.7, CurveMath.KeyboardInsertionX(xs, 1, 0.4, Gap, pinEnds: true), 1e-12); + Assert.Approximately(0.2, CurveMath.KeyboardInsertionX(xs, 0, double.NaN, Gap, pinEnds: true), 1e-12); + Assert.Approximately(0.7, CurveMath.KeyboardInsertionX(xs, 2, double.NaN, Gap, pinEnds: true), 1e-12); + Assert.Approximately(0.2, CurveMath.KeyboardInsertionX(xs, -1, double.NaN, Gap, pinEnds: true), 1e-12); + Assert.Approximately(0.5, CurveMath.KeyboardInsertionX([], -1, double.NaN, Gap, pinEnds: false), 0); + Assert.Approximately(0.6, CurveMath.KeyboardInsertionX([0.2], 0, double.NaN, Gap, pinEnds: false), 1e-12); + } + + [Test] + public void InterpolationFollowsTheSegmentsAndIsFlatBeyondTheEnds() + { + double[] xs = [0.2, 0.6, 1]; + double[] ys = [0.1, 0.5, 0.3]; + Assert.Approximately(0.3, CurveMath.Interpolate(xs, ys, 0.4), 1e-12); + Assert.Approximately(0.4, CurveMath.Interpolate(xs, ys, 0.8), 1e-12); + Assert.Approximately(0.1, CurveMath.Interpolate(xs, ys, 0), 0); + Assert.Approximately(0.3, CurveMath.Interpolate(xs, ys, 1), 0); + Assert.Approximately(0.25, CurveMath.Interpolate([], [], 0.25), 0); + } + [Test] public void HitTestPicksTheNearestPointWithinRadius() {