Browse Source

clear dispatcher queue at the end of tests.

pull/10552/head
Dan Walmsley 4 years ago
parent
commit
a298ff55f9
  1. 7
      tests/Avalonia.RenderTests/TestBase.cs
  2. 2
      tests/Avalonia.UnitTests/TestWithServicesBase.cs
  3. 1
      tests/Avalonia.UnitTests/UnitTestApplication.cs

7
tests/Avalonia.RenderTests/TestBase.cs

@ -31,7 +31,7 @@ namespace Avalonia.Skia.RenderTests
namespace Avalonia.Direct2D1.RenderTests
#endif
{
public class TestBase
public class TestBase : IDisposable
{
#if AVALONIA_SKIA
private static string s_fontUri = "resm:Avalonia.Skia.RenderTests.Assets?assembly=Avalonia.Skia.RenderTests#Noto Mono";
@ -282,5 +282,10 @@ namespace Avalonia.Direct2D1.RenderTests
});
}
}
public void Dispose()
{
Dispatcher.UIThread.RunJobs();
}
}
}

2
tests/Avalonia.UnitTests/TestWithServicesBase.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Avalonia.Threading;
namespace Avalonia.UnitTests
{
@ -17,6 +18,7 @@ namespace Avalonia.UnitTests
public void Dispose()
{
Dispatcher.UIThread.RunJobs();
_scope.Dispose();
}
}

1
tests/Avalonia.UnitTests/UnitTestApplication.cs

@ -46,6 +46,7 @@ namespace Avalonia.UnitTests
Dispatcher.UIThread.UpdateServices();
return Disposable.Create(() =>
{
Dispatcher.UIThread.RunJobs();
scope.Dispose();
Dispatcher.UIThread.UpdateServices();
});

Loading…
Cancel
Save