diff --git a/src/Titano.App/Sections/ArchiveViewModel.cs b/src/Titano.App/Sections/ArchiveViewModel.cs index 1384779f..30ab9f78 100644 --- a/src/Titano.App/Sections/ArchiveViewModel.cs +++ b/src/Titano.App/Sections/ArchiveViewModel.cs @@ -458,6 +458,8 @@ public sealed class ArchiveViewModel : SectionViewModel /// private void ForgetRead() { + // Picking A, then B, then A again before B's read ends must not find A "read" with none of its figures. + _readId = null; _search?.Cancel(); _duplicates = null; _orphans = null; diff --git a/tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs b/tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs index c201a746..ead7f59f 100644 --- a/tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs +++ b/tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs @@ -184,6 +184,7 @@ public sealed class ArchiveScreenSmokeTests Assert.Contains(archive.TreeRows, r => r.Node.Kind == TreeNodeKind.Sequence); Assert.NotEmpty(archive.Tiles); Assert.NotEmpty(archive.CameraBars); + var first = archive.SelectedArchive!; var second = await app.Services.Archives!.CreateAsync(Path.Combine(app.Services.Environment.DataDirectory, "second-archive"), "Second"); var reading = archive.LoadAsync(); @@ -205,6 +206,14 @@ public sealed class ArchiveScreenSmokeTests Assert.False(archive.RebuildCommand.CanExecute(null), "the rebuild dialog waits for the picked archive's own state and figures"); Assert.Null(await archive.OpenRebuildDialogAsync()); Assert.Empty(archive.Health); + // Back to the first archive before the picked one is read: it was read before, but none of its figures is left. + archive.SelectedArchive = first; + Assert.Empty(archive.TreeRows); + Assert.False(archive.RebuildCommand.CanExecute(null), "the first archive is not read again yet"); + Assert.False(archive.ScanCommand.CanExecute(null)); + Assert.Equal(Loc.L("Archive.Blocked.Reading"), archive.ScanToolTip); + Assert.Null(await archive.OpenRebuildDialogAsync()); + archive.SelectedArchive = second; await reading; Assert.Equal(second.Id, archive.SelectedArchive!.Id);