Skip to content

Commit cfda901

Browse files
committed
tests: editor WaitIdle also drains the thumbnail queue
1 parent 6c8e227 commit cfda901

3 files changed

Lines changed: 16 additions & 0 deletions

File tree

sources/editor/Stride.Core.Assets.Editor/Services/IThumbnailService.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public interface IThumbnailService : IDisposable
3333
/// <returns><c>True</c> if the asset type has static thumbnails, <c>False</c> otherwise.</returns>
3434
bool HasStaticThumbnail(Type assetType);
3535

36+
/// <summary>
37+
/// Gets the number of thumbnails currently queued for compilation.
38+
/// </summary>
39+
int PendingThumbnailCount { get; }
40+
3641
/// <summary>
3742
/// Raised when a thumbnail is successfully compiled.
3843
/// </summary>

sources/editor/Stride.Editor/Thumbnails/GameStudioThumbnailService.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ public static byte[] HandleBrokenThumbnail()
125125

126126
public event EventHandler<ThumbnailCompletedArgs> ThumbnailCompleted;
127127

128+
/// <inheritdoc/>
129+
public int PendingThumbnailCount { get { lock (hashLock) return thumbnailQueueHash.Count; } }
130+
128131
/// <inheritdoc/>
129132
public bool HasStaticThumbnail(Type assetType)
130133
{

sources/editor/Stride.GameStudio.AutoTesting/UITestHost.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@ public Task WaitForShaders() => WaitForQueueDrained("shader-compile", () =>
248248
return session?.ServiceProvider.TryGet<GameStudioBuilderService>()?.PendingShaderCompilationCount ?? 0;
249249
});
250250

251+
// Thumbnails build on a background queue; panel captures show blank tiles unless it is drained
252+
public Task WaitForThumbnails() => WaitForQueueDrained("thumbnails", () =>
253+
{
254+
var session = TryGetSession();
255+
return session?.ServiceProvider.TryGet<Stride.Core.Assets.Editor.Services.IThumbnailService>()?.PendingThumbnailCount ?? 0;
256+
});
257+
251258
public Task WaitDispatcherIdle()
252259
{
253260
var tcs = new TaskCompletionSource();
@@ -265,6 +272,7 @@ public async Task WaitIdle()
265272
{
266273
await WaitForAssetBuild();
267274
await WaitForShaders();
275+
await WaitForThumbnails();
268276
await WaitDispatcherIdle();
269277
await WaitFrames(1);
270278
await WaitForRendering();

0 commit comments

Comments
 (0)