fix: Sonar's remarks on the screen reader work, and tests for it

The cab panel's drawing and the consist narration are split into smaller
steps, with plain switches and concrete return types where Sonar asked.

Tests drive the black box panels, both tape views, the key bindings, the
windows opened over another, the search count and the themed tree
entries, sliders, number boxes, pickers and settings sections headless,
as someone at the keyboard with a screen reader meets them.
This commit is contained in:
maj00r
2026-11-15 22:06:55 +01:00
parent ff5228555e
commit 3f4a20097e
18 changed files with 1273 additions and 134 deletions

View File

@@ -2,6 +2,7 @@ using Avalonia.Automation;
using Avalonia.Automation.Peers;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.VisualTree;
using StarterNG.Controls;
namespace StarterNG.Tests;
@@ -49,7 +50,12 @@ public class AnnouncerTests
[Fact]
public void A_control_outside_any_announcer_is_not_heard()
{
Announcer.Say(new Button(), "Godzina: 07:05");
var button = new Button();
var thrown = Record.Exception(() => Announcer.Say(button, "Godzina: 07:05"));
Assert.Null(thrown);
Assert.Null(button.FindAncestorOfType<Announcer>());
}
[Fact]