DateField

This commit is contained in:
Tig
2024-08-20 13:26:25 -06:00
parent d1d7ab5fa8
commit c4404df312
2 changed files with 8 additions and 8 deletions

View File

@@ -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 ();
}

View File

@@ -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));