Browse Source

Update DatePicker and TimePicker unit tests

pull/8793/head
robloo 4 years ago
parent
commit
13b67defef
  1. 26
      tests/Avalonia.Controls.UnitTests/DatePickerTests.cs
  2. 20
      tests/Avalonia.Controls.UnitTests/TimePickerTests.cs

26
tests/Avalonia.Controls.UnitTests/DatePickerTests.cs

@ -55,7 +55,7 @@ namespace Avalonia.Controls.UnitTests
for(int i = 0; i < container.Children.Count; i++)
{
if(container.Children[i] is TextBlock tb && tb.Name == "DayText")
if(container.Children[i] is TextBlock tb && tb.Name == "PART_DayTextBlock")
{
dayText = tb;
break;
@ -93,7 +93,7 @@ namespace Avalonia.Controls.UnitTests
for (int i = 0; i < container.Children.Count; i++)
{
if (container.Children[i] is TextBlock tb && tb.Name == "MonthText")
if (container.Children[i] is TextBlock tb && tb.Name == "PART_MonthTextBlock")
{
monthText = tb;
break;
@ -131,7 +131,7 @@ namespace Avalonia.Controls.UnitTests
for (int i = 0; i < container.Children.Count; i++)
{
if (container.Children[i] is TextBlock tb && tb.Name == "YearText")
if (container.Children[i] is TextBlock tb && tb.Name == "PART_YearTextBlock")
{
yearText = tb;
break;
@ -171,15 +171,15 @@ namespace Avalonia.Controls.UnitTests
for (int i = 0; i < container.Children.Count; i++)
{
if (container.Children[i] is TextBlock tb && tb.Name == "YearText")
if (container.Children[i] is TextBlock tb && tb.Name == "PART_YearTextBlock")
{
yearText = tb;
}
else if (container.Children[i] is TextBlock tb1 && tb1.Name == "MonthText")
else if (container.Children[i] is TextBlock tb1 && tb1.Name == "PART_MonthTextBlock")
{
monthText = tb1;
}
else if (container.Children[i] is TextBlock tb2 && tb2.Name == "DayText")
else if (container.Children[i] is TextBlock tb2 && tb2.Name == "PART_DayTextBlock")
{
dayText = tb2;
}
@ -218,31 +218,31 @@ namespace Avalonia.Controls.UnitTests
//Skip contentpresenter
var flyoutButton = new Button
{
Name = "FlyoutButton"
Name = "PART_FlyoutButton"
}.RegisterInNameScope(scope);
var contentGrid = new Grid
{
Name = "ButtonContentGrid"
Name = "PART_ButtonContentGrid"
}.RegisterInNameScope(scope);
var dayText = new TextBlock
{
Name = "DayText"
Name = "PART_DayTextBlock"
}.RegisterInNameScope(scope);
var monthText = new TextBlock
{
Name = "MonthText"
Name = "PART_MonthTextBlock"
}.RegisterInNameScope(scope);
var yearText = new TextBlock
{
Name = "YearText"
Name = "PART_YearTextBlock"
}.RegisterInNameScope(scope);
var firstSpacer = new Rectangle
{
Name = "FirstSpacer"
Name = "PART_FirstSpacer"
}.RegisterInNameScope(scope);
var secondSpacer = new Rectangle
{
Name = "SecondSpacer"
Name = "PART_SecondSpacer"
}.RegisterInNameScope(scope);
contentGrid.Children.AddRange(new IControl[] { dayText, monthText, yearText, firstSpacer, secondSpacer });

20
tests/Avalonia.Controls.UnitTests/TimePickerTests.cs

@ -114,52 +114,52 @@ namespace Avalonia.Controls.UnitTests
//Skip contentpresenter
var flyoutButton = new Button
{
Name = "FlyoutButton"
Name = "PART_FlyoutButton"
}.RegisterInNameScope(scope);
var contentGrid = new Grid
{
Name = "FlyoutButtonContentGrid"
Name = "PART_FlyoutButtonContentGrid"
}.RegisterInNameScope(scope);
var firstPickerHost = new Border
{
Name = "FirstPickerHost",
Name = "PART_FirstPickerHost",
Child = new TextBlock
{
Name = "HourTextBlock"
Name = "PART_HourTextBlock"
}.RegisterInNameScope(scope)
}.RegisterInNameScope(scope);
Grid.SetColumn(firstPickerHost, 0);
var secondPickerHost = new Border
{
Name = "SecondPickerHost",
Name = "PART_SecondPickerHost",
Child = new TextBlock
{
Name = "MinuteTextBlock"
Name = "PART_MinuteTextBlock"
}.RegisterInNameScope(scope)
}.RegisterInNameScope(scope);
Grid.SetColumn(secondPickerHost, 2);
var thirdPickerHost = new Border
{
Name = "ThirdPickerHost",
Name = "PART_ThirdPickerHost",
Child = new TextBlock
{
Name = "PeriodTextBlock"
Name = "PART_PeriodTextBlock"
}.RegisterInNameScope(scope)
}.RegisterInNameScope(scope);
Grid.SetColumn(thirdPickerHost, 4);
var firstSpacer = new Rectangle
{
Name = "FirstColumnDivider"
Name = "PART_FirstColumnDivider"
}.RegisterInNameScope(scope);
Grid.SetColumn(firstSpacer, 1);
var secondSpacer = new Rectangle
{
Name = "SecondColumnDivider"
Name = "PART_SecondColumnDivider"
}.RegisterInNameScope(scope);
Grid.SetColumn(secondSpacer, 3);

Loading…
Cancel
Save