test(app): RTL and collapsed-rail captures; curve keyboard insertion tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
2 files changed
+70
-1
No files matched your search
@@ -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;
|
||||
/// <summary>
|
||||
/// <c>Titano.exe --capture <dir></c>: renders every client screen at 1440×900 in the dark and light themes to
|
||||
/// <c><screen>-<theme>.png</c> from <see cref="SampleData"/> (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 (<c>*-rtl-dark.png</c>, right to left), for visual review and phase reports
|
||||
/// (BRIEF §20.2), then exits.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
private static async Task<int> 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<int> SaveEditorAsync(Window window, EditorViewModel editor, string directory, string screen, AppTheme theme)
|
||||
{
|
||||
await Settle(window);
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user