test: own Avalonia application session

This commit is contained in:
Erik 2026-08-18 13:41:23 +02:00
parent 631ecd24e3
commit 088add2fac
2 changed files with 94 additions and 11 deletions

View file

@ -2,6 +2,7 @@ using Avalonia;
using Avalonia.Headless;
[assembly: AvaloniaTestApplication(typeof(AcDream.Launcher.Tests.TestAppBuilder))]
[assembly: AvaloniaTestIsolation(AvaloniaTestIsolationLevel.PerAssembly)]
namespace AcDream.Launcher.Tests;
@ -12,6 +13,11 @@ namespace AcDream.Launcher.Tests;
/// live for every test — <see cref="MainWindow"/>'s controls (TreeView,
/// Button, TextBox, ...) need a real control theme to template and focus
/// correctly, not just an unstyled visual tree.
/// The assembly contains one Avalonia test that owns the complete window
/// matrix. Keep one application/dispatcher for that process: Avalonia 12's
/// per-test teardown can recreate the compositor after its render loop has
/// become owned by a different worker, producing a thread-affinity cleanup
/// failure after an otherwise passing test.
/// </summary>
public static class TestAppBuilder
{