forked from dotnet/maui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatePickerTests.Windows.cs
More file actions
43 lines (36 loc) · 1.47 KB
/
DatePickerTests.Windows.cs
File metadata and controls
43 lines (36 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.ComponentModel;
using System.Threading.Tasks;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Handlers;
using Microsoft.Maui.Platform;
using Microsoft.UI.Xaml.Controls;
using Xunit;
using WSolidColorBrush = Microsoft.UI.Xaml.Media.SolidColorBrush;
namespace Microsoft.Maui.DeviceTests;
public partial class DatePickerTests
{
[Fact]
[Description("The DatePicker Text and Icon Color should work properly on PointerOver")]
public async Task DatePickerTextAndIconColorShouldWorkProperlyOnPointerOver()
{
SetupBuilder();
var datePicker = new Controls.DatePicker
{
TextColor = Colors.Red
};
var expectedValue = datePicker.TextColor;
var handler = await CreateHandlerAsync<DatePickerHandler>(datePicker);
var platformView = GetPlatformControl(handler);
await InvokeOnMainThreadAsync(() =>
{
var foregroundPointerOverBrush = platformView.Resources["CalendarDatePickerTextForegroundPointerOver"] as WSolidColorBrush;
var foregroundPointerOverColor = foregroundPointerOverBrush.Color.ToColor();
Assert.Equal(expectedValue, foregroundPointerOverColor);
var glyphForegroundPointerOverBrush = platformView.Resources["CalendarDatePickerCalendarGlyphForegroundPointerOver"] as WSolidColorBrush;
var glyphForegroundPointerOverColor = glyphForegroundPointerOverBrush.Color.ToColor();
Assert.Equal(expectedValue, glyphForegroundPointerOverColor);
});
}
static CalendarDatePicker GetPlatformControl(DatePickerHandler handler) =>
handler.PlatformView;
}