diff --git a/tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs b/tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs index a56b4132..0074623c 100644 --- a/tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs +++ b/tests/Titano.App.Tests/Archive/ArchiveScreenSmokeTests.cs @@ -1,3 +1,5 @@ +using System.Windows.Controls; +using System.Windows.Input; using Titano.App.Archiving; using Titano.App.Sections; using Titano.App.Tests.Windows; @@ -8,7 +10,7 @@ namespace Titano.App.Tests.Archiving; /// /// Every Archive view of --capture () on the sample archive, rendered in both themes -/// in the real main window, with what each view must show. +/// in the real main window, with what each view must show — and the buttons really enabled, not only their commands. /// [WindowsOnly] [Serial] @@ -35,6 +37,18 @@ public sealed class ArchiveScreenSmokeTests Assert.NotEmpty(archive.FormatBars); Assert.True(archive.ScanCommand.CanExecute(null), "an online archive can be scanned"); await app.ExpectAsync("archive-overview"); + Assert.True(ButtonFor(app, archive.ScanCommand).IsEnabled, "the Scan button is enabled once the archive is read"); + Assert.True(ButtonFor(app, archive.AnalyseSetCommand).IsEnabled, "mass operations are enabled on the whole archive"); + + // Expanding another year keeps the selection: the set stays what the user chose. + var year = archive.TreeRows[1]; + var tree = app.FindAll().Single(l => l.Name == "Tree"); + tree.SelectedItems.Add(year); + var chosen = archive.SetText; + archive.Toggle(archive.TreeRows.Last(r => r.IsYear)); + Assert.Equal(chosen, archive.SetText, "opening a year does not change the set"); + Assert.True(tree.SelectedItems.Cast().Any(r => r.Node.Key == year.Node.Key), "the list shows the same selection"); + tree.SelectedItems.Clear(); await ArchiveScenes.ShowAsync(app.Shell, "maintenance"); Assert.True(archive.IsMaintenance); @@ -46,6 +60,24 @@ public sealed class ArchiveScreenSmokeTests await ArchiveScenes.ShowAsync(app.Shell, "rebuild"); var rebuild = Assert.NotNull(archive.Dialog as RebuildDialogViewModel); Assert.True(rebuild.RebuildCommand.CanExecute(null)); + Assert.False(archive.IsContentEnabled, "the screen behind a dialog takes no input"); await app.ExpectAsync("archive-rebuild"); + + await ArchiveScenes.ShowAsync(app.Shell, "move"); + var move = Assert.NotNull(archive.Dialog as RenameDialogViewModel); + Assert.NotEmpty(move.Rows, "the dry run lists the folders that change"); + await app.ExpectAsync("archive-move"); + Assert.True(ButtonFor(app, move.ApplyCommand).IsEnabled, "Apply follows the dry run"); + + move.CloseCommand.Execute(null); + archive.RetagSetCommand.Execute(null); + var retag = Assert.NotNull(archive.Dialog as RetagDialogViewModel); + retag.Add.Text = "sunset"; + await app.ExpectAsync("archive-retag"); + Assert.True(ButtonFor(app, retag.ApplyCommand).IsEnabled, "Apply follows the typed tags"); + retag.CloseCommand.Execute(null); }); + + private static Button ButtonFor(ScreenSmokeTests.SampleApp app, ICommand command) => + Assert.NotNull(app.FindAll