Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving last Xamarin.UITests to Appium #25366

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8" ?>
<controls:TestContentPage
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:controls="clr-namespace:Maui.Controls.Sample.Issues"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Maui.Controls.Sample.Issues.Issue11381"
Title="Issue 11381">
<Grid RowDefinitions="Auto,Auto, *">
<Label
Grid.Row="0"
Padding="12"
BackgroundColor="Black"
TextColor="White"
Text="Tap on image with red background to remove a cell. Repeat for all cells. Without crash, the test has passed."/>
<Label
Grid.Row="1"
AutomationId="ResultId"
x:Name="ItemsCount"/>
<ListView
Grid.Row="2"
AutomationId="ListViewId"
x:Name="Issue11381ListView"
GroupDisplayBinding="{Binding LongName}"
GroupShortNameBinding="{Binding ShortName}"
HasUnevenRows="True"
IsGroupingEnabled="true">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout>
<Label
FontSize="Large"
Text="{Binding Name}" />
<Label
Text="{Binding Comment}" />
<Image
Aspect="AspectFit"
BackgroundColor="Red"
HeightRequest="40"
Source="https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE1Mu3b?ver=5c31" />
<StackLayout.GestureRecognizers>
<TapGestureRecognizer
Tapped="OnTapGestureRecognizerTapped" />
</StackLayout.GestureRecognizers>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</controls:TestContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using System.Collections.ObjectModel;

namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 11381, "[Bug] [iOS] NRE on grouped ListView when removing cells with gesture recognizers",
PlatformAffected.iOS)]
public partial class Issue11381 : TestContentPage
{
public Issue11381()
{
InitializeComponent();

grouped = new ObservableCollection<GroupedIssue11381Model>();

var g1Group = new GroupedIssue11381Model() { LongName = "Group1", ShortName = "g1" };
var g2Group = new GroupedIssue11381Model() { LongName = "Group2", ShortName = "g2" };

g1Group.Add(new Issue11381Model() { Name = "G1I1", IsReallyAVeggie = true, Comment = "Lorem ipsum dolor sit amet" });
g1Group.Add(new Issue11381Model() { Name = "G1I2", IsReallyAVeggie = false, Comment = "Lorem ipsum dolor sit amet" });
g1Group.Add(new Issue11381Model() { Name = "G1I3", IsReallyAVeggie = true, Comment = "Lorem ipsum dolor sit amet" });
g1Group.Add(new Issue11381Model() { Name = "G1I4", IsReallyAVeggie = true, Comment = "Lorem ipsum dolor sit amet" });

g2Group.Add(new Issue11381Model() { Name = "G2I1", IsReallyAVeggie = false, Comment = "Lorem ipsum dolor sit amet" });
g2Group.Add(new Issue11381Model() { Name = "G2I2", IsReallyAVeggie = false, Comment = "Lorem ipsum dolor sit amet" });

grouped.Add(g1Group);
grouped.Add(g2Group);

Issue11381ListView.ItemsSource = grouped;
}

public ObservableCollection<GroupedIssue11381Model> grouped { get; set; }

protected override void Init()
{

}
void OnTapGestureRecognizerTapped(object sender, EventArgs e)
{
if (sender is View view && view.BindingContext is Issue11381Model model)
{
var group = grouped.FirstOrDefault(g => g.Contains(model));

if (group != null)
{
group.Remove(model);

if (!group.Any())
{
grouped.Remove(group);
}

ItemsCount.Text = $"{grouped.Count} groups";
}
}
}
}

public class Issue11381Model
{
public string Name { get; set; }
public string Comment { get; set; }
public bool IsReallyAVeggie { get; set; }
public string Image { get; set; }
}
public class GroupedIssue11381Model : ObservableCollection<Issue11381Model>
{
public string LongName { get; set; }
public string ShortName { get; set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8" ?>
<controls:TestShell
x:Class="Maui.Controls.Sample.Issues.Issue12429"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:controls="clr-namespace:Maui.Controls.Sample.Issues"
xmlns:local="clr-namespace:Maui.Controls.Sample.Issues">
<FlyoutItem>
<Shell.ItemTemplate>
<DataTemplate>
<StackLayout Orientation="Horizontal" AutomationId="SmallFlyoutItem" Spacing="0" HeightRequest="{Binding BindingContext.SmallFlyoutItem}" BackgroundColor="LightBlue" >
<Label Text="I'm set to specific height: " TextColor="White" />
<Label Text="{Binding BindingContext.SmallFlyoutItem}" TextColor="White" />
</StackLayout>
</DataTemplate>
</Shell.ItemTemplate>
<ShellContent>
<local:Issue12429Page />
</ShellContent>
</FlyoutItem>
<FlyoutItem>
<Shell.ItemTemplate>
<DataTemplate>
<StackLayout IsVisible="False" BackgroundColor="Black" >
<Label Text="Not Visible" />
</StackLayout>
</DataTemplate>
</Shell.ItemTemplate>
<ShellContent>
<local:Issue12429Page />
</ShellContent>
</FlyoutItem>
<FlyoutItem>
<Shell.ItemTemplate>
<DataTemplate>
<StackLayout BackgroundColor="Purple">
<Label Text="I'm sized to my layout" />
</StackLayout>
</DataTemplate>
</Shell.ItemTemplate>
<ShellContent>
<local:Issue12429Page />
</ShellContent>
</FlyoutItem>
<FlyoutItem>
<Shell.ItemTemplate>
<DataTemplate>
<StackLayout AutomationId="ResizeMe" BackgroundColor="LightGray" HeightRequest="120">
<Button AutomationId="ResizeFlyoutItem" Text="Grow Me" Clicked="ResizeFlyoutItem" />
<Button AutomationId="ResizeFlyoutItemDown" Text="Shrink Me" Clicked="ResizeFlyoutItemDown" />
</StackLayout>
</DataTemplate>
</Shell.ItemTemplate>
<ShellContent>
<local:Issue12429Page />
</ShellContent>
</FlyoutItem>
<FlyoutItem Title="Default Flyout Item. Height is 44 on iOS and UWP. Height is 50 on Android)">
<ShellContent>
<local:Issue12429Page />
</ShellContent>
</FlyoutItem>
</controls:TestShell>
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 12429, "[Bug] Shell flyout items have a minimum height", PlatformAffected.iOS)]
public partial class Issue12429 : TestShell
{
public double SmallFlyoutItem { get; }
public double SizeToModifyBy { get; }

public Issue12429()
{
SmallFlyoutItem = 35d;
SizeToModifyBy = 20d;

InitializeComponent();

// TODO: make this work
//if (DeviceInfo.Platform == DevicePlatform.Android)
// SmallFlyoutItem = SmallFlyoutItem / DeviceDisplay.MainDisplayInfo.Density;

//if (DeviceInfo.Platform == DevicePlatform.Android)
// SizeToModifyBy = SizeToModifyBy / DeviceDisplay.MainDisplayInfo.Density;

this.BindingContext = this;
}

protected override void Init()
{
}

void ResizeFlyoutItem(System.Object sender, System.EventArgs e)
{
((sender as Element).Parent as VisualElement).HeightRequest += SizeToModifyBy;
}

void ResizeFlyoutItemDown(System.Object sender, System.EventArgs e)
{
((sender as Element).Parent as VisualElement).HeightRequest -= SizeToModifyBy;
}
}

