mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-16 21:14:10 +01:00
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.
28 lines
743 B
C#
28 lines
743 B
C#
using Avalonia;
|
|
using Avalonia.Headless;
|
|
|
|
namespace StarterNG.Tests;
|
|
|
|
/// <summary>
|
|
/// Text and drawing for tests of controls that draw themselves: the headless platform
|
|
/// with its stand-in fonts, set up once, on the thread the control tests run on.
|
|
/// </summary>
|
|
public static class HeadlessDrawing
|
|
{
|
|
private static readonly object Gate = new();
|
|
private static bool _ready;
|
|
|
|
public static void Ensure()
|
|
{
|
|
lock (Gate)
|
|
{
|
|
if (_ready)
|
|
return;
|
|
AppBuilder.Configure<Avalonia.Application>()
|
|
.UseHeadless(new AvaloniaHeadlessPlatformOptions { UseHeadlessDrawing = true })
|
|
.SetupWithoutStarting();
|
|
_ready = true;
|
|
}
|
|
}
|
|
}
|