Delete… runs in an in-window dialog shared by the Library and the Archive manager: the dry run and the move into the trash report progress and stop on Cancel, the toast counts only what really moved, and its Undo reports failures. The confirmation names at most six moves and three refusals in the UI font. Delete… stands apart at the far right of both bars and last in the tab order. The toolbar's filters wrap instead of pushing out the right-hand group at 1200 px. Card and row quick actions show while selected or focused, so Tab reaches them; Analyse and Render are disabled with a reason when nothing can run them, and say so in a toast if the session drops. Remote cards get their own card, Analyse and Render tooltips; the details panel's Folder and the saved-view menu say why they are disabled. Status offers Rendered, Not rendered and Synced. Remote cards count in the Year and Camera choices and the timeline. The trash dialog shows one sentence when empty. --capture adds archive-trash and library-viewname. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
81 lines
4.4 KiB
C#
81 lines
4.4 KiB
C#
using System.Globalization;
|
|
using Titano.App.Archiving;
|
|
using Titano.App.Infrastructure;
|
|
using Titano.Core.Localization;
|
|
using Titano.Core.Model;
|
|
using Titano.Data.Archiving;
|
|
using Titano.Testing;
|
|
|
|
namespace Titano.App.Tests.Library;
|
|
|
|
/// <summary>The confirmation of Delete in the Library and the Archive manager: the engine's dry run behind a typed confirmation (DESIGN §4).</summary>
|
|
public sealed class DeletePlansTests
|
|
{
|
|
private static Sequence Sequence(string title, int frames) => new()
|
|
{
|
|
Id = Guid.CreateVersion7(),
|
|
ArchiveId = Guid.CreateVersion7(),
|
|
Title = title,
|
|
Folder = "2026/" + title,
|
|
FrameCount = frames,
|
|
};
|
|
|
|
private static DeleteStep Step(string title, int frames, int files, long bytes) =>
|
|
new(Sequence(title, frames), $".titano/trash/{Guid.CreateVersion7():N}", files, bytes);
|
|
|
|
[Test]
|
|
public void ThePlanAsksToTypeHowManySequencesMove()
|
|
{
|
|
var plan = new DeletePlan(
|
|
[Step("Harbour sunset", 3_600, 3_640, 96_200_000_000), Step("Comet over the ridge", 1_005, 1_020, 21_000_000_000)],
|
|
[new BlockedDelete(Sequence("Fog lifting", 980), DeleteBlock.Busy)]);
|
|
|
|
var request = Assert.NotNull(DeletePlans.Request(plan));
|
|
|
|
Assert.True(request.IsDestructive, "the action is outlined, never primary");
|
|
Assert.Equal("2", request.TypedConfirmation);
|
|
Assert.Equal(Loc.L("Archive.Delete.Type", "2"), request.TypedPrompt);
|
|
Assert.Equal(Loc.Plural("Archive.Delete.Heading", 2), request.Heading);
|
|
Assert.Equal(Loc.L("Archive.Delete.Message", Loc.Plural("Shell.Status.Photos", 4_605), Loc.Plural("Archive.Delete.Files", 4_660),
|
|
Formatting.Bytes(117_200_000_000)), request.Message);
|
|
var lines = request.Detail!.Split(Environment.NewLine);
|
|
Assert.Equal(3, lines.Length);
|
|
Assert.Equal(Loc.L("Archive.Delete.Line", "Harbour sunset", Loc.Plural("Shell.Status.Photos", 3_600), Formatting.Bytes(96_200_000_000)), lines[0]);
|
|
Assert.Equal(Loc.L("Archive.Delete.Blocked", "Fog lifting", Loc.L("Archive.Delete.Reason.Busy")), lines[2]);
|
|
Assert.Equal(Loc.L("Archive.Delete.Keep"), request.SafeText);
|
|
Assert.Equal(Loc.Plural("Tooltips.Archive.DeleteAction", 2), request.ActionToolTip);
|
|
}
|
|
|
|
[Test]
|
|
public void LongPlansAreCountedAndEmptyOnesAskNothing()
|
|
{
|
|
var many = Enumerable.Range(1, DeletePlans.ListedLines + 3).Select(i => Step("Sequence " + i.ToString(CultureInfo.InvariantCulture), 10, 10, 1_000)).ToList();
|
|
var request = Assert.NotNull(DeletePlans.Request(new DeletePlan(many, [])));
|
|
var lines = request.Detail!.Split(Environment.NewLine);
|
|
Assert.Equal(DeletePlans.ListedLines + 1, lines.Length);
|
|
Assert.Equal(Loc.Plural("Archive.Delete.More", 3), lines[^1]);
|
|
Assert.Equal((DeletePlans.ListedLines + 3).ToString(CultureInfo.InvariantCulture), request.TypedConfirmation);
|
|
|
|
var blocked = new DeletePlan([], [new BlockedDelete(Sequence("Root", 2), DeleteBlock.ArchiveRoot)]);
|
|
Assert.Null(DeletePlans.Request(blocked), "nothing can move: no confirmation");
|
|
Assert.SequenceEqual([Loc.L("Archive.Delete.Blocked", "Root", Loc.L("Archive.Delete.Reason.ArchiveRoot"))], DeletePlans.Blocked(blocked, 8));
|
|
foreach (var reason in Enum.GetValues<DeleteBlock>())
|
|
Assert.NotEqual("Archive.Delete.Reason." + reason, Loc.L("Archive.Delete.Reason." + reason), "every reason has words");
|
|
}
|
|
|
|
[Test]
|
|
public void TheConfirmationStaysShortEnoughForASmallScreen()
|
|
{
|
|
var steps = Enumerable.Range(1, 20).Select(i => Step("Sequence " + i.ToString(CultureInfo.InvariantCulture), 10, 10, 1_000)).ToList();
|
|
var blocked = Enumerable.Range(1, 9).Select(i => new BlockedDelete(Sequence("Busy " + i.ToString(CultureInfo.InvariantCulture), 5), DeleteBlock.Busy)).ToList();
|
|
|
|
var request = Assert.NotNull(DeletePlans.Request(new DeletePlan(steps, blocked)));
|
|
var lines = request.Detail!.Split(Environment.NewLine);
|
|
|
|
Assert.Equal(DeletePlans.ListedLines + 1 + DeletePlans.BlockedLines + 1, lines.Length, "named lines plus one count for each part");
|
|
Assert.Equal(Loc.Plural("Archive.Delete.More", 14), lines[DeletePlans.ListedLines]);
|
|
Assert.Equal(Loc.Plural("Archive.Delete.More", 6), lines[^1]);
|
|
Assert.False(request.IsDetailMonospaced, "names read in the UI font, not the fingerprint font");
|
|
}
|
|
}
|