Skip to content

Commit

Permalink
chore: Adjust KeyboardHelper usages to be awaited
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Sep 26, 2024
1 parent a9de120 commit eb0d211
Show file tree
Hide file tree
Showing 15 changed files with 348 additions and 348 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ public static async Task OpenComboBox(ComboBox comboBox, OpenMethod openMethod)
else if (openMethod == OpenMethod.Keyboard)
{
await FocusComboBoxIfNecessary(comboBox);
TestServices.KeyboardHelper.PressKeySequence(" ");
await TestServices.KeyboardHelper.PressKeySequence(" ");
}
else if (openMethod == OpenMethod.Gamepad)
{
await FocusComboBoxIfNecessary(comboBox);
CommonInputHelper.Accept(InputDevice.Gamepad);
await CommonInputHelper.Accept(InputDevice.Gamepad);
}
else if (openMethod == OpenMethod.Programmatic)
{
Expand Down Expand Up @@ -119,11 +119,11 @@ public static async Task CloseComboBox(ComboBox comboBox, CloseMethod closeMetho
}
else if (closeMethod == CloseMethod.Keyboard)
{
CommonInputHelper.Cancel(InputDevice.Keyboard);
await CommonInputHelper.Cancel(InputDevice.Keyboard);
}
else if (closeMethod == CloseMethod.Gamepad)
{
CommonInputHelper.Cancel(InputDevice.Gamepad);
await CommonInputHelper.Cancel(InputDevice.Gamepad);
}
else if (closeMethod == CloseMethod.Programmatic)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ await RunOnUIThread(() =>
AttachOpenedAndClosedHandlers(inlineAppBar, inlineOpenedEvent, inlineOpenedRegistration, inlineClosedEvent, inlineClosedRegistration);

LOG_OUTPUT("Pressing the CONTEXTMENU key opens the top and bottom AppBars only (and not the inline AppBar).");
KeyboardHelper.PressKeySequence(contextMenuKeySequence);
await KeyboardHelper.PressKeySequence(contextMenuKeySequence);
await topOpenedEvent.WaitForDefault();
await bottomOpenedEvent.WaitForDefault();
VERIFY_IS_FALSE(inlineOpenedEvent.HasFired());

LOG_OUTPUT("Pressing the CONTEXTMENU key closes the top and bottom AppBars only (and not the inline AppBar).");
KeyboardHelper.PressKeySequence(contextMenuKeySequence);
await KeyboardHelper.PressKeySequence(contextMenuKeySequence);
await topClosedEvent.WaitForDefault();
await bottomClosedEvent.WaitForDefault();
VERIFY_IS_FALSE(inlineClosedEvent.HasFired());
Expand Down Expand Up @@ -399,16 +399,16 @@ await RunOnUIThread(() =>
bottomExpandButton.Focus(FocusState.Programmatic);
});

KeyboardHelper.Tab();
await KeyboardHelper.Tab();
await WindowHelper.WaitForIdle();

LOG_OUTPUT("Try closing the non-sticky bottom AppBar using ESC key.");
KeyboardHelper.PressKeySequence(escapeKeySequence);
await KeyboardHelper.PressKeySequence(escapeKeySequence);
await bottomClosedEvent.WaitForDefault();


LOG_OUTPUT("Try closing the non-sticky inline Appbar using ESC key.");
KeyboardHelper.PressKeySequence(escapeKeySequence);
await KeyboardHelper.PressKeySequence(escapeKeySequence);
await inlineClosedEvent.WaitForDefault();

await RunOnUIThread(() =>
Expand Down Expand Up @@ -2188,7 +2188,7 @@ await CanCloseAppBarHelper(async (expectedHandledValue, appbar) =>
pageKeyDownEvent.Set();
});
CommonInputHelper.Cancel(device);
await CommonInputHelper.Cancel(device);
await pageKeyDownEvent.WaitForDefault();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,12 @@ await RunOnUIThread(() =>
await TestServices.WindowHelper.WaitForIdle();

// press enter to open flyout
TestServices.KeyboardHelper.Enter();
await TestServices.KeyboardHelper.Enter();

await helper.WaitForOpened();

// escape to close the flyout
TestServices.KeyboardHelper.Escape();
await TestServices.KeyboardHelper.Escape();

await TestServices.WindowHelper.WaitForIdle();
await helper.PrepareOpenedEvent();
Expand All @@ -259,12 +259,12 @@ await RunOnUIThread(() =>
await TestServices.WindowHelper.WaitForIdle();

// press space to open flyout
TestServices.KeyboardHelper.PressKeySequence("$d$_ #$u$_ ");
await TestServices.KeyboardHelper.PressKeySequence("$d$_ #$u$_ ");

await helper.WaitForOpened();

// escape to close the flyout
TestServices.KeyboardHelper.Escape();
await TestServices.KeyboardHelper.Escape();
await TestServices.WindowHelper.WaitForIdle();

styleDisposable?.Dispose();
Expand Down
Loading

0 comments on commit eb0d211

Please sign in to comment.