-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Windows] - Picker on windows shows "Microsoft.Maui.Controls.Picker" …
…if ItemsSource has an empty string (#24276) * fix-8845-Picker on windows shows "Microsoft.Maui.Controls.Picker" if ItemsSource has an empty string * Added image for test case * Updated Script file * Modified test case * modified test case * Modified test case * Modified test case * Modified test case * Modified code changes
- Loading branch information
1 parent
4c66e4a
commit f86bf47
Showing
4 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/Controls/tests/TestCases.HostApp/Issues/Issues8845.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
Title="Issue 8845" | ||
x:Class="Maui.Controls.Sample.Issues.Issue8845"> | ||
|
||
<VerticalStackLayout> | ||
<Picker AutomationId="MauiPicker1" x:Name="picker1" ItemDisplayBinding="{Binding DisplayName}"/> | ||
<Picker AutomationId="MauiPicker2" x:Name="picker2" ItemDisplayBinding="{Binding DisplayName}"/> | ||
<Button AutomationId="UpdateButton" Text="Update" Clicked="Button_Clicked"/> | ||
</VerticalStackLayout> | ||
|
||
</ContentPage> |
29 changes: 29 additions & 0 deletions
29
src/Controls/tests/TestCases.HostApp/Issues/Issues8845.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Xaml; | ||
|
||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
[Issue(IssueTracker.Github, 8845, "Picker on windows shows \"Microsoft.Maui.Controls.Picker\" if ItemsSource has an empty string", PlatformAffected.UWP)] | ||
public partial class Issue8845 : ContentPage | ||
{ | ||
public Issue8845() | ||
{ | ||
InitializeComponent(); | ||
var items = new List<object> | ||
{ | ||
new { DisplayName = (string)null!}, | ||
new { DisplayName = "Not null"}, | ||
}; | ||
picker1.ItemsSource = items; | ||
picker2.ItemsSource = items; | ||
} | ||
|
||
private void Button_Clicked(object sender, EventArgs e) | ||
{ | ||
picker1.SelectedIndex = 0; | ||
picker2.SelectedIndex = 1; | ||
} | ||
|
||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8845.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues | ||
{ | ||
public class Issue8845 : _IssuesUITest | ||
{ | ||
public Issue8845(TestDevice testDevice) : base(testDevice) | ||
{ | ||
} | ||
|
||
public override string Issue => "Picker on windows shows \"Microsoft.Maui.Controls.Picker\" if ItemsSource has an empty string"; | ||
|
||
[Test] | ||
[Category(UITestCategories.Picker)] | ||
public void PickerShouldDisplayValueFromItemDisplayBinding() | ||
{ | ||
App.WaitForElement("UpdateButton"); | ||
App.Tap("UpdateButton"); | ||
|
||
var picker1Text = App.WaitForElement("MauiPicker1").GetText(); | ||
var picker2Text = App.WaitForElement("MauiPicker2").GetText(); | ||
|
||
Assert.That(picker1Text, Is.Empty); | ||
Assert.That(picker2Text, Is.EqualTo("Not null")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters