diff --git a/test/OpenSlideSharp.Viewer.Tests/SlideViewTests.cs b/test/OpenSlideSharp.Viewer.Tests/SlideViewTests.cs index 7e3cfd1..7cd3689 100644 --- a/test/OpenSlideSharp.Viewer.Tests/SlideViewTests.cs +++ b/test/OpenSlideSharp.Viewer.Tests/SlideViewTests.cs @@ -351,7 +351,9 @@ public void SlideView_SwitchSlide_DisposesOldLoader() TileLoader oldLoader = host.View.Loader!; TileCache oldCache = host.View.Cache!; TileBitmapCache oldBitmaps = host.View.Bitmaps!; - Assert.True(oldCache.Count > 0 && oldBitmaps.Count > 0); + // Bitmaps are made when a frame is drawn, which can come after the last tile has loaded. + HeadlessSession.PumpUntil(() => oldBitmaps.Count > 0, "a frame is drawn with the loaded tiles"); + Assert.True(oldCache.Count > 0); var key = new TileKey(0, 0, 0); Assert.True(oldCache.TryGet(key, out TileImage? tile)); Bitmap bitmap = oldBitmaps.Get(key, tile!)!;