From 0acc9c9f4dfd15eb6e2ccf7051f359590f37617a Mon Sep 17 00:00:00 2001 From: rabbitism Date: Fri, 29 Nov 2024 21:40:50 +0800 Subject: [PATCH] fix: fix various nullable issue. --- src/Ursa/Controls/DateTimePicker/DateTimePicker.cs | 2 +- src/Ursa/Controls/DateTimePicker/TimePicker.cs | 2 +- src/Ursa/Controls/DateTimePicker/TimeRangePicker.cs | 2 +- .../Controls/FormTests/Dynamic_Item_Generation/Test.cs | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Ursa/Controls/DateTimePicker/DateTimePicker.cs b/src/Ursa/Controls/DateTimePicker/DateTimePicker.cs index 6c528440..43fafbb6 100644 --- a/src/Ursa/Controls/DateTimePicker/DateTimePicker.cs +++ b/src/Ursa/Controls/DateTimePicker/DateTimePicker.cs @@ -140,7 +140,7 @@ private void OnDateSelected(object? sender, CalendarDayButtonEventArgs e) } } - private void OnTimeSelectedChanged(object sender, TimeChangedEventArgs e) + private void OnTimeSelectedChanged(object? sender, TimeChangedEventArgs e) { if (SelectedDate is null) { diff --git a/src/Ursa/Controls/DateTimePicker/TimePicker.cs b/src/Ursa/Controls/DateTimePicker/TimePicker.cs index 5528bdb3..3eee8f76 100644 --- a/src/Ursa/Controls/DateTimePicker/TimePicker.cs +++ b/src/Ursa/Controls/DateTimePicker/TimePicker.cs @@ -93,7 +93,7 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e) SyncTimeToText(SelectedTime); } - private void OnPresenterTimeChanged(object sender, TimeChangedEventArgs e) + private void OnPresenterTimeChanged(object? sender, TimeChangedEventArgs e) { if (_suppressTextPresenterEvent) return; SetCurrentValue(SelectedTimeProperty, e.NewTime); diff --git a/src/Ursa/Controls/DateTimePicker/TimeRangePicker.cs b/src/Ursa/Controls/DateTimePicker/TimeRangePicker.cs index fae812cb..ff0c7c01 100644 --- a/src/Ursa/Controls/DateTimePicker/TimeRangePicker.cs +++ b/src/Ursa/Controls/DateTimePicker/TimeRangePicker.cs @@ -156,7 +156,7 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e) SyncTimeToText(EndTime, false); } - private void OnPresenterTimeChanged(object sender, TimeChangedEventArgs e) + private void OnPresenterTimeChanged(object? sender, TimeChangedEventArgs e) { if (_suppressTextPresenterEvent) return; SetCurrentValue(Equals(sender, _startPresenter) ? StartTimeProperty : EndTimeProperty, e.NewTime); diff --git a/tests/HeadlessTest.Ursa/Controls/FormTests/Dynamic_Item_Generation/Test.cs b/tests/HeadlessTest.Ursa/Controls/FormTests/Dynamic_Item_Generation/Test.cs index ed0266ef..5566ed4d 100644 --- a/tests/HeadlessTest.Ursa/Controls/FormTests/Dynamic_Item_Generation/Test.cs +++ b/tests/HeadlessTest.Ursa/Controls/FormTests/Dynamic_Item_Generation/Test.cs @@ -26,6 +26,7 @@ public void FormItem_Generation() window.Show(); var form = window.FindControl
("Form"); + Assert.NotNull(form); var logicalChildren = form.GetLogicalChildren().ToList(); Assert.True(logicalChildren.All(a=>a is FormItem)); Assert.IsType(logicalChildren[0].LogicalChildren[0]); @@ -65,6 +66,7 @@ public void FormGroup_Generation() window.Show(); var form = window.FindControl("Form"); + Assert.NotNull(form); var logicalChildren = form.GetLogicalChildren().ToList(); Assert.True(logicalChildren.All(a=>a is FormGroup)); var formGroup = (FormGroup)logicalChildren[0]; @@ -108,6 +110,7 @@ public void Mixture_Generation() window.Show(); var form = window.FindControl("Form"); + Assert.NotNull(form); var logicalChildren = form.GetLogicalChildren().ToList(); Assert.True(logicalChildren.All(a=>a is FormItem || a is FormGroup)); Assert.IsType(logicalChildren[0].LogicalChildren[0]);