From 37a753ffd9a5bcaaa48c0632d73b66e4acd72cc8 Mon Sep 17 00:00:00 2001 From: Ramez Ragaa Date: Thu, 25 Apr 2024 11:44:05 +0200 Subject: [PATCH] chore: adjust When_Text_Changed_Sequence --- .../Given_AutoSuggestBox.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_AutoSuggestBox.cs b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_AutoSuggestBox.cs index 20d8c6d64a1c..79c0b6a19d6d 100644 --- a/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_AutoSuggestBox.cs +++ b/src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_AutoSuggestBox.cs @@ -316,7 +316,11 @@ public async Task When_Text_Changed_Sequence(bool waitBetweenActions) expectations.Add(UserInput); SUT.Focus(FocusState.Programmatic); +#if __SKIA__ + KeyboardHelper.InputText("manual"); +#else textBox.ProcessTextInput("manual"); +#endif await Wait(); expectations.Add(SuggestionChosen); @@ -325,7 +329,11 @@ public async Task When_Text_Changed_Sequence(bool waitBetweenActions) expectations.Add(UserInput); SUT.Focus(FocusState.Programmatic); +#if __SKIA__ // We want to test the behaviour of "typing individual characters in sequence", not setting the Text in one shot. The behaviour is currently only accurate on skia. + KeyboardHelper.InputText("manual"); +#else textBox.ProcessTextInput("manual"); +#endif await Wait(); expectations.Add(ProgrammaticChange); @@ -339,14 +347,14 @@ public async Task When_Text_Changed_Sequence(bool waitBetweenActions) await WindowHelper.WaitForIdle(); -#if __SKIA__ - // skia is closer to what happens on WinUI. On WinUI, if there is no delay between changes, - // AutoSuggestBox.TextChanged is fired once (but TextBox.TextChanged fires everytime) +#if __SKIA__ // We want to test the behaviour of "typing individual characters in sequence", not setting the Text in one shot. The behaviour is currently only accurate on skia. if (!waitBetweenActions) +#endif { + // skia is closer to what happens on WinUI. On WinUI, if there is no delay between changes, + // AutoSuggestBox.TextChanged is fired once (but TextBox.TextChanged fires everytime) expectations = new() { SuggestionChosen }; } -#endif CollectionAssert.AreEquivalent(expectations, reasons, string.Join("; ", $"expectations[{expectations.Count}]: {string.Join(",", expectations)}",