Skip to content

Commit

Permalink
chore: adjust When_Text_Changed_Sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
ramezgerges committed Apr 25, 2024
1 parent 0b3b53d commit 37a753f
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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)}",
Expand Down

0 comments on commit 37a753f

Please sign in to comment.