Owner review 1, phase 3a (docs/requests/2026-10-15-owner-review-1.md, R1). The desktop rail is 200 px wide, so the section names fit in every language, and collapses to 48 px of icons with its ≡ button or Ctrl+B. Collapsed, each icon's tooltip names its section before saying what it is for, while screen readers keep the name and the description. The choice is written to the settings file the moment it changes (nothing else restarts) and survives Settings › Reset all and Import; Ctrl+B waits behind the first-run dialog like Ctrl+1…6, and a held key toggles once. The admin panel's sidebar is 256 px and collapses to icons the same way, with its own ≡ button or Ctrl+B (on the physical key where the layout's B types no Latin letter, so Cyrillic, Greek, Hebrew and Arabic layouts work). The choice is kept in the browser, for the page when the browser refuses storage, and the tables fit their columns again after each toggle. At 900 px and below it stays the top bar and Ctrl+B stays the browser's. The wider rail leaves 49-72 px less for every screen at the 1200 px minimum. Six adversarial review rounds found what that cut, and in every shipped language no action is cut off now: the Jobs columns share their width (Target and Progress give way first, Kind/Where/State capped on wide windows), the editor's preview tools take a second line, a server job's Cancel has its own header column, the Archive tree keeps a year's label, the Import rows and result, the certificates and cache rows and the frame table fit. Headers, titles and cells that may be shortened end in an ellipsis and show their text in their tooltip; state tooltips start with the state, and their explanations were reworded not to repeat it (a queued job "waits for its turn", jobs running one at a time). The crop-result tool sits beside Crop mask, disabled with its reason while the mask is off. Tests check these rows in all 38 languages at 1200 px; the App test program now shuts WPF down in order, so its exit no longer crashes after every test passed. Phase 3 lands as two commits: R7 (the Edit section) edits the same shell files and follows. Also updates BRIEF (12.1, 14.8, 24), DECISIONS, CHANGELOG, STATUS, the request file, DESIGN and the mockups; every new or reworded string is in all 38 languages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
361 lines
20 KiB
C#
361 lines
20 KiB
C#
using System.IO;
|
||
using System.Windows;
|
||
using System.Windows.Automation;
|
||
using System.Windows.Controls;
|
||
using System.Windows.Controls.Primitives;
|
||
using System.Windows.Input;
|
||
using System.Windows.Media;
|
||
using Titano.App.Archiving;
|
||
using Titano.App.Infrastructure;
|
||
using Titano.App.Sections;
|
||
using Titano.App.Shell;
|
||
using Titano.App.Tests.Windows;
|
||
using Titano.Core.Archiving;
|
||
using Titano.Core.Localization;
|
||
using Titano.Testing;
|
||
using Titano.Ui.Controls;
|
||
|
||
namespace Titano.App.Tests.Archiving;
|
||
|
||
/// <summary>
|
||
/// Every Archive view of <c>--capture</c> (<see cref="ArchiveScenes"/>) on the sample archive, rendered in both themes
|
||
/// in the real main window, with what each view must show — the buttons really enabled and named for screen readers,
|
||
/// keyboard focus visible, no error or busy state left over — and paths and templates readable in a right-to-left
|
||
/// language.
|
||
/// </summary>
|
||
[WindowsOnly]
|
||
[Serial]
|
||
[Timeout(300_000)]
|
||
public sealed class ArchiveScreenSmokeTests
|
||
{
|
||
[Test]
|
||
public Task EveryArchiveViewRendersInBothThemes() => ScreenHost.RunAsync(async () =>
|
||
{
|
||
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
|
||
await app.Sample.FillAsync();
|
||
var archive = app.Shell.Archive;
|
||
|
||
await ArchiveScenes.ShowAsync(app.Shell, "overview");
|
||
Assert.True(archive.IsOverview);
|
||
Assert.True(archive.TreeRows[0].IsArchive);
|
||
Assert.Equal(StatusKind.Online, archive.TreeRows[0].AvailabilityKind);
|
||
Assert.True(archive.TreeRows[1].IsYear);
|
||
Assert.True(archive.TreeRows[1].IsExpanded, "the newest year opens with the screen");
|
||
Assert.Equal(5, archive.Tiles.Count);
|
||
Assert.Equal(2, archive.MonthRows.Count, "one heatmap row per year, 2025 and 2026");
|
||
Assert.NotEmpty(archive.StorageBars);
|
||
Assert.NotEmpty(archive.CameraBars);
|
||
Assert.NotEmpty(archive.FormatBars);
|
||
Assert.True(archive.HasMonthScale, "the heatmap's scale sits in its header");
|
||
Assert.Contains(archive.CameraBars[0].ToolTip!, archive.CamerasDescription);
|
||
Assert.True(archive.ScanCommand.CanExecute(null), "an online archive can be scanned");
|
||
await app.ExpectAsync<ArchiveView>("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");
|
||
AssertEveryButtonIsNamed(app);
|
||
Assert.Contains(archive.SetText, AutomationProperties.GetName(SetButton(app)));
|
||
foreach (var row in TreeItems(app)) Assert.NotNull(row.FocusVisualStyle, "a tree row shows keyboard focus");
|
||
Assert.Equal(Loc.L("Archive.Tree.Collapse"), AutomationProperties.GetName(ButtonFor(app, archive.TreeRows[1].ToggleCommand)),
|
||
"the open year's expander has a short name; the sentence is its tooltip");
|
||
var sequence = archive.TreeRows.First(r => r.Node.Kind == TreeNodeKind.Sequence);
|
||
Assert.Contains(sequence.Title, sequence.RowToolTip);
|
||
|
||
// Expanding another year keeps the selection: the set stays what the user chose.
|
||
var year = archive.TreeRows[1];
|
||
var tree = Tree(app);
|
||
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<ArchiveTreeRowViewModel>().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);
|
||
Assert.Equal(5, archive.Health.Count);
|
||
Assert.Equal(1, archive.Duplicates!.Count);
|
||
Assert.Equal(3, archive.Orphans!.Count, "unlisted photos, a row without sidecar, a folder not indexed");
|
||
var duplicatesLine = archive.Health[4].Line;
|
||
Assert.False(duplicatesLine.IsOk, "index health agrees with the duplicate groups listed beside it");
|
||
Assert.Equal(HealthAction.MarkDuplicates, duplicatesLine.Action);
|
||
await app.ExpectAsync<ArchiveView>("archive-maintenance");
|
||
Assert.False(app.FindAll<Button>().Any(b => b.IsVisible && ReferenceEquals(b.Command, archive.CancelSearchCommand)), "no Cancel without a search");
|
||
Assert.Equal(AutomationLiveSetting.Polite, AutomationProperties.GetLiveSetting(TextFor(app, archive.DuplicatesText)), "search results are announced");
|
||
AssertEveryButtonIsNamed(app);
|
||
|
||
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");
|
||
Assert.False(rebuild.FactRows.Any(f => f.Value == Loc.L("Archive.Rebuild.Counting")), "counted, the facts no longer say Counting…");
|
||
await app.ExpectAsync<ArchiveView>("archive-rebuild");
|
||
Assert.False(tree.IsEnabled);
|
||
var frame = Assert.NotNull(VisualTreeHelper.GetChild(tree, 0) as Border);
|
||
Assert.Equal(0, ((SolidColorBrush)frame.Background).Color.A, "the disabled tree keeps its panel's fill instead of the system's white");
|
||
AssertNoErrorShown(app);
|
||
|
||
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");
|
||
Assert.Null(move.ErrorText);
|
||
await app.ExpectAsync<ArchiveView>("archive-move");
|
||
Assert.True(ButtonFor(app, move.ApplyCommand).IsEnabled, "Apply follows the dry run");
|
||
Assert.True(ButtonFor(app, move.CloseCommand).IsDefault, "Enter takes the safe way out");
|
||
AssertNoErrorShown(app);
|
||
AssertEveryButtonIsNamed(app);
|
||
|
||
move.CloseCommand.Execute(null);
|
||
archive.RetagSetCommand.Execute(null);
|
||
var retag = Assert.NotNull(archive.Dialog as RetagDialogViewModel);
|
||
retag.Add.Text = "sunset";
|
||
await app.ExpectAsync<ArchiveView>("archive-retag");
|
||
Assert.True(ButtonFor(app, retag.ApplyCommand).IsEnabled, "Apply follows the typed tags");
|
||
AssertNoErrorShown(app);
|
||
retag.CloseCommand.Execute(null);
|
||
});
|
||
|
||
[Test]
|
||
public Task PathsTemplatesAndMonthsStayReadableRightToLeft() => ScreenHost.RunAsync(async () =>
|
||
{
|
||
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
|
||
await app.Sample.FillAsync();
|
||
UiLanguage.Apply("ar");
|
||
try
|
||
{
|
||
var archive = app.Shell.Archive;
|
||
await ArchiveScenes.ShowAsync(app.Shell, "overview");
|
||
Assert.Equal(12.ToString("N0", Loc.Culture), archive.MonthLabels[^1], "Arabic month names have no initials: the columns are numbered");
|
||
var year = archive.TreeRows[1];
|
||
Assert.Equal(Loc.L("Tooltips.Archive.YearRowRtl", year.Title + Loc.Separator + year.Detail), year.RowToolTip, "the tooltip names the mirrored arrow keys");
|
||
await app.ExpectAsync<ArchiveView>("archive-overview-ar");
|
||
|
||
// The dialogs' templates exist once they are laid out: render first, then look inside.
|
||
await ArchiveScenes.ShowAsync(app.Shell, "rebuild");
|
||
await app.ExpectAsync<ArchiveView>("archive-rebuild-ar");
|
||
Assert.Equal(FlowDirection.LeftToRight, TextFor(app, archive.SelectedArchive!.RootPath).FlowDirection, "the archive folder reads left to right");
|
||
|
||
await ArchiveScenes.ShowAsync(app.Shell, "move");
|
||
var move = Assert.NotNull(archive.Dialog as RenameDialogViewModel);
|
||
await app.ExpectAsync<ArchiveView>("archive-move-ar");
|
||
var template = Assert.NotNull(app.FindAll<TextBox>().FirstOrDefault(t => t.IsVisible && EditBehavior.GetField(t) == move.Template));
|
||
Assert.Equal(FlowDirection.LeftToRight, template.FlowDirection, "the naming template reads left to right");
|
||
Assert.Equal(FlowDirection.LeftToRight, TextFor(app, move.Rows[0].From).FlowDirection, "a folder before the move reads left to right");
|
||
Assert.Equal(FlowDirection.LeftToRight, TextFor(app, move.Rows[0].To).FlowDirection, "a folder after the move reads left to right");
|
||
move.CloseCommand.Execute(null);
|
||
}
|
||
finally
|
||
{
|
||
UiLanguage.Apply("en");
|
||
}
|
||
});
|
||
|
||
[Test]
|
||
public async Task RebuildCountsSayWhyInsteadOfCountingForever()
|
||
{
|
||
var offline = new RebuildDialogViewModel(Archive("/nowhere"), ArchiveAvailability.Offline, 3, () => Task.CompletedTask, _ => { });
|
||
await offline.CountAsync();
|
||
var sidecars = Fact(offline, "Archive.Rebuild.Sidecars");
|
||
Assert.Equal("—", sidecars.Value);
|
||
Assert.Equal(Loc.L("Archive.Error.Offline", Formatting.LeftToRight("/nowhere")), sidecars.ToolTip);
|
||
Assert.True(Fact(offline, "Archive.Rebuild.Root").IsPath, "the archive folder is shown left to right");
|
||
|
||
var missing = Path.Combine(Path.GetTempPath(), "titano-missing-" + Guid.NewGuid().ToString("N"));
|
||
var unreadable = new RebuildDialogViewModel(Archive(missing), ArchiveAvailability.Online, 3, () => Task.CompletedTask, _ => { });
|
||
await unreadable.CountAsync();
|
||
Assert.Equal("—", Fact(unreadable, "Archive.Rebuild.Metadata").Value);
|
||
Assert.Equal(Loc.L("Archive.Failed.Files"), Fact(unreadable, "Archive.Rebuild.Metadata").ToolTip);
|
||
Assert.Null(unreadable.BusyText, "nothing is counting any more");
|
||
|
||
static Core.Model.Archive Archive(string root) => new() { Id = Guid.CreateVersion7(), Name = "TitanoArchive", RootPath = root };
|
||
static DialogFact Fact(RebuildDialogViewModel dialog, string label) => dialog.FactRows.Single(f => f.Label == Loc.L(label));
|
||
}
|
||
|
||
/// <summary>
|
||
/// Picking another archive while one is being read shows the picked one: the read in progress is followed by one of
|
||
/// the new archive, and meanwhile nothing of the previous archive's tree can be acted on.
|
||
/// </summary>
|
||
[Test]
|
||
public Task PickingAnotherArchiveDuringAReadShowsThePickedOne() => ScreenHost.RunAsync(async () =>
|
||
{
|
||
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
|
||
await app.Sample.FillAsync();
|
||
var archive = app.Shell.Archive;
|
||
await ArchiveScenes.ShowAsync(app.Shell, "overview");
|
||
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();
|
||
archive.SelectedArchive = second;
|
||
Assert.Empty(archive.TreeRows);
|
||
// None of the first archive's figures stays on screen under the picked one's name while it is read (or if its read fails).
|
||
Assert.Empty(archive.Tiles);
|
||
Assert.Empty(archive.MonthRows);
|
||
Assert.Empty(archive.StorageBars);
|
||
Assert.Empty(archive.CameraBars);
|
||
Assert.Empty(archive.FormatBars);
|
||
Assert.Empty(archive.Recent);
|
||
Assert.False(archive.HasRecent);
|
||
Assert.Equal(string.Empty, archive.LastScanText);
|
||
Assert.Equal(0, archive.Badge, "the rail badge counts the picked archive's health, which is not read yet");
|
||
Assert.False(archive.AnalyseSetCommand.CanExecute(null), "nothing of the first archive can be acted on while the picked one is read");
|
||
Assert.False(archive.ScanCommand.CanExecute(null), "the picked archive is not known to be online yet");
|
||
Assert.Equal(Loc.L("Archive.Blocked.Reading"), archive.ScanToolTip, "not yet read is not offline");
|
||
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);
|
||
Assert.Contains(archive.Archives, a => a.Id == second.Id);
|
||
Assert.True(archive.TreeRows[0].IsArchive);
|
||
Assert.False(archive.TreeRows.Any(r => r.Node.Kind == TreeNodeKind.Sequence), "the tree is the picked, empty archive's");
|
||
Assert.True(archive.ScanCommand.CanExecute(null), "the picked archive was probed: it is online");
|
||
Assert.Equal(Loc.L("Tooltips.Archive.Scan"), archive.ScanToolTip);
|
||
Assert.True(archive.RebuildCommand.CanExecute(null));
|
||
var rebuild = Assert.NotNull(await archive.OpenRebuildDialogAsync());
|
||
Assert.Equal(second.Id, rebuild.Archive.Id);
|
||
Assert.Equal(ArchiveAvailability.Online, rebuild.Availability, "the dialog shows the picked archive's availability");
|
||
Assert.Equal(0, rebuild.Indexed, "and its own index, not the first archive's");
|
||
rebuild.CloseCommand.Execute(null);
|
||
});
|
||
|
||
[Test]
|
||
public void TheArrowTowardsTheIndentOpensAYearInEitherDirection()
|
||
{
|
||
Assert.True(ArchiveView.Toggles(Key.Right, FlowDirection.LeftToRight, isExpanded: false));
|
||
Assert.False(ArchiveView.Toggles(Key.Right, FlowDirection.LeftToRight, isExpanded: true));
|
||
Assert.True(ArchiveView.Toggles(Key.Left, FlowDirection.LeftToRight, isExpanded: true));
|
||
Assert.True(ArchiveView.Toggles(Key.Left, FlowDirection.RightToLeft, isExpanded: false), "a mirrored tree opens with Left");
|
||
Assert.True(ArchiveView.Toggles(Key.Right, FlowDirection.RightToLeft, isExpanded: true), "and closes with Right");
|
||
Assert.False(ArchiveView.Toggles(Key.Right, FlowDirection.RightToLeft, isExpanded: false));
|
||
Assert.True(ArchiveView.Toggles(Key.Enter, FlowDirection.RightToLeft, isExpanded: true));
|
||
Assert.False(ArchiveView.Toggles(Key.Down, FlowDirection.LeftToRight, isExpanded: false));
|
||
}
|
||
|
||
/// <summary>Every button of the screen has a name screen readers can announce, menu buttons with drawn chevrons included.</summary>
|
||
private static void AssertEveryButtonIsNamed(ScreenSmokeTests.SampleApp app)
|
||
{
|
||
foreach (var button in app.FindAll<ButtonBase>().Where(b => b.IsVisible && b.Focusable && IsInArchive(b)))
|
||
{
|
||
var name = AutomationProperties.GetName(button);
|
||
if (string.IsNullOrEmpty(name)) name = button.Content as string;
|
||
Assert.False(string.IsNullOrWhiteSpace(name), $"{button.GetType().Name} '{button.Name}' bound to {button.Command} has no accessible name");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// Beside the 200 px rail at the 1200 px minimum (owner review 1, R1), in every shipped language: a year row shows its year
|
||
/// whole (its figures give way, and stay inside the row).
|
||
/// </summary>
|
||
[Test]
|
||
public Task YearRowsKeepTheirYearAtTheMinimumWidthInEveryLanguage() => ScreenHost.RunAsync(async () =>
|
||
{
|
||
await using var app = await ScreenSmokeTests.SampleApp.StartAsync();
|
||
await app.Sample.FillAsync();
|
||
await ArchiveScenes.ShowAsync(app.Shell, "overview");
|
||
var window = app.Window;
|
||
window.Width = 1200;
|
||
window.Height = 788;
|
||
try
|
||
{
|
||
foreach (var language in Languages.Shipped)
|
||
{
|
||
UiLanguage.Apply(language);
|
||
window.UpdateLayout();
|
||
await window.Dispatcher.InvokeAsync(() => { }, System.Windows.Threading.DispatcherPriority.ApplicationIdle);
|
||
var years = TreeItems(app).Where(i => ((ArchiveTreeRowViewModel)i.DataContext).IsYear).ToList();
|
||
Assert.True(years.Count > 0, $"{language}: year rows show");
|
||
foreach (var item in years)
|
||
{
|
||
var row = (ArchiveTreeRowViewModel)item.DataContext;
|
||
var texts = Descendants<TextBlock>(item).Where(t => t.IsVisible).ToList();
|
||
var title = texts.Single(t => t.Text == row.Title);
|
||
// A copy with the same font, measured by the same layout engine, needs no more room than the year got (layout
|
||
// rounding aside: a cut year keeps barely half of it).
|
||
var probe = new TextBlock
|
||
{
|
||
Text = title.Text,
|
||
FontFamily = title.FontFamily,
|
||
FontSize = title.FontSize,
|
||
FontStyle = title.FontStyle,
|
||
FontWeight = title.FontWeight,
|
||
FontStretch = title.FontStretch,
|
||
FlowDirection = title.FlowDirection,
|
||
Language = title.Language,
|
||
};
|
||
TextOptions.SetTextFormattingMode(probe, TextOptions.GetTextFormattingMode(title));
|
||
probe.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||
Assert.True(probe.DesiredSize.Width <= title.ActualWidth + 1, $"{language}: the year '{row.Title}' is cut ({title.ActualWidth:0} of {probe.DesiredSize.Width:0} px)");
|
||
var (left, right) = Span(item, window);
|
||
foreach (var text in texts)
|
||
{
|
||
var (start, end) = Span(text, window);
|
||
Assert.True(start >= left - 0.5 && end <= right + 0.5, $"{language}: '{text.Text}' spans {start:0}–{end:0} px, its row {left:0}–{right:0} px");
|
||
}
|
||
}
|
||
}
|
||
}
|
||
finally
|
||
{
|
||
UiLanguage.Apply("en");
|
||
}
|
||
});
|
||
|
||
/// <summary>The left and right edges of an element in window coordinates, whichever way the window reads.</summary>
|
||
private static (double Left, double Right) Span(FrameworkElement element, Window window)
|
||
{
|
||
var a = element.TranslatePoint(new Point(0, 0), window).X;
|
||
var b = element.TranslatePoint(new Point(element.ActualWidth, 0), window).X;
|
||
return (Math.Min(a, b), Math.Max(a, b));
|
||
}
|
||
|
||
private static IEnumerable<T> Descendants<T>(DependencyObject node)
|
||
where T : DependencyObject
|
||
{
|
||
for (var i = 0; i < VisualTreeHelper.GetChildrenCount(node); i++)
|
||
{
|
||
var child = VisualTreeHelper.GetChild(node, i);
|
||
if (child is T match) yield return match;
|
||
foreach (var nested in Descendants<T>(child)) yield return nested;
|
||
}
|
||
}
|
||
|
||
/// <summary>A dialog that has not failed shows no error line.</summary>
|
||
private static void AssertNoErrorShown(ScreenSmokeTests.SampleApp app) =>
|
||
Assert.False(app.FindAll<StatusGlyph>().Any(g => g.IsVisible && g.Kind == StatusKind.Error && IsInArchive(g)), "no error state before anything failed");
|
||
|
||
private static ListBox Tree(ScreenSmokeTests.SampleApp app) => app.FindAll<ListBox>().Single(l => l.Name == "Tree");
|
||
|
||
private static IEnumerable<ListBoxItem> TreeItems(ScreenSmokeTests.SampleApp app) =>
|
||
app.FindAll<ListBoxItem>().Where(i => i.IsVisible && i.DataContext is ArchiveTreeRowViewModel);
|
||
|
||
private static Button SetButton(ScreenSmokeTests.SampleApp app) =>
|
||
Assert.NotNull(app.FindAll<Button>().FirstOrDefault(b => b.IsVisible && b.ToolTip as string == Loc.L("Tooltips.Archive.Set")), "the set filter button");
|
||
|
||
private static bool IsInArchive(DependencyObject element)
|
||
{
|
||
for (var node = VisualTreeHelper.GetParent(element); node is not null; node = VisualTreeHelper.GetParent(node))
|
||
{
|
||
if (node is ArchiveView) return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
private static TextBlock TextFor(ScreenSmokeTests.SampleApp app, string text) =>
|
||
Assert.NotNull(app.FindAll<TextBlock>().FirstOrDefault(t => t.IsVisible && t.Text == text && IsInArchive(t)), $"a visible text '{text}'");
|
||
|
||
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");
|
||
}
|