From cd058ca86e3586992897069ace2373851ee03ded Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Wed, 20 Dec 2023 12:54:27 +0200 Subject: [PATCH] fix: Fix WaitForIdle to really wait for "Idle" --- .../Engine/UI/UnitTestsUIContentHelper.cs | 4 ++-- .../Engine/UI/_Private/UnitTestDispatcherCompat.cs | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/UnitTestsUIContentHelper.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/UnitTestsUIContentHelper.cs index 1790eb0..c9b5cbc 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/UnitTestsUIContentHelper.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/UnitTestsUIContentHelper.cs @@ -111,8 +111,8 @@ internal set /// public static async Task WaitForIdle() { - await RootElementDispatcher.RunAsync(UnitTestDispatcherCompat.Priority.Low, () => { }); - await RootElementDispatcher.RunAsync(UnitTestDispatcherCompat.Priority.Low, () => { }); + await RootElementDispatcher.RunAsync(UnitTestDispatcherCompat.Priority.Idle, () => { }); + await RootElementDispatcher.RunAsync(UnitTestDispatcherCompat.Priority.Idle, () => { }); } /// diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/_Private/UnitTestDispatcherCompat.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/_Private/UnitTestDispatcherCompat.cs index 76434a0..564210d 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/_Private/UnitTestDispatcherCompat.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/UI/_Private/UnitTestDispatcherCompat.cs @@ -31,12 +31,11 @@ namespace Uno.UI.RuntimeTests.Internal.Helpers; public partial class UnitTestDispatcherCompat { - public enum Priority { Low = -1, Normal = 0, High = 1 } + public enum Priority { Idle = -2, Low = -1, Normal = 0, High = 1 } private static _Priority RemapPriority(Priority priority) => priority switch { - // [uwp] Windows.UI.Core.CoreDispatcherPriority::Idle doesnt have a counterpart, and is thus ignored. - + Priority.Idle => _Priority.Idle, Priority.Low => _Priority.Low, Priority.Normal => _Priority.Normal, Priority.High => _Priority.High,