test(app): a deleted sequence comes back from the Archive manager's trash
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
1 file changed
+33
@@ -88,6 +88,39 @@ public sealed class LibraryScreenSmokeTests
|
||||
Assert.True(library.Items.Count > 0 && library.Items.All(i => i.Sequence.CameraModel == "NIKON Z 8"));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task ADeletedSequenceComesBackFromTheArchiveTrash() => ScreenHost.RunAsync(async () =>
|
||||
{
|
||||
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
|
||||
await app.Sample.FillAsync();
|
||||
await LibraryScenes.ShowAsync(app.Shell, "mass");
|
||||
var db = app.Services.Database!;
|
||||
var archives = app.Services.Archives!;
|
||||
|
||||
// What Delete runs once confirmed: the movable part of the selection goes to the archive's trash.
|
||||
var plan = await archives.PlanDeleteAsync([.. app.Shell.Library.SelectedItems().Select(i => i.Id)]);
|
||||
var moved = Assert.NotNull(plan.Steps.FirstOrDefault(), "the selection holds a sequence no job works on").Sequence;
|
||||
Assert.NotEmpty(plan.Blocked);
|
||||
await archives.DeleteAsync(plan);
|
||||
Assert.Null(await db.Sequences.GetAsync(moved.Id));
|
||||
|
||||
app.Shell.Navigate(SectionKey.Archive);
|
||||
await app.Shell.Archive.LoadAsync();
|
||||
Assert.True(app.Shell.Archive.DeleteSetCommand.CanExecute(null), "the mass operations bar offers Delete…");
|
||||
await app.Shell.Archive.OpenTrashAsync();
|
||||
var trash = Assert.NotNull(app.Shell.Archive.Dialog as TrashDialogViewModel);
|
||||
var row = trash.Rows.Single();
|
||||
Assert.Equal(moved.Id, row.Entry.SequenceId);
|
||||
await app.ExpectAsync<ArchiveView>("archive-trash");
|
||||
|
||||
row.RestoreCommand.Execute(null);
|
||||
for (var i = 0; i < 100 && await db.Sequences.GetAsync(moved.Id) is null; i++) await Task.Delay(50);
|
||||
var restored = Assert.NotNull(await db.Sequences.GetAsync(moved.Id), "Restore brings the sequence back into the index");
|
||||
Assert.Equal(moved.Folder, restored.Folder);
|
||||
Assert.True(trash.IsEmpty);
|
||||
trash.CloseCommand.Execute(null);
|
||||
});
|
||||
|
||||
private static Button ButtonFor(ScreenSmokeTests.SampleApp app, ICommand command) =>
|
||||
Assert.NotNull(app.FindAll<Button>().FirstOrDefault(b => ReferenceEquals(b.Command, command) && b.IsVisible), "a visible button bound to the command");
|
||||
|
||||
|
||||
Reference in new issue
Block a user