fix(settings): archive rows keep offline sizes, edit no stray archive and keep edits made while a folder opens
- While the open archive's archive.json cannot be read, the rows show the index's templates and proxy size and the thumbnail size stays this PC's: the stand-in 320 no longer replaces the default of new archives. Settings › Archive loads through RefreshSettingsAsync, so opening it also brings the index up to a change made elsewhere. - With no archive folder the rows edit only this PC's defaults, never the first archive of the index. - An Archive row edited (or Reset section) while the archive at a just-chosen folder is opening waits for it and goes to that archive (or stays a default when the folder holds none), instead of being undone when it opens. - A portable copy whose data had to leave its OneDrive folder says so at start, with Open on the data folder. - Opening Settings re-reads Start with Windows, which Task Manager may have changed meanwhile. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
4 files changed
+127
-31
No files matched your search
@@ -169,6 +169,51 @@ public sealed class SettingsScreenSmokeTests
|
||||
installs[0].Command.Execute(null);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task ArchiveRowsEditOnlyTheArchiveAtTheFolderAndKeepEditsMadeWhileItOpens() => ScreenHost.RunAsync(async () =>
|
||||
{
|
||||
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
|
||||
var shell = app.Shell;
|
||||
await app.Sample.FillAsync();
|
||||
var settings = shell.Settings;
|
||||
var db = shell.Services.Database!;
|
||||
var archive = Assert.NotNull(await Titano.App.Archiving.CurrentArchive.FindAsync(db, null));
|
||||
var manifestPath = new Titano.Core.Archiving.ArchivePaths(archive.RootPath).ManifestPath;
|
||||
static Titano.Core.Archiving.ArchiveManifest Read(string path) => Titano.Core.Archiving.ManifestStore.ReadArchive(path);
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
settings.Page = SettingsPage.Archive;
|
||||
|
||||
// No archive folder: a template edit is this PC's default only, never the first archive of the index.
|
||||
settings.ArchiveRoot.Text = string.Empty;
|
||||
Assert.True(settings.ArchiveRoot.Commit());
|
||||
settings.FolderTemplate.Text = "{camera}/{date}";
|
||||
Assert.True(settings.FolderTemplate.Commit());
|
||||
|
||||
// The archive's folder is chosen and a template edited at once, while that archive is still opening: the edit
|
||||
// reaches its archive.json instead of being undone when it opens, and the row shows it.
|
||||
settings.ArchiveRoot.Text = archive.RootPath;
|
||||
Assert.True(settings.ArchiveRoot.Commit());
|
||||
settings.FileTemplate.Text = "{date}_{n:0000}";
|
||||
Assert.True(settings.FileTemplate.Commit());
|
||||
await WaitAsync(() => Read(manifestPath).LayoutTemplates.File == "{date}_{n:0000}", "the edit reached the archive that was opening");
|
||||
await WaitAsync(() => settings.FileTemplate.Text == "{date}_{n:0000}" && shell.Services.Settings.FileTemplate == "{date}_{n:0000}", "the row shows it");
|
||||
Assert.NotEqual("{camera}/{date}", Read(manifestPath).LayoutTemplates.Folder);
|
||||
|
||||
// Offline, only archive.json knows the thumbnail size: this PC's stays instead of becoming the default.
|
||||
Titano.Core.Archiving.ManifestStore.WriteArchive(manifestPath, Read(manifestPath) with { ThumbnailPolicy = new Titano.Core.Archiving.ThumbnailPolicy { LongEdge = 480 } });
|
||||
shell.Navigate(SectionKey.Library);
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
await WaitAsync(() => shell.Services.Settings.ThumbnailLongEdge == 480, "the archive's thumbnail size is shown");
|
||||
var row = Assert.NotNull(await db.Archives.GetAsync(archive.Id));
|
||||
await db.Archives.UpsertAsync(row with { ProxyLongEdge = 2560 });
|
||||
System.IO.File.Move(manifestPath, manifestPath + ".away");
|
||||
shell.Navigate(SectionKey.Library);
|
||||
shell.Navigate(SectionKey.Settings);
|
||||
await WaitAsync(() => shell.Services.Settings.ProxyLongEdge == 2560, "the index's proxy size is shown while offline");
|
||||
Assert.Equal(480, shell.Services.Settings.ThumbnailLongEdge);
|
||||
Assert.Equal(480, settings.SelectedThumbnailSize.Value);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task TheFirstRunDialogKeepsTheKeyboardInside() => ScreenHost.RunAsync(async () =>
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user