Skip to content

Commit

Permalink
chore: Set the initial input device type to mouse in between tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Oct 4, 2024
1 parent 0c1d139 commit 58b0ae6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1047,10 +1047,15 @@ private static void CloseRemainingPopups()
private static void ResetLastInputDeviceType()
{
// Some tests inject keyboard input, which can then mean that subsequent tests will display
// system focus visuals which are unexpected. This resets the last input device type to touch.
// system focus visuals which are unexpected. This resets the last input device type to mouse.
// Mouse is to stay in line with WinUI integration tests, as some rely on the fact that on
// initial focus of a TextBox the last input device type is not touch (this device type does not
// select all text on initial focus, only on second tap of the input).
// If this is changed ComboBoxIntegrationTests.ValidateTextSubmittedHandledProperty will probably
// start to fail for example.
if (TestServices.WindowHelper.XamlRoot?.VisualTree?.ContentRoot?.InputManager is { } inputManager)
{
inputManager.LastInputDeviceType = Xaml.Input.InputDeviceType.Touch;
inputManager.LastInputDeviceType = Xaml.Input.InputDeviceType.Mouse;
}
}
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4614,7 +4614,6 @@ private async Task EnsureEditableTextBoxHasFocus(ComboBox comboBox)
{
TextBox textBox = null;
await RunOnUIThread(() =>
{
textBox = (TextBox)(TreeHelper.GetVisualChildByName(comboBox, "EditableText"));
VERIFY_IS_NOT_NULL(textBox);
Expand Down

0 comments on commit 58b0ae6

Please sign in to comment.