diff --git a/StarterNG.Tests/AnnouncerTests.cs b/StarterNG.Tests/AnnouncerTests.cs
index d011f67..b407b3d 100644
--- a/StarterNG.Tests/AnnouncerTests.cs
+++ b/StarterNG.Tests/AnnouncerTests.cs
@@ -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();
diff --git a/StarterNG.Tests/AvaloniaControls.cs b/StarterNG.Tests/AvaloniaControls.cs
new file mode 100644
index 0000000..8edcc55
--- /dev/null
+++ b/StarterNG.Tests/AvaloniaControls.cs
@@ -0,0 +1,11 @@
+namespace StarterNG.Tests;
+
+///
+/// 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.
+///
+[CollectionDefinition(Name)]
+public sealed class AvaloniaControls
+{
+ public const string Name = "Avalonia controls";
+}
diff --git a/StarterNG.Tests/ExpandableTreeViewItemTests.cs b/StarterNG.Tests/ExpandableTreeViewItemTests.cs
index 41155a7..28aa794 100644
--- a/StarterNG.Tests/ExpandableTreeViewItemTests.cs
+++ b/StarterNG.Tests/ExpandableTreeViewItemTests.cs
@@ -5,6 +5,7 @@ using StarterNG.Controls;
namespace StarterNG.Tests;
+[Collection(AvaloniaControls.Name)]
public class ExpandableTreeViewItemTests
{
private static IExpandCollapseProvider Peer(ExpandableTreeViewItem item) =>
diff --git a/StarterNG.Tests/FieldLabelTests.cs b/StarterNG.Tests/FieldLabelTests.cs
index 809a2e2..d37ae05 100644
--- a/StarterNG.Tests/FieldLabelTests.cs
+++ b/StarterNG.Tests/FieldLabelTests.cs
@@ -4,6 +4,7 @@ using StarterNG.Controls;
namespace StarterNG.Tests;
+[Collection(AvaloniaControls.Name)]
public class FieldLabelTests
{
static FieldLabelTests() => ScreenReaderNames.Install();
diff --git a/StarterNG.Tests/KeyboardFocusTests.cs b/StarterNG.Tests/KeyboardFocusTests.cs
index f531627..c5b4cad 100644
--- a/StarterNG.Tests/KeyboardFocusTests.cs
+++ b/StarterNG.Tests/KeyboardFocusTests.cs
@@ -4,6 +4,7 @@ using StarterNG.Controls;
namespace StarterNG.Tests;
+[Collection(AvaloniaControls.Name)]
public class KeyboardFocusTests
{
private readonly Button _window = new();
diff --git a/StarterNG.Tests/MouseReadingTests.cs b/StarterNG.Tests/MouseReadingTests.cs
index 465e621..59d6b22 100644
--- a/StarterNG.Tests/MouseReadingTests.cs
+++ b/StarterNG.Tests/MouseReadingTests.cs
@@ -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()
{
diff --git a/StarterNG.Tests/ReadableSliderTests.cs b/StarterNG.Tests/ReadableSliderTests.cs
index 5445206..dc16966 100644
--- a/StarterNG.Tests/ReadableSliderTests.cs
+++ b/StarterNG.Tests/ReadableSliderTests.cs
@@ -7,6 +7,7 @@ using StarterNG.Controls;
namespace StarterNG.Tests;
+[Collection(AvaloniaControls.Name)]
public class ReadableSliderTests
{
[Fact]
diff --git a/StarterNG.Tests/ScreenReaderNamesTests.cs b/StarterNG.Tests/ScreenReaderNamesTests.cs
index 8b1a74f..af79220 100644
--- a/StarterNG.Tests/ScreenReaderNamesTests.cs
+++ b/StarterNG.Tests/ScreenReaderNamesTests.cs
@@ -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]
diff --git a/StarterNG/Controls/ScreenReaderNames.cs b/StarterNG/Controls/ScreenReaderNames.cs
index d05cbd4..5da6080 100644
--- a/StarterNG/Controls/ScreenReaderNames.cs
+++ b/StarterNG/Controls/ScreenReaderNames.cs
@@ -166,7 +166,7 @@ public static class ScreenReaderNames
private const int PictureReach = 3;
///
- /// Names a picture after the button or card it lies in. Under the mouse a reader
+ /// Names a picture after the caption beside it or the button or card it lies in. Under the mouse a reader
/// hears what lies there, and a bare picture said nothing: a vehicle in the consist,
/// the logo, an icon on a button.
///
@@ -176,6 +176,14 @@ public static class ScreenReaderNames
|| AutomationProperties.GetLabeledBy(picture) is not null)
return;
+ // A caption beside it says what it shows, such as a vehicle class by its picture.
+ if (picture.Parent is Panel row
+ && row.Children.OfType().FirstOrDefault(t => t.IsVisible && !string.IsNullOrWhiteSpace(t.Text)) is { } caption)
+ {
+ AutomationProperties.SetLabeledBy(picture, caption);
+ return;
+ }
+
var holder = picture.Parent as Control;
for (int i = 0; i < PictureReach && holder is not null; i++, holder = holder.Parent as Control)
{
diff --git a/StarterNG/Views/Depot/VehicleBrowser.cs b/StarterNG/Views/Depot/VehicleBrowser.cs
index 8a4db4d..a2bc035 100644
--- a/StarterNG/Views/Depot/VehicleBrowser.cs
+++ b/StarterNG/Views/Depot/VehicleBrowser.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Avalonia;
+using Avalonia.Automation;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using Avalonia.Input;
@@ -338,6 +339,7 @@ public sealed class VehicleBrowser
Selected = null;
miniPreview.Source = null;
+ miniPreview.ClearValue(AutomationProperties.NameProperty);
addVehicleButton.IsEnabled = false;
vehicleListBox.Items.Clear();
@@ -381,10 +383,12 @@ public sealed class VehicleBrowser
public void VehicleListBox_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
- if (vehicleListBox.SelectedItem is ListBoxItem { Tag: VehicleTexture texture })
+ if (vehicleListBox.SelectedItem is ListBoxItem { Tag: VehicleTexture texture } row)
{
Selected = texture;
miniPreview.Source = _minis.Get(_db.ResolveMiniName(texture), MiniPreviewHeight);
+ // Under the mouse a reader hears which vehicle the picture shows.
+ AutomationProperties.SetName(miniPreview, ScreenReaderNames.TextOf(row.Content));
addVehicleButton.IsEnabled = true;
SyncCombosTo(texture);
@@ -397,6 +401,7 @@ public sealed class VehicleBrowser
{
Selected = null;
miniPreview.Source = null;
+ miniPreview.ClearValue(AutomationProperties.NameProperty);
addVehicleButton.IsEnabled = false;
}
}
diff --git a/StarterNG/Views/Scenarios.axaml b/StarterNG/Views/Scenarios.axaml
index 9dbfb5d..23d536e 100644
--- a/StarterNG/Views/Scenarios.axaml
+++ b/StarterNG/Views/Scenarios.axaml
@@ -51,7 +51,7 @@
-
@@ -76,7 +76,7 @@
SelectionChanged="VehicleList_OnSelectionChanged" />
-
diff --git a/StarterNG/Views/Settings.axaml b/StarterNG/Views/Settings.axaml
index 15d8578..73fc382 100644
--- a/StarterNG/Views/Settings.axaml
+++ b/StarterNG/Views/Settings.axaml
@@ -69,7 +69,7 @@
Click="ExportIniButton_OnClick" />
-
diff --git a/StarterNG/Views/VehicleBaseWindow.axaml b/StarterNG/Views/VehicleBaseWindow.axaml
index 900bede..3300946 100644
--- a/StarterNG/Views/VehicleBaseWindow.axaml
+++ b/StarterNG/Views/VehicleBaseWindow.axaml
@@ -77,7 +77,7 @@
-
@@ -97,7 +97,7 @@
-
+
diff --git a/StarterNG/Views/VehicleBaseWindow.axaml.cs b/StarterNG/Views/VehicleBaseWindow.axaml.cs
index 28eb0b9..ae632ef 100644
--- a/StarterNG/Views/VehicleBaseWindow.axaml.cs
+++ b/StarterNG/Views/VehicleBaseWindow.axaml.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Avalonia.Automation;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
@@ -180,6 +181,7 @@ public partial class VehicleBaseWindow : Window
if (row is null)
{
preview.Source = null;
+ preview.ClearValue(AutomationProperties.NameProperty);
detailTitle.Text = "";
detailText.Text = App.Loc["TextureBasePick"];
ToolTip.SetTip(detailText, null);
@@ -188,6 +190,7 @@ public partial class VehicleBaseWindow : Window
preview.Source = _minis.Get(_db.ResolveMiniName(row.Texture), PreviewHeight);
detailTitle.Text = string.Join(" · ", new[] { row.Skin, row.Class, row.Operator }.Where(s => s.Length > 0));
+ AutomationProperties.SetName(preview, detailTitle.Text);
var lines = new[]
{
diff --git a/StarterNG/startercfg/lang/cz.xml b/StarterNG/startercfg/lang/cz.xml
index 4b96d3f..cdd5ada 100644
--- a/StarterNG/startercfg/lang/cz.xml
+++ b/StarterNG/startercfg/lang/cz.xml
@@ -568,6 +568,8 @@
rozbaleno
sbaleno
Obrázek scenérie
+ Oddělovač panelů
+ Kategorie nastavení
Nastavení se nepodařilo uložit
Neuložené změny
diff --git a/StarterNG/startercfg/lang/en.xml b/StarterNG/startercfg/lang/en.xml
index 4bae708..3bd1561 100644
--- a/StarterNG/startercfg/lang/en.xml
+++ b/StarterNG/startercfg/lang/en.xml
@@ -594,6 +594,8 @@
expanded
collapsed
Scenery picture
+ Panel divider
+ Settings categories
Could not save the settings
Unsaved changes
diff --git a/StarterNG/startercfg/lang/hu.xml b/StarterNG/startercfg/lang/hu.xml
index f2cb9cb..c2102a7 100644
--- a/StarterNG/startercfg/lang/hu.xml
+++ b/StarterNG/startercfg/lang/hu.xml
@@ -568,6 +568,8 @@
kibontva
összecsukva
A pálya képe
+ Panelelválasztó
+ Beállítási kategóriák
A beállításokat nem sikerült elmenteni
Nem mentett módosítások
diff --git a/StarterNG/startercfg/lang/pl.xml b/StarterNG/startercfg/lang/pl.xml
index e291c6e..6b21ccd 100644
--- a/StarterNG/startercfg/lang/pl.xml
+++ b/StarterNG/startercfg/lang/pl.xml
@@ -594,6 +594,8 @@
rozwinięte
zwinięte
Obraz scenerii
+ Rozdzielacz paneli
+ Kategorie ustawień
Nie udało się zapisać ustawień
Niezapisane zmiany
diff --git a/StarterNG/startercfg/lang/ru.xml b/StarterNG/startercfg/lang/ru.xml
index ca7a0a7..4429b5b 100644
--- a/StarterNG/startercfg/lang/ru.xml
+++ b/StarterNG/startercfg/lang/ru.xml
@@ -568,6 +568,8 @@
развёрнуто
свёрнуто
Изображение сценерии
+ Разделитель панелей
+ Категории настроек
Не удалось сохранить настройки
Несохранённые изменения