fix: nothing under the mouse is silent: dividers, previews, class pictures, categories

A page swept point by point left a few places a reader heard nothing: the panel
dividers, the vehicle preview in the depot and the texture base, the picture by
a vehicle class and the empty part of the settings categories. Each now has a
name; a picture with a caption beside it reads as the caption.

The tests that build controls run one after another: a control belongs to the
thread that made the first one, and side by side they now and then failed.
This commit is contained in:
maj00r
2026-11-15 20:01:25 +01:00
parent 184629b544
commit ee6da4c8ee
19 changed files with 65 additions and 7 deletions

View File

@@ -6,6 +6,7 @@ using StarterNG.Controls;
namespace StarterNG.Tests;
[Collection(AvaloniaControls.Name)]
public class AnnouncerTests
{
private DateTime _now = new(2026, 11, 15, 12, 0, 0, DateTimeKind.Utc);
@@ -81,6 +82,7 @@ public class AnnouncerTests
}
}
[Collection(AvaloniaControls.Name)]
public class NamedGroupTests
{
static NamedGroupTests() => ScreenReaderNames.Install();

View File

@@ -0,0 +1,11 @@
namespace StarterNG.Tests;
/// <summary>
/// Tests that build Avalonia controls run one after another: a control belongs to the
/// thread that made the first one, and run side by side they now and then failed.
/// </summary>
[CollectionDefinition(Name)]
public sealed class AvaloniaControls
{
public const string Name = "Avalonia controls";
}

View File

@@ -5,6 +5,7 @@ using StarterNG.Controls;
namespace StarterNG.Tests;
[Collection(AvaloniaControls.Name)]
public class ExpandableTreeViewItemTests
{
private static IExpandCollapseProvider Peer(ExpandableTreeViewItem item) =>

View File

@@ -4,6 +4,7 @@ using StarterNG.Controls;
namespace StarterNG.Tests;
[Collection(AvaloniaControls.Name)]
public class FieldLabelTests
{
static FieldLabelTests() => ScreenReaderNames.Install();

View File

@@ -4,6 +4,7 @@ using StarterNG.Controls;
namespace StarterNG.Tests;
[Collection(AvaloniaControls.Name)]
public class KeyboardFocusTests
{
private readonly Button _window = new();

View File

@@ -5,6 +5,7 @@ using StarterNG.Infrastructure;
namespace StarterNG.Tests;
[Collection(AvaloniaControls.Name)]
public class MouseReadingTests
{
static MouseReadingTests() => ScreenReaderNames.Install();
@@ -20,6 +21,18 @@ public class MouseReadingTests
Assert.Same(button, AutomationProperties.GetLabeledBy(logo));
}
[Fact]
public void A_picture_beside_a_caption_is_read_as_the_caption()
{
var mini = new Image();
var caption = new TextBlock { Text = "EU07" };
_ = new StackPanel { Children = { mini, new TextBlock { IsVisible = false, Text = "ukryte" }, caption } };
ScreenReaderNames.NamePicture(mini);
Assert.Same(caption, AutomationProperties.GetLabeledBy(mini));
}
[Fact]
public void A_picture_in_a_card_is_read_as_the_card_tooltip()
{

View File

@@ -7,6 +7,7 @@ using StarterNG.Controls;
namespace StarterNG.Tests;
[Collection(AvaloniaControls.Name)]
public class ReadableSliderTests
{
[Fact]

View File

@@ -6,6 +6,7 @@ using StarterNG.Controls;
namespace StarterNG.Tests;
[Collection(AvaloniaControls.Name)]
public class ScreenReaderNamesTests
{
static ScreenReaderNamesTests() => ScreenReaderNames.Install();
@@ -188,6 +189,7 @@ public class ScreenReaderNamesTests
}
}
[Collection(AvaloniaControls.Name)]
public class PickerNameTests
{
[Fact]