diff --git a/UnitTests/Views/DatePickerTests.cs b/UnitTests/Views/DatePickerTests.cs index 00dc4bd13..0dded9a39 100644 --- a/UnitTests/Views/DatePickerTests.cs +++ b/UnitTests/Views/DatePickerTests.cs @@ -62,9 +62,9 @@ public class DatePickerTests Assert.True (Application.OnKeyDown (Key.Enter)); Assert.Equal (12, datePicker.Date.Month); - // Date should not change as next month button is disabled - Assert.False (Application.OnKeyDown (Key.Enter)); - Assert.Equal (12, datePicker.Date.Month); + // Date should change as next month button was disabled, causing focus to advance + Assert.True (Application.OnKeyDown (Key.Enter)); + Assert.Equal (11, datePicker.Date.Month); top.Dispose (); } @@ -72,7 +72,7 @@ public class DatePickerTests [AutoInitShutdown] public void DatePicker_ShouldNot_SetDateOutOfRange_UsingPreviousMonthButton () { - var date = new DateTime (1, 2, 15); + var date = new DateTime (1, 2, 0); var datePicker = new DatePicker (date); var top = new Toplevel (); @@ -88,8 +88,8 @@ public class DatePickerTests Assert.True (datePicker.NewKeyDownEvent (Key.Enter)); Assert.Equal (1, datePicker.Date.Month); - // Date should not change as previous month button is disabled - Assert.False (datePicker.NewKeyDownEvent (Key.Enter)); + // Previous month button is disabled, so focus advanced to edit field + Assert.True (datePicker.NewKeyDownEvent (Key.Enter)); Assert.Equal (1, datePicker.Date.Month); top.Dispose (); } diff --git a/UnitTests/Views/RadioGroupTests.cs b/UnitTests/Views/RadioGroupTests.cs index f965a7b28..2442eb98f 100644 --- a/UnitTests/Views/RadioGroupTests.cs +++ b/UnitTests/Views/RadioGroupTests.cs @@ -85,12 +85,12 @@ public class RadioGroupTests (ITestOutputHelper output) rg.SetFocus(); Assert.Equal(Orientation.Vertical, rg.Orientation); Assert.Equal(0, rg.SelectedItem); - Assert.True (Application.OnKeyDown (Key.CursorUp)); // Should not change (should focus prev if there was one) + Assert.False (Application.OnKeyDown (Key.CursorUp)); // Should not change (should focus prev view if there was one, which there isn't) Assert.Equal (0, rg.SelectedItem); Assert.True (Application.OnKeyDown (Key.CursorDown)); Assert.True (Application.OnKeyDown (Key.Space)); Assert.Equal (1, rg.SelectedItem); - Assert.True (Application.OnKeyDown (Key.CursorDown)); // Should not change (should focus prev if there was one) + Assert.False (Application.OnKeyDown (Key.CursorDown)); // Should not change (should focus prev view if there was one, which there isn't) Assert.True (Application.OnKeyDown (Key.Space)); Assert.Equal (1, rg.SelectedItem); Assert.True (Application.OnKeyDown (Key.Home));