diff --git a/src/Titano.App/DesignTime/SampleData.cs b/src/Titano.App/DesignTime/SampleData.cs
index 49ff67d8..6fb0cbaa 100644
--- a/src/Titano.App/DesignTime/SampleData.cs
+++ b/src/Titano.App/DesignTime/SampleData.cs
@@ -4,6 +4,7 @@ using Titano.App.About;
using Titano.App.Editor;
using Titano.App.Import;
using Titano.App.Infrastructure;
+using Titano.App.Library;
using Titano.App.Server;
using Titano.App.Settings;
using Titano.Core.Advice;
@@ -96,6 +97,7 @@ public sealed class SampleData
foreach (var job in Jobs(sequences.Select(s => s.Sequence).ToList(), archive.Id)) await db.Jobs.EnqueueAsync(job);
await FillServerAsync(db, sequences.Select(s => s.Sequence).ToList());
await SampleCards.InsertAsync(db, (SampleDeviceMonitor)_services.Devices, _services.Environment.DataDirectory);
+ await FillViewsAsync(db);
settings.LastArchivePath = @"D:\TitanoArchive";
settings.ServerUrl = "https://nas.local:8443";
@@ -107,6 +109,15 @@ public sealed class SampleData
settings.FirstRunCompleted = true;
}
+ /// Two saved views of the Library ("Not analysed, largest" and one camera), BRIEF §12.2.
+ private static async Task FillViewsAsync(TitanoDatabase db)
+ {
+ var views = new SavedViewStore(db.Settings);
+ await views.SaveAsync(SavedView.Of(Guid.CreateVersion7(), "Not analysed, largest",
+ new LibraryFilter { Status = StatusFilter.NotAnalysed, Sort = Data.Repositories.SequenceSort.Size }));
+ await views.SaveAsync(SavedView.Of(Guid.CreateVersion7(), "Nikon Z 8", new LibraryFilter { Camera = "NIKON Z 8" }));
+ }
+
///
/// Transfers for the sync table: an upload at 46 % (Comet over the ridge), an upload waiting (Fog lifting, Asti), a
/// download of originals running (Sunrise over Superga) and one paused (Lake Como storm).
diff --git a/src/Titano.App/Library/LibraryScenes.cs b/src/Titano.App/Library/LibraryScenes.cs
new file mode 100644
index 00000000..058ec910
--- /dev/null
+++ b/src/Titano.App/Library/LibraryScenes.cs
@@ -0,0 +1,60 @@
+using Titano.App.Archiving;
+using Titano.App.Infrastructure;
+using Titano.App.Shell;
+
+namespace Titano.App.Library;
+
+///
+/// The Library states that --capture renders (library-<scene>-<theme>.png) and the screen smoke
+/// tests check, on the sample index while signed in to the sample server: the timeline with a month chosen, a selection
+/// with the whole mass actions bar, and the server's sequences without a copy here as remote cards.
+///
+public static class LibraryScenes
+{
+ public static readonly IReadOnlyList Scenes = ["timeline", "mass", "remote"];
+
+ /// Sequences selected for the mass actions bar.
+ public const int MassSelection = 3;
+
+ public static async Task ShowAsync(ShellViewModel shell, string scene)
+ {
+ var library = shell.Library;
+ shell.Navigate(SectionKey.Library);
+ library.ClearSelectionCommand.Execute(null);
+ library.ClearFiltersCommand.Execute(null);
+ library.LayoutIndex = 0;
+ await library.RefreshAsync();
+ switch (scene)
+ {
+ case "timeline":
+ library.LayoutIndex = 2;
+ // A month further down the list: the year becomes the filter and the grid scrolls to the month.
+ if (library.Items.Count > 0 && library.Items[Math.Min(12, library.Items.Count - 1)].Sequence.FirstCapture is { } month)
+ {
+ library.ShowMonth(month.Year, month.Month);
+ await library.RefreshAsync();
+ }
+ break;
+ case "mass":
+ foreach (var item in library.Items.Where(i => !i.IsRemote).Take(MassSelection)) item.IsSelected = true;
+ break;
+ case "remote":
+ library.SelectedOrigin = library.Origins.First(o => o.Value == OriginFilter.Server);
+ await library.RefreshAsync();
+ if (library.Items.FirstOrDefault() is { } remote) remote.IsSelected = true;
+ // Remote thumbnails come through the sync engine's connection, not the local thumbnail service.
+ for (var i = 0; i < 60 && library.Items.Any(item => item.Thumbnail is null); i++) await Task.Delay(50);
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(scene), scene, "Unknown Library scene.");
+ }
+ }
+
+ /// The confirmation Delete shows for the selection: the archive engine's dry run (nothing moves).
+ public static async Task DeleteRequestAsync(ShellViewModel shell)
+ {
+ var archives = shell.Services.Archives ?? throw new InvalidOperationException("The sample index is not open.");
+ var ids = shell.Library.SelectedItems().Where(i => !i.IsRemote).Select(i => i.Id).ToList();
+ return DeletePlans.Request(await Task.Run(() => archives.PlanDeleteAsync(ids)));
+ }
+}
diff --git a/src/Titano.App/Shell/ScreenCapture.cs b/src/Titano.App/Shell/ScreenCapture.cs
index 60073f16..ec37b70e 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.Library;
using Titano.App.Server;
using Titano.App.Settings;
using Titano.Core.Diagnostics;
@@ -61,6 +62,8 @@ public static class ScreenCapture
await shell.Services.Server.RestoreAsync();
await shell.Services.Sync.RefreshAsync();
await shell.Server.Sync.ReloadAsync();
+ // The server's sequences without a copy here join the Library as remote cards.
+ await shell.Library.RefreshAsync();
shell.About.SetResult(null);
await shell.Settings.DetectEncodersAsync();
await shell.Settings.SelfTestAsync();
@@ -79,6 +82,7 @@ public static class ScreenCapture
written += await SaveAsync(window, directory, "library-list", theme, waitForThumbnails: shell);
shell.Library.LayoutIndex = 0;
shell.Library.ClearSelectionCommand.Execute(null);
+ written += await CaptureLibraryScenesAsync(window, shell, directory, theme);
shell.Navigate(SectionKey.Jobs);
if (shell.Jobs.Rows.Count > 0) shell.Jobs.Rows[0].IsExpanded = true;
@@ -148,6 +152,29 @@ public static class ScreenCapture
}
}
+ ///
+ /// library-timeline, library-mass (the selection with the whole bar), library-delete (the dry run
+ /// of deleting that selection, behind its typed confirmation) and library-remote (the server's sequences as
+ /// remote cards), then the Library as it was.
+ ///
+ private static async Task CaptureLibraryScenesAsync(MainWindow window, ShellViewModel shell, string directory, AppTheme theme)
+ {
+ var written = 0;
+ foreach (var scene in LibraryScenes.Scenes)
+ {
+ DismissToasts(window);
+ await LibraryScenes.ShowAsync(shell, scene);
+ written += await SaveAsync(window, directory, "library-" + scene, theme, waitForThumbnails: shell);
+ if (scene == "mass" && await LibraryScenes.DeleteRequestAsync(shell) is { } request)
+ written += await SaveDialogAsync(new ConfirmDialog(request), directory, "library-delete", theme);
+ }
+ shell.Library.ClearSelectionCommand.Execute(null);
+ shell.Library.ClearFiltersCommand.Execute(null);
+ shell.Library.LayoutIndex = 0;
+ await shell.Library.RefreshAsync();
+ return written;
+ }
+
private static void SelectSyncFilter(ShellViewModel shell, SyncFilter filter) =>
shell.Server.Sync.Chips.First(c => c.Filter == filter).SelectCommand.Execute(null);
diff --git a/tests/Titano.App.Tests/Library/DeletePlansTests.cs b/tests/Titano.App.Tests/Library/DeletePlansTests.cs
new file mode 100644
index 00000000..e23df155
--- /dev/null
+++ b/tests/Titano.App.Tests/Library/DeletePlansTests.cs
@@ -0,0 +1,65 @@
+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;
+
+/// The confirmation of Delete in the Library and the Archive manager: the engine's dry run behind a typed confirmation (DESIGN §4).
+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())
+ Assert.NotEqual("Archive.Delete.Reason." + reason, Loc.L("Archive.Delete.Reason." + reason), "every reason has words");
+ }
+}
diff --git a/tests/Titano.App.Tests/Library/LibraryCsvTests.cs b/tests/Titano.App.Tests/Library/LibraryCsvTests.cs
new file mode 100644
index 00000000..1cef1638
--- /dev/null
+++ b/tests/Titano.App.Tests/Library/LibraryCsvTests.cs
@@ -0,0 +1,45 @@
+using Titano.App.Library;
+using Titano.Core.Model;
+using Titano.Testing;
+
+namespace Titano.App.Tests.Library;
+
+/// "Export list as CSV" (BRIEF §12.2): RFC 4180 rows that spreadsheets read as data, never as formulas.
+public sealed class LibraryCsvTests
+{
+ [Test]
+ public void RowsAreQuotedInvariantAndSafe()
+ {
+ var harbour = new Sequence
+ {
+ Id = Guid.CreateVersion7(),
+ ArchiveId = Guid.CreateVersion7(),
+ Title = "Harbour, \"golden\" hour",
+ Folder = "2026/2026-09-28 Canon EOS R5",
+ CameraMake = "Canon",
+ CameraModel = "Canon EOS R5",
+ FirstCapture = new DateTime(2026, 9, 28, 18, 2, 11),
+ LastCapture = new DateTime(2026, 9, 28, 20, 2, 9),
+ FrameCount = 3_600,
+ TotalBytes = 96_200_000_000,
+ Tags = ["sunset", "harbour"],
+ };
+ var formula = new Sequence
+ {
+ Id = Guid.CreateVersion7(),
+ ArchiveId = Guid.Empty,
+ Folder = string.Empty,
+ Title = "=HYPERLINK(\"x\")",
+ Origin = SequenceOrigin.Server,
+ SyncState = SyncState.RemoteOnly,
+ };
+
+ var lines = LibraryCsv.Write([harbour, formula]).Split("\r\n");
+
+ Assert.Equal("title,first_capture,last_capture,camera_make,camera_model,frames,bytes,folder,tags,origin", lines[0]);
+ Assert.Equal("\"Harbour, \"\"golden\"\" hour\",2026-09-28 18:02:11,2026-09-28 20:02:09,Canon,Canon EOS R5,3600,96200000000,"
+ + "2026/2026-09-28 Canon EOS R5,sunset;harbour,local", lines[1]);
+ Assert.Equal("\"'=HYPERLINK(\"\"x\"\")\",,,,,0,0,,,server", lines[2]);
+ Assert.Equal(string.Empty, lines[3], "every row ends with CRLF");
+ }
+}
diff --git a/tests/Titano.App.Tests/Library/LibraryScreenSmokeTests.cs b/tests/Titano.App.Tests/Library/LibraryScreenSmokeTests.cs
new file mode 100644
index 00000000..609b4990
--- /dev/null
+++ b/tests/Titano.App.Tests/Library/LibraryScreenSmokeTests.cs
@@ -0,0 +1,106 @@
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.Windows.Media;
+using Titano.App.Archiving;
+using Titano.App.Library;
+using Titano.App.Sections;
+using Titano.App.Shell;
+using Titano.App.Tests.Windows;
+using Titano.Testing;
+using Titano.Ui.Visuals;
+
+namespace Titano.App.Tests.Library;
+
+///
+/// The Library's new states of --capture () on the sample index while signed in to the
+/// sample server, rendered in both themes in the real main window: the timeline, a selection with the whole mass actions
+/// bar and its delete dry run, the server's sequences as remote cards, and saved views.
+///
+[WindowsOnly]
+[Serial]
+[Timeout(300_000)]
+public sealed class LibraryScreenSmokeTests
+{
+ [Test]
+ public Task EveryLibrarySceneRendersInBothThemes() => ScreenHost.RunAsync(async () =>
+ {
+ await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
+ await app.Sample.FillAsync();
+ await app.Shell.Services.Server.RestoreAsync();
+ await app.Shell.Services.Sync.RefreshAsync();
+ var library = app.Shell.Library;
+
+ await LibraryScenes.ShowAsync(app.Shell, "timeline");
+ Assert.True(library.IsTimeline, "the timeline shows its bands");
+ Assert.True(library.IsGrid, "the cards stay under the bands");
+ Assert.Equal(2, library.TimelineBands.Count, "one band per year, 2026 and 2025");
+ Assert.True(library.TimelineBand >= 0 && library.TimelineSlot >= 0, "the chosen month is outlined");
+ Assert.True(library.IsYearFiltered, "a month narrows the Library to its year");
+ await app.ExpectAsync("library-timeline", waitForThumbnails: true);
+ Assert.True(app.FindAll().Any(t => t.IsVisible && t.ActualHeight > 0), "the bands are drawn");
+
+ await LibraryScenes.ShowAsync(app.Shell, "mass");
+ Assert.Equal(LibraryScenes.MassSelection, library.SelectionCount);
+ await app.ExpectAsync("library-mass", waitForThumbnails: true);
+ foreach (var command in new[] { library.AnalyseCommand, library.ProxiesCommand, library.VerifyCommand, library.TagCommand, library.MoveCommand,
+ library.ExportListCommand, library.DeleteCommand })
+ Assert.True(ButtonFor(app, command).IsEnabled, "the bar's archive actions work on sequences of this PC");
+ Assert.True(library.CanRate);
+
+ var request = Assert.NotNull(await LibraryScenes.DeleteRequestAsync(app.Shell), "the dry run moves something");
+ Assert.True(request.IsDestructive);
+ Assert.NotNull(request.TypedConfirmation);
+ var dialog = new ConfirmDialog(request) { WindowStartupLocation = WindowStartupLocation.Manual, Left = -20000, Top = -20000, ShowActivated = false };
+ dialog.Show();
+ try
+ {
+ dialog.UpdateLayout();
+ var action = Find