feat: owner review 2 phase 4b: mass conversion after import (#13)
CI / Build and test (push) Failing after 3m1s
CI / PostgreSQL 16 integration (push) Skipped
CI / PostgreSQL 17 integration (push) Skipped
CI / Docker image (push) Skipped
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 10s
Release / Build, test and publish (push) Successful in 15m31s
Release / Server image (push) Successful in 1m13s
CI / Build and test (push) Failing after 3m1s
CI / PostgreSQL 16 integration (push) Skipped
CI / PostgreSQL 17 integration (push) Skipped
CI / Docker image (push) Skipped
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 10s
Release / Build, test and publish (push) Successful in 15m31s
Release / Server image (push) Successful in 1m13s
Convert photos already in the archive to JPEG, TIFF-16 or Linear DNG, from the panel's Library and the desktop's Archive and Library. Each run asks Replace (same frames, originals to the trash, recoverable) or New sequence. A dry run lists what converts, what is skipped and why, size before and after, and free space; the job converts exactly the confirmed photos, resumes, and commits all or nothing per sequence. A conversion never changes what Chronos reads from a photo. Replaced originals are erased only on the archive's own word that their conversion is gone. Desktop TIFFs that WIC showed black or as noise now go to the managed reader; the Edit picker no longer spins a core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #13.
This commit is contained in:
1 parent
7e4a3b481d
commit
efa87f68ce
354 files changed
+24530
-843
No files matched your search
@@ -0,0 +1,87 @@
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Chronos.App.Archiving;
|
||||
using Chronos.App.Shell;
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Data.Archiving;
|
||||
using Chronos.Testing;
|
||||
|
||||
namespace Chronos.App.Tests.Windows;
|
||||
|
||||
/// <summary>
|
||||
/// The confirmation dialog's detail (BRIEF §12.1): one longer than its card (an emptying of the trash that names every entry
|
||||
/// that may hold the last copy of its photos) scrolls, and since it holds no control the focus could move to, the keyboard
|
||||
/// reaches it and scrolls it; one that fits is no tab stop.
|
||||
/// </summary>
|
||||
[WindowsOnly]
|
||||
[Serial]
|
||||
[Timeout(120_000)]
|
||||
public sealed class ConfirmDialogTests
|
||||
{
|
||||
[Test]
|
||||
public Task ALongDetailTakesTheKeyboardAndScrolls() => ScreenHost.RunAsync(() =>
|
||||
{
|
||||
Loc.SetCulture(CultureInfo.GetCultureInfo("en"));
|
||||
var flagged = Enumerable.Range(1, 40).Select(i => Entry($"Converted {i}") with { ConversionDeleted = true }).ToList();
|
||||
var dialog = Open(Plan(flagged));
|
||||
try
|
||||
{
|
||||
var detail = (ScrollViewer)dialog.FindName("DetailScroll");
|
||||
Assert.True(detail.ScrollableHeight > 0, "the detail is longer than its card");
|
||||
Assert.True(detail.Focusable && detail.IsTabStop, "Tab reaches it");
|
||||
Assert.Equal(Loc.L("Tooltips.Archive.TrashEmptyPlan"), detail.ToolTip);
|
||||
Assert.Equal(Loc.L("Tooltips.Archive.TrashEmptyPlan"), System.Windows.Automation.AutomationProperties.GetName(detail));
|
||||
|
||||
Press(detail, Key.PageDown);
|
||||
dialog.UpdateLayout();
|
||||
var paged = detail.VerticalOffset;
|
||||
Assert.True(paged > 0, "Page Down scrolls it");
|
||||
Press(detail, Key.Down);
|
||||
dialog.UpdateLayout();
|
||||
Assert.True(detail.VerticalOffset > paged, "and so does the arrow");
|
||||
}
|
||||
finally
|
||||
{
|
||||
dialog.Close();
|
||||
}
|
||||
|
||||
var fits = Open(Plan([Entry("Etna")]));
|
||||
try
|
||||
{
|
||||
var detail = (ScrollViewer)fits.FindName("DetailScroll");
|
||||
Assert.Equal(0d, detail.ScrollableHeight);
|
||||
Assert.False(detail.Focusable || detail.IsTabStop, "a detail that fits is no stop");
|
||||
}
|
||||
finally
|
||||
{
|
||||
fits.Close();
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
});
|
||||
|
||||
private static TrashEntry Entry(string title) =>
|
||||
new(Guid.CreateVersion7(), FrameTrash.EntryPrefix + Guid.CreateVersion7().ToString("N"), Guid.CreateVersion7(), title, "2026/" + title, 3, 3, 90_000_000,
|
||||
new DateTimeOffset(2026, 10, 27, 9, 30, 0, TimeSpan.Zero), "alberto", TrashKind.Replaced);
|
||||
|
||||
private static TrashEmptyPlan Plan(IReadOnlyList<TrashEntry> entries) => new(Guid.CreateVersion7(), entries, entries.Sum(e => e.Bytes), "f1", []);
|
||||
|
||||
/// <summary>The confirmation of emptying <paramref name="plan"/>, shown off screen and laid out.</summary>
|
||||
private static ConfirmDialog Open(TrashEmptyPlan plan)
|
||||
{
|
||||
var dialog = new ConfirmDialog(Assert.NotNull(TrashEmptyPlans.Request(plan)))
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.Manual,
|
||||
Left = -20000,
|
||||
Top = -20000,
|
||||
ShowActivated = false,
|
||||
};
|
||||
dialog.Show();
|
||||
dialog.UpdateLayout();
|
||||
return dialog;
|
||||
}
|
||||
|
||||
private static void Press(UIElement target, Key key) =>
|
||||
target.RaiseEvent(new KeyEventArgs(Keyboard.PrimaryDevice, PresentationSource.FromVisual(target)!, 0, key) { RoutedEvent = Keyboard.KeyDownEvent });
|
||||
}
|
||||
@@ -255,6 +255,50 @@ public sealed class ShellNotificationTests
|
||||
Assert.Null(failures.Message);
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Owner review 2, R7: a conversion that replaced the photos ends with Undo, which brings the originals back from the
|
||||
/// trash and never runs from the Windows notification; one into new sequences ends as any other job.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public Task AReplaceConversionThatEndsOffersUndo() => ScreenHost.RunAsync(async () =>
|
||||
{
|
||||
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
|
||||
var shell = app.Shell;
|
||||
shell.CompleteWelcome();
|
||||
await JobsLoadedAsync(shell);
|
||||
var jobs = shell.Jobs;
|
||||
var raised = new List<Toast>();
|
||||
shell.PendingToasts.CollectionChanged += (_, e) => raised.AddRange(e.NewItems?.Cast<Toast>() ?? []);
|
||||
|
||||
foreach (var mode in new[] { "Replace", "NewSequence" })
|
||||
{
|
||||
raised.Clear();
|
||||
var target = Guid.CreateVersion7();
|
||||
var convert = Job(JobKind.Convert, JobState.Running, target) with
|
||||
{
|
||||
ParametersJson = $$"""{"archiveId":"{{Guid.CreateVersion7()}}","target":"LinearDng","quality":95,"mode":"{{mode}}","sequences":[{"id":"{{target}}","framesVersion":1}],"fingerprint":"fp"}""",
|
||||
};
|
||||
jobs.OnJobChanged(convert);
|
||||
jobs.Flush();
|
||||
jobs.OnJobChanged(convert with { State = JobState.Done, Finished = DateTimeOffset.UtcNow });
|
||||
jobs.Flush();
|
||||
var toast = raised.Single();
|
||||
if (mode == "Replace")
|
||||
{
|
||||
Assert.Equal(Loc.Plural("Archive.Convert.Done", 1), toast.Title);
|
||||
Assert.Equal(Loc.L("Archive.Delete.Undo"), toast.ActionText);
|
||||
Assert.Equal(Loc.L("Tooltips.Archive.ConvertUndo"), toast.ActionToolTip);
|
||||
Assert.False(toast.RunsFromNotification, "a click on the Windows notification never undoes");
|
||||
Assert.False(toast.IsError);
|
||||
}
|
||||
else
|
||||
{
|
||||
Assert.Equal(Loc.L("Shell.Job.Done"), toast.Title);
|
||||
Assert.Equal(Loc.L("Jobs.Action.Open"), toast.ActionText);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task ToastsBecomeWindowsNotificationsOnlyWhileNobodySeesTheWindow() => ScreenHost.RunAsync(async () =>
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user