From d39934b06b2ee987675ab1b8829c0bd83256ab56 Mon Sep 17 00:00:00 2001 From: IOL0ol1 <1353839731@qq.com> Date: Thu, 19 Nov 2026 20:51:46 +0800 Subject: [PATCH] test: wait for a drawn frame before checking the viewer's tile bitmaps The tiles can finish loading before the frame that turns them into bitmaps is drawn, so the slide-switch test failed now and then on Windows. --- test/OpenSlideSharp.Viewer.Tests/SlideViewTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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!)!;