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
75 lines
3.5 KiB
C#
75 lines
3.5 KiB
C#
using Titano.App.Library;
|
|
using Titano.Core.Model;
|
|
using Titano.Data.Repositories;
|
|
using Titano.Testing;
|
|
|
|
namespace Titano.App.Tests.Library;
|
|
|
|
/// <summary>Mixed mode (BRIEF §4.4): the server's sequences without a copy here count in the Year and Camera choices and the timeline.</summary>
|
|
public sealed class LibraryFacetsTests
|
|
{
|
|
private static readonly ArchiveStats Local = new(3, 6_000, 60_000, [new YearBucket(2026, 3, 6_000, 60_000)],
|
|
[new MonthBucket(2026, 9, 2, 5_000), new MonthBucket(2026, 2, 1, 1_000)],
|
|
[new CameraBucket("Canon", "Canon EOS R5", 2, 5_000, 50_000), new CameraBucket("NIKON CORPORATION", "NIKON Z 8", 1, 1_000, 10_000)], [],
|
|
new ArchiveHealth(0, 0, 0, 0, 0, 0, 0));
|
|
|
|
private static Sequence Remote(DateTime? first, string? make, string? model, int frames) => new()
|
|
{
|
|
Id = Guid.CreateVersion7(),
|
|
ArchiveId = Guid.Empty,
|
|
Title = "Remote",
|
|
Folder = string.Empty,
|
|
Origin = SequenceOrigin.Server,
|
|
SyncState = SyncState.RemoteOnly,
|
|
FirstCapture = first,
|
|
CameraMake = make,
|
|
CameraModel = model,
|
|
FrameCount = frames,
|
|
TotalBytes = frames * 10L,
|
|
};
|
|
|
|
[Test]
|
|
public void RemoteCardsJoinTheYearsMonthsAndCameras()
|
|
{
|
|
Sequence[] remote =
|
|
[
|
|
Remote(new DateTime(2024, 5, 3), "SONY", "ILCE-7M4", 2_000),
|
|
Remote(new DateTime(2026, 9, 20), "Canon", "Canon EOS R5", 500),
|
|
Remote(null, null, null, 10),
|
|
];
|
|
|
|
var stats = LibraryFacets.Of(Local, remote, OriginFilter.Any);
|
|
|
|
Assert.SequenceEqual([2024, 2026], stats.ByYear.Select(y => y.Year));
|
|
Assert.Equal(new YearBucket(2024, 1, 2_000, 20_000), stats.ByYear[0]);
|
|
Assert.Equal(new YearBucket(2026, 4, 6_500, 65_000), stats.ByYear[1]);
|
|
Assert.SequenceEqual([(2024, 5), (2026, 2), (2026, 9)], stats.ByMonth.Select(m => (m.Year, m.Month)));
|
|
Assert.Equal(new MonthBucket(2026, 9, 3, 5_500), stats.ByMonth[2]);
|
|
Assert.Equal(3, stats.ByCamera.Single(c => c.Model == "Canon EOS R5").Sequences);
|
|
Assert.Equal(1, stats.ByCamera.Single(c => c.Model == "ILCE-7M4").Sequences);
|
|
Assert.Equal(1, stats.ByCamera.Single(c => c.Model is null).Sequences, "a card without camera counts under none");
|
|
Assert.Equal(Local.Sequences, stats.Sequences, "the totals stay the index's own");
|
|
|
|
var timeline = LibraryTimeline.From(stats, new DateTime(2026, 10, 6));
|
|
Assert.SequenceEqual([2026, 2025, 2024], timeline.Years, "a year only the server has gets its band");
|
|
Assert.Equal(2_000.0, timeline.Bands[2].Values[4]);
|
|
}
|
|
|
|
[Test]
|
|
public void TheOriginFilterDecidesWhoCounts()
|
|
{
|
|
Sequence[] remote = [Remote(new DateTime(2024, 5, 3), "SONY", "ILCE-7M4", 2_000)];
|
|
|
|
var local = LibraryFacets.Of(Local, remote, OriginFilter.Local);
|
|
Assert.SequenceEqual([2026], local.ByYear.Select(y => y.Year), "on this PC: the index alone");
|
|
Assert.False(local.ByCamera.Any(c => c.Model == "ILCE-7M4"));
|
|
|
|
var server = LibraryFacets.Of(Local, remote, OriginFilter.Server);
|
|
Assert.SequenceEqual([2024], server.ByYear.Select(y => y.Year), "only on server: the remote cards alone");
|
|
Assert.SequenceEqual(["ILCE-7M4"], server.ByCamera.Select(c => c.Model));
|
|
Assert.SequenceEqual([(2024, 5)], server.ByMonth.Select(m => (m.Year, m.Month)));
|
|
|
|
Assert.SequenceEqual(Local.ByYear, LibraryFacets.Of(Local, [], OriginFilter.Any).ByYear, "signed out, nothing changes");
|
|
}
|
|
}
|