feat(tools): screenshot diff against committed baselines, reproducible captures
BRIEF §20.2 asks for visual regression of the --capture screenshots with a pixel-diff tolerance; CI only published them. `Titano.Tools screenshots diff <dir>` compares every PNG with tests/visual/baselines: a pixel differs when a channel moves by more than --tolerance (8 of 255), and a screen fails when more than --max-diff of its pixels differ (0.05 %), when its size changed or when a baseline lost its screen; a screen without a baseline only warns. It writes a diff image per screen with differing pixels (the baseline faded, the differences magenta) and a Markdown summary, also to the GitHub job summary. `screenshots accept <dir>` copies screenshots over the baselines. The baselines folder starts with its README; the pictures come later from ci-screenshots. The captures were not reproducible: the sample's jobs, renders, transfers, cards, trash and remote sequences were dated from the clock, the Library timeline and the Archive heatmap laid out around today, the Uploader captured in the computer's language and an indeterminate bar animated. The sample now dates everything from SampleData.Now, --capture freezes the new AppClock there, formats are English, and the new Motion attached property (off in the captured windows) keeps the indeterminate sweep still in the middle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
15 files changed
+603
-39
No files matched your search
@@ -1,9 +1,11 @@
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Threading;
|
||||
using Titano.Core.Diagnostics;
|
||||
using Titano.Ui.Controls;
|
||||
using Titano.Ui.Theming;
|
||||
using Titano.Uploader.DesignTime;
|
||||
|
||||
@@ -11,8 +13,9 @@ namespace Titano.Uploader.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// <c>Titano.Uploader.exe --capture <dir></c>: renders the window at its default 760×700 — first run (connect),
|
||||
/// queue running, settings panel — from <see cref="SampleData"/> in the dark and light themes, then once more in
|
||||
/// Arabic (right to left, dark), and exits.
|
||||
/// queue running, settings panel — from <see cref="SampleData"/> in the dark and light themes, in English whatever the
|
||||
/// computer's language, then once more in Arabic (right to left, dark), and exits. Nothing animates, so the pictures
|
||||
/// compare with their baselines pixel for pixel.
|
||||
/// </summary>
|
||||
public static class ScreenCapture
|
||||
{
|
||||
@@ -20,7 +23,7 @@ public static class ScreenCapture
|
||||
private const double Height = 700;
|
||||
|
||||
/// <param name="directory">Where the PNG files go.</param>
|
||||
/// <param name="applyLanguage">Switches the UI language (a culture name; null = the OS language).</param>
|
||||
/// <param name="applyLanguage">Switches the UI language (a culture name).</param>
|
||||
public static void Run(string directory, Action<string?> applyLanguage)
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
@@ -28,7 +31,8 @@ public static class ScreenCapture
|
||||
{
|
||||
try
|
||||
{
|
||||
applyLanguage(null);
|
||||
CultureInfo.CurrentCulture = CultureInfo.DefaultThreadCurrentCulture = CultureInfo.GetCultureInfo("en");
|
||||
applyLanguage("en");
|
||||
CaptureScreens(directory, string.Empty, [AppTheme.Dark, AppTheme.Light]);
|
||||
// Mirrored layout with paths, addresses and file names kept left to right (BRIEF §16).
|
||||
applyLanguage("ar");
|
||||
@@ -62,6 +66,7 @@ public static class ScreenCapture
|
||||
ShowActivated = false,
|
||||
ShowInTaskbar = false,
|
||||
};
|
||||
Motion.SetIsEnabled(window, false);
|
||||
window.Show();
|
||||
try
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user