CI / Build and test (push) Successful in 13m44s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 16s
Release / Build, test and publish (push) Successful in 26m34s
CI / PostgreSQL 16 integration (push) Failing after 17m36s
CI / PostgreSQL 17 integration (push) Failing after 15m36s
CI / Docker image (push) Successful in 1m12s
Release / Server image (push) Failing after 15s
The same time-lapse on a server and on this PC under different ids, or twice on this PC, is recognised, compared and settled as the owner asked in owner review 6. Matches are found after each sync refresh, through the server's new photo lookup, and after the jobs that change photos. The default is to ask every time. Server › Matches offers: - Keep apart, which is remembered; - Link only and Unlink; - the Compare dialog: photos, details line by line, projects and the plan. Integrate completes both sides. Photos default to Union, projects are copied across, and a losing version goes to the trash only after a hash check. Afterwards new photos move by themselves, and deletions wait for the user. A merge of two local sequences verifies every photo before the other sequence goes to its archive's trash. Upload all local skips suspected matches and flags them. Migration 0012 adds the found_copies and copy_probes tables. Jobs 25 (Integrate) and 26 (MergeSequences) are new, and so are the server capabilities photo-lookup and upload-into. Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
82 lines
3.0 KiB
C#
82 lines
3.0 KiB
C#
using System.Reflection;
|
|
using Chronos.App.Infrastructure;
|
|
using Chronos.App.Library;
|
|
using Chronos.Core.Localization;
|
|
using Chronos.Core.Model;
|
|
using Chronos.Data.Archiving;
|
|
using Chronos.Data.Copies;
|
|
using Chronos.Testing;
|
|
|
|
namespace Chronos.App.Tests.Library;
|
|
|
|
/// <summary>Two versions… (owner Q3, #73): a drop whose dry run cannot go says why and asks nothing.</summary>
|
|
[Serial]
|
|
public sealed class VersionsDialogTests
|
|
{
|
|
private static readonly Sequence Comet = new()
|
|
{
|
|
Id = Guid.CreateVersion7(),
|
|
ArchiveId = Guid.CreateVersion7(),
|
|
Title = "Comet",
|
|
Folder = "2026/comet",
|
|
};
|
|
|
|
[Test]
|
|
public async Task ABlockedDropSaysWhyAndNeverAsksOrDrops()
|
|
{
|
|
foreach (var (block, expected) in new[]
|
|
{
|
|
(FrameDeleteBlock.Offline, Loc.L("Errors.Copies.TrashBlocked", "IMG_0002.JPG", Loc.L("Archive.Delete.Reason.Offline"))),
|
|
(FrameDeleteBlock.Busy, Loc.L("Errors.Copies.TrashBlocked", "IMG_0002.JPG", Loc.L("Archive.Delete.Reason.Busy"))),
|
|
(FrameDeleteBlock.FramesChanged, Loc.L("Archive.Convert.Blocked.FramesChanged")),
|
|
})
|
|
{
|
|
var engine = FakeEngine.Create(new OwnVersionDropPlan(new FrameDeletePlan(Comet, [], 0, [block]), Guid.NewGuid(), "IMG_0003.JPG", "b", []));
|
|
var asked = 0;
|
|
var dialog = new VersionsDialogViewModel((ICopyEngine)engine, Comet.Id, Comet.DisplayTitle, _ =>
|
|
{
|
|
asked++;
|
|
return true;
|
|
}, _ => { });
|
|
var row = new VersionRow(dialog, new PhotoVersions(Guid.NewGuid(), "IMG_0002.JPG", "a", Guid.NewGuid(), "IMG_0003.JPG", "b"), Guid.NewGuid(), "IMG_0002.JPG", 10, "IMG_0003.JPG", inMain: true);
|
|
|
|
await dialog.DropAsync(row);
|
|
|
|
Assert.Equal(0, asked);
|
|
Assert.Equal(0, ((FakeEngine)engine).Dropped);
|
|
Assert.Equal(expected, dialog.ErrorText);
|
|
Assert.True(row.InMain);
|
|
}
|
|
}
|
|
|
|
/// <summary>An <see cref="ICopyEngine"/> that plans <see cref="Plan"/> for every drop and counts the drops applied.</summary>
|
|
public class FakeEngine : DispatchProxy
|
|
{
|
|
internal OwnVersionDropPlan? Plan { get; set; }
|
|
|
|
internal int Dropped { get; private set; }
|
|
|
|
internal static object Create(OwnVersionDropPlan plan)
|
|
{
|
|
var proxy = Create<ICopyEngine, FakeEngine>();
|
|
((FakeEngine)(object)proxy).Plan = plan;
|
|
return proxy;
|
|
}
|
|
|
|
protected override object? Invoke(MethodInfo? targetMethod, object?[]? args) => targetMethod?.Name switch
|
|
{
|
|
nameof(ICopyEngine.PlanDropOwnVersionAsync) => Task.FromResult(Plan!),
|
|
nameof(ICopyEngine.DropOwnVersionAsync) => Drop(),
|
|
nameof(ICopyEngine.VersionsAsync) => Task.FromResult<IReadOnlyList<PhotoVersions>>([]),
|
|
nameof(IDisposable.Dispose) => null,
|
|
_ => throw new NotSupportedException(targetMethod?.Name),
|
|
};
|
|
|
|
private Task<int> Drop()
|
|
{
|
|
Dropped++;
|
|
return Task.FromResult(1);
|
|
}
|
|
}
|
|
}
|