File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
tests/ByteSync.Client.IntegrationTests/TestHelpers Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -14,28 +14,27 @@ namespace ByteSync.Client.IntegrationTests.TestHelpers;
1414public abstract class HeadlessIntegrationTest : IntegrationTest
1515{
1616 private static bool _initialized ;
17+ private static readonly object _setupLock = new object ( ) ;
1718 // No need for a running lifetime; we will pump UI jobs manually
1819
1920 [ OneTimeSetUp ]
2021 public static void GlobalSetup ( )
2122 {
22- if ( _initialized )
23+ if ( _initialized ) return ;
24+
25+ lock ( _setupLock )
2326 {
24- return ;
25- }
27+ if ( _initialized ) return ;
2628
27- AppBuilder . Configure < TestApp > ( )
28- . UseHeadless ( new AvaloniaHeadlessPlatformOptions ( ) )
29- . SetupWithoutStarting ( ) ;
29+ AppBuilder . Configure < TestApp > ( )
30+ . UseHeadless ( new AvaloniaHeadlessPlatformOptions ( ) )
31+ . SetupWithoutStarting ( ) ;
3032
31- _initialized = true ;
33+ _initialized = true ;
34+ }
3235 }
3336
34- [ OneTimeTearDown ]
35- public static void GlobalTeardown ( )
36- {
37- _initialized = false ;
38- }
37+ // Do not tear down headless AppBuilder; Avalonia only supports setup once per process
3938
4039 protected Task ExecuteOnUiThread ( Func < Task > action )
4140 {
You can’t perform that action at this time.
0 commit comments