using Avalonia; using Avalonia.Headless; using DodoSSH.Client.App.Layout.Tests; [assembly: AvaloniaTestApplication(typeof(HeadlessApp))] namespace DodoSSH.Client.App.Layout.Tests; /// /// Builds the real application for a headless renderer. /// /// /// /// itself, not a stand-in, because the thing being measured is how the shipped /// styles lay out — a harness with its own theme would measure a window nobody sees. Its /// OnFrameworkInitializationCompleted only composes the object graph when the lifetime is a classic /// desktop one, and a headless session's is not, so loading it here brings the Fluent theme and the dark /// variant and starts no vault, no listener and no browser. /// /// /// Skia rather than the headless drawing stub, which is the one deliberate cost in this file. The stub's /// font manager returns invented glyph metrics, and text height is an input to every stacked panel in this /// window — measuring against it would produce numbers that are self-consistent and unrelated to the /// application. With Skia and the same Inter font the application registers, a measured height is the /// height a user gets. /// /// internal static class HeadlessApp { /// Found by name; is the contract. public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure() .UseSkia() .UseHeadless(new AvaloniaHeadlessPlatformOptions { UseHeadlessDrawing = false }) .WithInterFont(); }