test(ui): disabled lists, chart tones, activation, RTL bars, failure toasts, icon names

- Visuals: a disabled list and the card grid keep their fill, a ListView keeps
  its column headers; chart labels are TextMuted and months without data the
  Stroke tone; charts show the hand and take the keyboard only with a handler;
  arrows, Home, Enter and Space choose and activate a bar; category bars start
  on the reading side in Arabic while months stay left to right.
- Screens: every visible icon-only button or segment has a name and a
  tooltip; a failed archive action raises an error toast, a notice does not.
- Uploader: an unexpected error raises an error toast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-06 21:03:37 +00:00
1 parent 4320769206
commit 7d9b0a800f
3 files changed
+239

No files matched your search

@@ -1,8 +1,10 @@
using System.IO;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
@@ -197,6 +199,12 @@ public sealed class ScreenSmokeTests
await app.ExpectAsync<LibraryView>("library-toast-done");
Assert.True(ran, "the action ran");
Assert.Equal(0, host.Toasts.Count, "the toast closes once its action has run");
// A failure interrupts the screen reader (assertive); a notice waits its turn.
Assert.False(await ArchiveActions.TryAsync(app.Shell, _ => throw new IOException("The archive drive is gone")));
Assert.True(host.Toasts.Single().IsError, "a failed archive action is announced at once");
app.Shell.Notify("Harbour sunset rendered");
Assert.False(host.Toasts[^1].IsError, "a notice is announced in turn");
});
[Test]
@@ -308,10 +316,22 @@ public sealed class ScreenSmokeTests
luminance[theme] = MeanLuminance(bitmap);
Assert.Greater(Distinct(bitmap), 8, $"{screen} drew almost nothing in {theme}");
}
AssertIconOnlyControlsNamed(screen);
Assert.Less(luminance[AppTheme.Dark], luminance[AppTheme.Light], $"{screen}: the light theme is not lighter than the dark one");
ThemeManager.Apply(AppTheme.Dark);
}
/// <summary>DESIGN §4: every visible icon-only button or segment has an accessible name and a tooltip.</summary>
public void AssertIconOnlyControlsNamed(string screen)
{
foreach (var control in FindAll<Control>().Where(c => c.IsVisible && IsIconOnly(c)))
{
var name = AutomationProperties.GetName(control);
Assert.False(string.IsNullOrWhiteSpace(name), $"{screen}: an icon-only {control.GetType().Name} bound to {(control as ButtonBase)?.Command} has no name");
Assert.True(control.ToolTip is not null, $"{screen}: '{name}' has no tooltip");
}
}
public List<T> FindAll<T>()
where T : DependencyObject
{
@@ -351,6 +371,13 @@ public sealed class ScreenSmokeTests
return bitmap;
}
private static bool IsIconOnly(Control control) => control switch
{
SegmentedItem segment => segment.Content is null && segment.Glyph is not null,
ButtonBase button => button.Content is null && ButtonIcon.GetGlyph(button) is not null,
_ => false,
};
private static byte[] Pixels(BitmapSource bitmap)
{
var pixels = new byte[bitmap.PixelWidth * bitmap.PixelHeight * 4];