From 055565abf91eb2730a6e8d2c7b2158f31da9f3f8 Mon Sep 17 00:00:00 2001 From: Corvin Date: Wed, 21 Aug 2024 19:39:15 +0200 Subject: [PATCH] fixes #3654 set IsTabStop in to False in the default NumericUpDown control --- .../MaterialDesignTheme.NumericUpDown.xaml | 1 + .../WPF/NumericUpDowns/NumericUpDownTests.cs | 34 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml index b705ad673a..e957468a93 100644 --- a/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml +++ b/src/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.NumericUpDown.xaml @@ -30,6 +30,7 @@ + diff --git a/tests/MaterialDesignThemes.UITests/WPF/NumericUpDowns/NumericUpDownTests.cs b/tests/MaterialDesignThemes.UITests/WPF/NumericUpDowns/NumericUpDownTests.cs index 1378801259..c1d4c528cd 100644 --- a/tests/MaterialDesignThemes.UITests/WPF/NumericUpDowns/NumericUpDownTests.cs +++ b/tests/MaterialDesignThemes.UITests/WPF/NumericUpDowns/NumericUpDownTests.cs @@ -1,4 +1,6 @@ -namespace MaterialDesignThemes.UITests.WPF.NumericUpDowns; +using System.ComponentModel; + +namespace MaterialDesignThemes.UITests.WPF.NumericUpDowns; public class NumericUpDownTests(ITestOutputHelper output) : TestBase(output) { @@ -115,4 +117,34 @@ public async Task MaxAndMinAssignments_CoerceValueToBeInRange() Assert.Equal(3, await numericUpDown.GetMinimum()); Assert.Equal(3, await numericUpDown.GetMaximum()); } + + [Fact] + [Description("Issue 3654")] + public async Task NumericUpDown_InternalTextBoxIsFocused_WhenGettingKeyboardFocus() + { + await using var recorder = new TestRecorder(App); + + // Arrange + var stackPanel = await LoadXaml(""" + + + + + """); + + var textBox = await stackPanel.GetElement("/TextBox"); + var part_textBox = await stackPanel.GetElement("PART_TextBox"); + + // Act + await textBox.MoveKeyboardFocus(); + await Task.Delay(50); + await textBox.SendInput(new KeyboardInput(Key.Tab)); + await Task.Delay(50); + + // Assert + Assert.False(await textBox.GetIsFocused()); + Assert.True(await part_textBox.GetIsFocused()); + + recorder.Success(); + } }