public class Issue12429Page : ContentPage
{
public Issue12429Page()
{
Background = SolidColorBrush.White;
var label = new Label
{
Text = "Flyout Item 1: Explicit Height of 35, Flyout Item 2: will grow and shrink when you click the buttons, Flyout Item 3: doesn't exist, and Flyout Item 4: uses the default platform sizes.",
VerticalTextAlignment = TextAlignment.Center,
TextColor = Colors.Black,
AutomationId = "PageLoaded"
};

Content = new StackLayout()
{
Children =
{
new Label
{
Text = "Flyout Item 1: Explicit Height of 35.",
VerticalTextAlignment = TextAlignment.Center,
TextColor = Colors.Black,
AutomationId = "PageLoaded"
},
new Label
{
Text = "Flyout Item 2: Height sizes to the content.",
VerticalTextAlignment = TextAlignment.Center,
TextColor = Colors.Black
},
new Label
{
Text = "Flyout Item 3: will grow and shrink when you click the buttons.",
VerticalTextAlignment = TextAlignment.Center,
TextColor = Colors.Black
},
new Label
{
Text = "Flyout Item 4: doesn't exist. You should only see 4 Flyout Items",
VerticalTextAlignment = TextAlignment.Center,
TextColor = Colors.Black
},
new Label
{
Text = "Flyout Item 5: uses the default height if no templates are used.",
VerticalTextAlignment = TextAlignment.Center,
TextColor = Colors.Black
}
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8" ?>
<controls:TestContentPage x:Class="Maui.Controls.Sample.Issues.Issue1455"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls"
xmlns:controls="clr-namespace:Maui.Controls.Sample.Issues"
xmlns:d="http://schemas.microsoft.com/dotnet/2021/maui/design"
xmlns:local="clr-namespace:Maui.Controls.Sample.Issues"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="Issue1455Page"
mc:Ignorable="d">
<controls:TestContentPage.Resources>
<ResourceDictionary>
<DataTemplate x:Key="Temp1">
<ViewCell android:ViewCell.IsContextActionsLegacyModeEnabled="{Binding BindingContext.IsContextActionsLegacyModeEnabled, Source={x:Reference Issue1455Page}}}">
<ViewCell.ContextActions>
<MenuItem Text="{Binding Item1Text}" />
<MenuItem Text="{Binding Item2Text}" />
<MenuItem Text="{Binding Item3Text}" />
<MenuItem Text="{Binding Item4Text}" />
</ViewCell.ContextActions>
<Grid>
<Label Text="{Binding Text}" />
</Grid>
</ViewCell>
</DataTemplate>
<DataTemplate x:Key="Temp2">
<ViewCell android:ViewCell.IsContextActionsLegacyModeEnabled="{Binding BindingContext.IsContextActionsLegacyModeEnabled, Source={x:Reference Issue1455Page}}}">
<ViewCell.ContextActions>
<MenuItem Text="{Binding Item1Text}" />
<MenuItem Text="{Binding Item2Text}" />
</ViewCell.ContextActions>
<Grid>
<Label Text="{Binding Text}" />
</Grid>
</ViewCell>
</DataTemplate>

<local:Issue1455DataTemplateSelector x:Key="Issue1455DataTemplateSelector"
Temp1Template="{StaticResource Temp1}"
Temp2Template="{StaticResource Temp2}" />
</ResourceDictionary>
</controls:TestContentPage.Resources>
<controls:TestContentPage.ToolbarItems>
<ToolbarItem Command="{Binding ToggleLegacyMode}" Text="Toggle LegacyMode" />
</controls:TestContentPage.ToolbarItems>
<controls:TestContentPage.Content>
<ListView HorizontalOptions="FillAndExpand"
ItemTemplate="{StaticResource Issue1455DataTemplateSelector}"
ItemsSource="{Binding Items}"
VerticalOptions="FillAndExpand" />
</controls:TestContentPage.Content>
</controls:TestContentPage>
Loading