diff --git a/src/Controls/src/Core/Properties/AssemblyInfo.cs b/src/Controls/src/Core/Properties/AssemblyInfo.cs index c3b0facf1f6f..e255921fe828 100644 --- a/src/Controls/src/Core/Properties/AssemblyInfo.cs +++ b/src/Controls/src/Core/Properties/AssemblyInfo.cs @@ -54,6 +54,7 @@ [assembly: InternalsVisibleTo("CommunityToolkit.Maui.UnitTests")] [assembly: InternalsVisibleTo("CommunityToolkit.Maui.Markup")] [assembly: InternalsVisibleTo("CommunityToolkit.Maui.Markup.UnitTests")] +[assembly: InternalsVisibleTo("Controls.TestCases.HostApp")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] diff --git a/src/Controls/tests/TestCases.HostApp/Elements/ContactsPage.cs b/src/Controls/tests/TestCases.HostApp/Elements/ContactsPage.cs new file mode 100644 index 000000000000..595ae3eded02 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Elements/ContactsPage.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +public class ContactsPage : ContentPage +{ + public ContactsPage() + { + var listView = new ListView + { + ItemTemplate = new DataTemplate(() => + { + var cell = new TextCell(); + cell.SetBinding(TextCell.TextProperty, new Binding("Name")); + cell.SetBinding(TextCell.DetailProperty, new Binding("Number")); + return cell; + }), + IsGroupingEnabled = true, + GroupDisplayBinding = new Binding("Name") + }; + + var groupedContacts = new ObservableCollection> { + new Group ("E", new[] { + new ContactViewModel { Name = "Egor1", Number = "'Tap' on this item won't fire the event" }, + new ContactViewModel { Name = "Egor2", Number = "123" }, + new ContactViewModel { Name = "Egor3", Number = "123" }, + }) + }; + + listView.ItemsSource = groupedContacts; + listView.ItemTapped += ListViewOnItemTapped; + + Content = listView; + } + + void ListViewOnItemTapped(object sender, ItemTappedEventArgs itemTappedEventArgs) + { + DisplayActionSheet("Tapped a List item", "Cancel", "Destruction"); + } +} + +[Preserve(AllMembers = true)] +public class ContactViewModel : ViewModelBase2 +{ + string _name; + string _number; + + public string Name + { + get { return _name; } + set { SetProperty(ref _name, value); } + } + + public string Number + { + get { return _number; } + set { SetProperty(ref _number, value); } + } +} + +[Preserve(AllMembers = true)] +public class Group : ObservableCollection +{ + public Group(string name, IEnumerable items) + { + Name = name; + foreach (var item in items) + Add(item); + } + + public string Name { get; set; } +} + +[Preserve(AllMembers = true)] +public class ViewModelBase2 : INotifyPropertyChanged +{ + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual ViewModelBase2 SetProperty(ref T field, T value, [CallerMemberName] string propertyName = null) + { + field = value; + PropertyChangedEventHandler handler = PropertyChanged; + if (handler != null) + handler(this, new PropertyChangedEventArgs(propertyName)); + return this; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/AddingMultipleItemsListView.cs b/src/Controls/tests/TestCases.HostApp/Issues/AddingMultipleItemsListView.cs new file mode 100644 index 000000000000..424f92c50265 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/AddingMultipleItemsListView.cs @@ -0,0 +1,106 @@ +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Issue(IssueTracker.None, 0, "Adding Multiple Items to a ListView", PlatformAffected.All)] + +public class AddingMultipleItemsListView : TestContentPage +{ + protected override void Init() + { + Title = "Hours"; + var exampleViewModel = new ExampleViewModel(); + BindingContext = exampleViewModel; + + var listView = new ListView + { + ItemTemplate = new DataTemplate(typeof(CustomViewCell)), + HeightRequest = 400, + VerticalOptions = LayoutOptions.Start + }; + + listView.SetBinding(ListView.ItemsSourceProperty, new Binding("Jobs", BindingMode.TwoWay)); + + var addOneJobButton = new Button + { + Text = "Add One", + AutomationId = "Add One" + }; + addOneJobButton.SetBinding(Button.CommandProperty, new Binding("AddOneCommand")); + + var addTwoJobsButton = new Button + { + Text = "Add Two", + AutomationId = "Add Two" + }; + addTwoJobsButton.SetBinding(Button.CommandProperty, new Binding("AddTwoCommand")); + + var layout = new StackLayout + { + Orientation = StackOrientation.Vertical, +#pragma warning disable CS0618 // Type or member is obsolete + VerticalOptions = LayoutOptions.StartAndExpand, +#pragma warning restore CS0618 // Type or member is obsolete + Spacing = 15, + Children = { + listView, + addOneJobButton, + addTwoJobsButton + } + }; + Content = layout; + } + + [Preserve(AllMembers = true)] + public class CustomViewCell : ViewCell + { + public CustomViewCell() + { +#pragma warning disable CS0612 // Type or member is obsolete +#pragma warning disable CS0618 // Type or member is obsolete + var jobId = new Label + { + FontSize = 20, + WidthRequest = 105, + VerticalOptions = LayoutOptions.Center, + + HorizontalOptions = LayoutOptions.StartAndExpand + }; + jobId.SetBinding(Label.TextProperty, "JobId"); + jobId.SetBinding(Label.AutomationIdProperty, "JobId"); + + var jobName = new Label + { + VerticalOptions = LayoutOptions.Center, + WidthRequest = 175, + HorizontalOptions = LayoutOptions.CenterAndExpand, + }; + jobName.SetBinding(Label.TextProperty, "JobName"); + jobName.SetBinding(Label.AutomationIdProperty, "JobName"); + + var hours = new Label + { + WidthRequest = 45, + VerticalOptions = LayoutOptions.Center, + HorizontalTextAlignment = TextAlignment.End, + HorizontalOptions = LayoutOptions.EndAndExpand, + + }; +#pragma warning restore CS0612 +#pragma warning restore CS0618 + hours.SetBinding(Label.TextProperty, new Binding("Hours", BindingMode.OneWay, new DoubleStringConverter())); + + var hlayout = new StackLayout + { + Children = { + jobId, + jobName, + hours + }, + Orientation = StackOrientation.Horizontal, + }; + + View = hlayout; + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla38978.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla38978.cs new file mode 100644 index 000000000000..8541defec843 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla38978.cs @@ -0,0 +1,80 @@ +using System; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 38978, "Cell.ForceUpdateSize issues with row selection/deselection (ViewCell)", PlatformAffected.Android)] +public class Bugzilla38978 : TestContentPage +{ + [Preserve(AllMembers = true)] + public class MyViewCell : ViewCell + { + Image _image; + public MyViewCell() + { + _image = new Image + { + Source = ImageSource.FromFile("oasis.jpg"), + HeightRequest = 50 + }; + + Label label = new Label { Text = "Click the image to resize", VerticalOptions = LayoutOptions.Center }; + + var tapGestureRecognizer = new TapGestureRecognizer(); + tapGestureRecognizer.Tapped += (sender, e) => + { + if (_image.HeightRequest < 250) + { + _image.HeightRequest = _image.Height + 100; + ForceUpdateSize(); + label.Text = "If the tapped image is not larger, this test has failed."; + } + }; + _image.GestureRecognizers.Add(tapGestureRecognizer); + + var stackLayout = new StackLayout + { + Padding = new Thickness(20, 5, 5, 5), + Orientation = StackOrientation.Horizontal, + Children = { + _image, + label + } + }; + + View = stackLayout; + } + + protected override void OnBindingContextChanged() + { + base.OnBindingContextChanged(); + var item = BindingContext?.ToString(); + if (string.IsNullOrWhiteSpace(item)) + return; + + _image.AutomationId = item; + } + } + + protected override void Init() + { + var listView = new ListView + { + HasUnevenRows = true, + ItemTemplate = new DataTemplate(typeof(MyViewCell)), + ItemsSource = Enumerable.Range(0, 10) + }; + + Content = new StackLayout + { + Padding = new Thickness(0, 20, 0, 0), + Children = { + listView + } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla39331.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla39331.cs new file mode 100644 index 000000000000..7720144e9211 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla39331.cs @@ -0,0 +1,75 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.PlatformConfiguration; +using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific; +using Microsoft.Maui.Graphics; +using AbsoluteLayoutFlags = Microsoft.Maui.Layouts.AbsoluteLayoutFlags; +using Button = Microsoft.Maui.Controls.Button; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 39331, "[Android] BoxView Is InputTransparent Even When Set to False")] +public class Bugzilla39331 : TestContentPage +{ + View _busyBackground; + Button _btnLogin; + + protected override void Init() + { +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0618 // Type or member is obsolete + AbsoluteLayout layout = new AbsoluteLayout + { + HorizontalOptions = LayoutOptions.FillAndExpand, + VerticalOptions = LayoutOptions.FillAndExpand, + }; +#pragma warning restore CS0618 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + + BackgroundColor = Color.FromUint(0xFFDBDBDB); + +#pragma warning disable CS0618 // Type or member is obsolete + _btnLogin = new Button + { + HorizontalOptions = LayoutOptions.FillAndExpand, + AutomationId = "btnLogin", + Text = "Press me", + BackgroundColor = Color.FromUint(0xFF6E932D), + TextColor = Colors.White, + }; +#pragma warning restore CS0618 // Type or member is obsolete + _btnLogin.Clicked += BtnLogin_Clicked; + layout.Children.Add(_btnLogin); + + _busyBackground = new BoxView + { + BackgroundColor = new Color(0, 0, 0, 0.5f), + IsVisible = false, + InputTransparent = false + }; + + // Bump up elevation on Android to cover FastRenderer Button + ((BoxView)_busyBackground).On().SetElevation(10f); + + layout.Children.Add(_busyBackground); + + Content = layout; + } + + void BtnLogin_Clicked(object sender, EventArgs e) + { + + if (!_busyBackground.IsVisible) + { + _btnLogin.Text = "Blocked?"; + _busyBackground.IsVisible = true; + } + else + { + _btnLogin.Text = "Guess Not"; + _busyBackground.IsVisible = false; + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla39530.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla39530.cs new file mode 100644 index 000000000000..50c5e0d9719e --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla39530.cs @@ -0,0 +1,55 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 39530, "Frames do not handle pan or pinch gestures under AppCompat", PlatformAffected.Android)] +public class Bugzilla39530 : TestContentPage +{ + protected override void Init() + { + var taps = new Label { Text = "Taps: 0" }; + var pans = new Label(); + var pinches = new Label(); + + var pangr = new PanGestureRecognizer(); + var tapgr = new TapGestureRecognizer(); + var pinchgr = new PinchGestureRecognizer(); + + var frame = new Frame + { + HasShadow = false, + HorizontalOptions = LayoutOptions.Fill, + VerticalOptions = LayoutOptions.Fill, + BackgroundColor = Colors.White, + Padding = new Thickness(5), + HeightRequest = 300, + WidthRequest = 300, + AutomationId = "frame" + }; + + var tapCount = 0; + + tapgr.Command = new Command(() => + { + tapCount += 1; + taps.Text = $"Taps: {tapCount}"; + }); + + pangr.PanUpdated += (sender, args) => pans.Text = $"Panning: {args.StatusType}"; + + pinchgr.PinchUpdated += (sender, args) => pinches.Text = $"Pinching: {args.Status}"; + + frame.GestureRecognizers.Add(tapgr); + frame.GestureRecognizers.Add(pangr); + frame.GestureRecognizers.Add(pinchgr); + + Content = new StackLayout + { + BackgroundColor = Colors.Olive, + Children = { taps, pans, pinches, frame } + }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40092.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40092.cs new file mode 100644 index 000000000000..02a970c91db5 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40092.cs @@ -0,0 +1,51 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; +using AbsoluteLayoutFlags = Microsoft.Maui.Layouts.AbsoluteLayoutFlags; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 40092, "Ensure android devices with fractional scale factors (3.5) don't have a white line around the border" + , PlatformAffected.Android)] + +public class Bugzilla40092 : TestContentPage +{ + const string Black = "black"; + const string White = "white"; + const string Ok = "Ok"; + protected override void Init() + { + AbsoluteLayout mainLayout = new AbsoluteLayout() + { + BackgroundColor = Colors.White, + AutomationId = White + }; + + // The root page of your application + + var thePage = new ContentView + { + BackgroundColor = Colors.Red, + Content = mainLayout + }; + + BoxView view = new BoxView() + { + Color = Colors.Black, + AutomationId = Black + }; + + mainLayout.Add(view); + Content = thePage; + + } + + protected override async void OnAppearing() + { + base.OnAppearing(); + await DisplayAlert("Instruction", "If you see just the black color, the test pass. (Ignore the navigation bar)", Ok); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40161.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40161.cs new file mode 100644 index 000000000000..f1434d750a76 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40161.cs @@ -0,0 +1,120 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; +using AbsoluteLayoutFlags = Microsoft.Maui.Layouts.AbsoluteLayoutFlags; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 40161, "Issue Bugzilla40161", PlatformAffected.Default)] +public class Bugzilla40161 : TestContentPage +{ + // If an image is swapped out for another image must the size of an image be recomputed? + // That would work but is slow. As an optimization, if an image's size is controlled by + // it's parents and the parents dictate that any image will be a specific size then there + // is no need to layout the image. Consider the following scenarios: + + // (a) An absolute layout dictates the size of a child image when the child specifies that it + // should fill the space allocated by the aboslute layout. In this case the optimization + // should be enabled; the layout pass for the replaced image can be skipped. The replaced image + // should occupy the same space as the orig image. + + // (b) The image size is *not* dicatated by the absolute layout if it chooses not to fill the + // space the absolute layout allocates it and instead chooses to simply be centered with in + // that space. In this case the layout pass for the replaced image must be run to compute the + // size of the replaced image. This was the case reported by the bug that led to this UITest. + protected override void Init() + { + var absolute = new AbsoluteLayout() + { + // The size of an AbsoluteLayout whose H/V options equal Fill will match its + // parent container. Given that, the layout engine will optimize any re-layout of + // such an AbsoluteLayout by not recomputing its size if its parent container + // does not change size. Such an AbsoluteLayout is marked as special by setting + // its AbsoluteLayout.LayoutConstraint to fixed. All it's children will inherit + // the special setting. + HorizontalOptions = LayoutOptions.Fill, + VerticalOptions = LayoutOptions.Fill, + }; + + var imageA = "seth.png"; + var imageB = "test.jpg"; + + var image = new Image() + { + Source = imageA, + Aspect = Aspect.AspectFill, + + // Children of an AbsoluteLayout can potentially inherit its LayoutConstraint. + // This should happen if the child H/V options are also set to Fill AND its size + // is all proportional. In that case the child fills the size allocated to it by + // the layout and so it's size should be re-computed iff the layout's size has + // changed. This behavior is achived by inheriting the layout's LayoutConstraint. + + // *IF* however the H/V options are Center then the Image should be rendered to + // to *AT MOST* the image size regardless of whether the region allocated by + // the absolute layout is larger than the image. + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + }; + + AbsoluteLayout.SetLayoutFlags(image, AbsoluteLayoutFlags.All); + AbsoluteLayout.SetLayoutBounds(image, new Rect(0, 0, 1, 1)); + absolute.Children.Add(image); + + var stack = new StackLayout(); + stack.Children.Add(absolute); + + bool flipSwap = false; + var swap = new Button() { Text = "SWAP", AutomationId = "SWAP" }; + swap.Clicked += (object sender, EventArgs e) => + { + if (flipSwap) + image.Source = imageA; + else + image.Source = imageB; + + flipSwap = !flipSwap; + }; + stack.Children.Add(swap); + + bool flipLayout = false; + var layout = new Button() { Text = "LAYOUT" }; + layout.Clicked += (object sender, EventArgs e) => + { + if (flipLayout) + { + image.HorizontalOptions = LayoutOptions.Center; + image.VerticalOptions = LayoutOptions.Center; + } + else + { + image.HorizontalOptions = LayoutOptions.Fill; + image.VerticalOptions = LayoutOptions.Fill; + } + + flipLayout = !flipLayout; + }; + stack.Children.Add(layout); + + var counter = new Label() { Text = "counter", AutomationId = "counter" }; + var height = new Label() { Text = "height", AutomationId = "height" }; + var width = new Label() { Text = "width", AutomationId = "width" }; + stack.Children.Add(counter); + stack.Children.Add(height); + stack.Children.Add(width); + + var count = 0; + var refresh = new Button() { Text = "REFRESH", AutomationId = "REFRESH" }; + refresh.Clicked += (object sender, EventArgs e) => + { + height.Text = $"h={Math.Round(image.Height)}"; + width.Text = $"w={Math.Round(image.Width)}"; + counter.Text = $"step={count++}"; + }; + stack.Children.Add(refresh); + + Content = stack; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40173.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40173.cs new file mode 100644 index 000000000000..449ab9168ff1 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40173.cs @@ -0,0 +1,111 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.PlatformConfiguration; +using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific; +using Microsoft.Maui.Graphics; +using Button = Microsoft.Maui.Controls.Button; +using ListView = Microsoft.Maui.Controls.ListView; +using ViewCell = Microsoft.Maui.Controls.ViewCell; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 40173, "Android BoxView/Frame not clickthrough in ListView")] +public class Bugzilla40173 : TestContentPage +{ + const string CantTouchButtonId = "CantTouchButtonId"; + const string CanTouchButtonId = "CanTouchButtonId"; + const string ListTapTarget = "ListTapTarget"; + const string CantTouchFailText = "Failed"; + const string CanTouchSuccessText = "ButtonTapped"; + const string ListTapSuccessText = "ItemTapped"; + + protected override void Init() + { + var outputLabel = new Label() { AutomationId = "outputlabel" }; + var testButton = new Button + { + Text = "Can't Touch This", + AutomationId = CantTouchButtonId + }; + + testButton.Clicked += (sender, args) => outputLabel.Text = CantTouchFailText; + + var boxView = new BoxView + { + AutomationId = "nontransparentBoxView", + Color = Colors.Pink.MultiplyAlpha(0.5f) + }; + + // Bump up the elevation on Android so the Button is covered (FastRenderers) + boxView.On().SetElevation(10f); + + var testGrid = new Grid + { + AutomationId = "testgrid", + Children = + { + testButton, + boxView + } + }; + + // BoxView over Button prevents Button click + var testButtonOk = new Button + { + Text = "Can Touch This", + AutomationId = CanTouchButtonId + }; + + testButtonOk.Clicked += (sender, args) => + { + outputLabel.Text = CanTouchSuccessText; + }; + + var testGridOk = new Grid + { + AutomationId = "testgridOK", + Children = + { + testButtonOk, + new BoxView + { + AutomationId = "transparentBoxView", + Color = Colors.Pink.MultiplyAlpha(0.5f), + InputTransparent = true + } + } + }; + + var testListView = new ListView(); + var items = new[] { "Foo" }; + testListView.ItemsSource = items; + testListView.ItemTemplate = new DataTemplate(() => + { + var result = new ViewCell + { + View = new Grid + { + Children = + { + new BoxView + { + AutomationId = ListTapTarget, + Color = Colors.Pink.MultiplyAlpha(0.5f) + } + } + } + }; + + return result; + }); + + testListView.ItemSelected += (sender, args) => outputLabel.Text = ListTapSuccessText; + + Content = new StackLayout + { + AutomationId = "Container Stack Layout", + Children = { outputLabel, testGrid, testGridOk, testListView } + }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40333.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40333.cs new file mode 100644 index 000000000000..063fc2faea1e --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40333.cs @@ -0,0 +1,204 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 40333, "[Android] IllegalStateException: Recursive entry to executePendingTransactions", PlatformAffected.Android)] +public class Bugzilla40333 : TestNavigationPage +{ + const string StartNavPageTestId = "StartNavPageTest"; + const string OpenRootId = "OpenRoot"; + const string StartTabPageTestId = "StartTabPageTest"; + const string StillHereId = "3 Still Here"; + const string ClickThisId = "2 Click This"; + + protected override void Init() + { + var navButton = new Button { Text = "Test With NavigationPage", AutomationId = StartNavPageTestId }; + navButton.Clicked += (sender, args) => { PushAsync(new _40333MDP(false)); }; + + var tabButton = new Button { Text = "Test With TabbedPage", AutomationId = StartTabPageTestId }; + tabButton.Clicked += (sender, args) => { PushAsync(new _40333MDP(true)); }; + + var content = new ContentPage + { + Content = new StackLayout + { + Children = { navButton, tabButton } + } + }; + + PushAsync(content); + } + + [Preserve(AllMembers = true)] + public class _40333MDP : TestFlyoutPage + { + readonly bool _showTabVersion; + + public _40333MDP(bool showTabVersion) + { + _showTabVersion = showTabVersion; + } + + protected override void Init() + { + if (_showTabVersion) + { + Flyout = new NavigationPage(new _40333TabPusher("Root")) { Title = "RootNav" }; + Detail = new TabbedPage() { Title = "DetailNav", Children = { new _40333DetailPage("T1") } }; + } + else + { + Flyout = new NavigationPage(new _40333NavPusher("Root")) { Title = "RootNav" }; + Detail = new NavigationPage(new _40333DetailPage("Detail") { Title = "DetailPage" }) { Title = "DetailNav" }; + } + } + + [Preserve(AllMembers = true)] + public class _40333DetailPage : ContentPage + { + public _40333DetailPage(string title) + { + Title = title; + + var openRoot = new Button + { + Text = "Open Flyout", + AutomationId = OpenRootId + }; + + openRoot.Clicked += (sender, args) => ((FlyoutPage)Parent.Parent).IsPresented = true; + + Content = new StackLayout() + { + Children = { new Label { Text = "Detail Text" }, openRoot } + }; + } + } + + [Preserve(AllMembers = true)] + public class _40333NavPusher : ContentPage + { + readonly ListView _listView = new ListView(); + + public _40333NavPusher(string title) + { + Title = title; + + _listView.ItemTemplate = new DataTemplate(() => + { + var lbl = new Label(); + lbl.SetBinding(Label.TextProperty, "."); + lbl.SetBinding(Label.AutomationIdProperty, "."); + lbl.AutomationId = lbl.Text; + + var result = new ViewCell + { + View = new StackLayout + { + Orientation = StackOrientation.Horizontal, + Children = + { + lbl + } + } + }; + + return result; + }); + + _listView.ItemsSource = new[] { "1", ClickThisId, StillHereId }; + _listView.ItemTapped += OnItemTapped; + + Content = new StackLayout + { + Children = { _listView } + }; + } + + async void OnItemTapped(object sender, EventArgs e) + { + var rootNav = ((FlyoutPage)this.Parent.Parent).Flyout.Navigation; + + var newTitle = $"{Title}.{_listView.SelectedItem}"; + await rootNav.PushAsync(new _40333NavPusher(newTitle)); + } + + protected override async void OnAppearing() + { + base.OnAppearing(); + + var newPage = new _40333DetailPage(Title); + + var detailNav = ((FlyoutPage)this.Parent.Parent).Detail.Navigation; + var currentRoot = detailNav.NavigationStack[0]; + detailNav.InsertPageBefore(newPage, currentRoot); + await detailNav.PopToRootAsync(); + } + } + + [Preserve(AllMembers = true)] + public class _40333TabPusher : ContentPage + { + readonly ListView _listView = new ListView(); + + public _40333TabPusher(string title) + { + Title = title; + + _listView.ItemTemplate = new DataTemplate(() => + { + var lbl = new Label(); + lbl.SetBinding(Label.TextProperty, "."); + lbl.SetBinding(Label.AutomationIdProperty, "."); + lbl.AutomationId = lbl.Text; + + var result = new ViewCell + { + View = new StackLayout + { + Orientation = StackOrientation.Horizontal, + Children = + { + lbl + } + } + }; + + return result; + }); + + _listView.ItemsSource = new[] { "1", ClickThisId, StillHereId }; + _listView.ItemTapped += OnItemTapped; + + Content = new StackLayout + { + Children = { _listView } + }; + } + + async void OnItemTapped(object sender, EventArgs e) + { + var rootNav = ((FlyoutPage)this.Parent.Parent).Flyout.Navigation; + + var newTitle = $"{Title}.{_listView.SelectedItem}"; + await rootNav.PushAsync(new _40333TabPusher(newTitle)); + } + + protected override void OnAppearing() + { + base.OnAppearing(); + + var newPage = new _40333DetailPage(Title); + + var detailTab = (TabbedPage)((FlyoutPage)this.Parent.Parent).Detail; + + detailTab.Children.Add(newPage); + detailTab.CurrentPage = newPage; + } + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40704.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40704.cs new file mode 100644 index 000000000000..f4e04e500032 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40704.cs @@ -0,0 +1,219 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 40704, "Strange duplication of listview headers when collapsing/expanding sections")] +public class Bugzilla40704 : TestContentPage +{ + ListView listview; + int count = 2; + + const string Collapse = "btnCollapse"; + const string List = "lstMain"; + + protected override void Init() + { + listview = new ListView(ListViewCachingStrategy.RecycleElement) + { + AutomationId = List, + IsGroupingEnabled = true, + HasUnevenRows = true, + GroupHeaderTemplate = new DataTemplate(typeof(GroupHeaderViewCell)), + ItemTemplate = new DataTemplate(typeof(ItemTestViewCell)) + }; + + FillPatientsList(); + + var button = new Button() + { + Text = "Collapse", + AutomationId = Collapse + }; + + listview.Footer = button; + button.Clicked += Button_Clicked; + Content = listview; + } + + void Button_Clicked(object sender, EventArgs e) + { + var source = listview.ItemsSource as List; + source[count].Toggle(); + count--; + if (count < 0) + count = 2; + } + + private void FillPatientsList() + { + const int groupsNumber = 3; + const int patientsNumber = 10; + + var patientGroups = new List(); + var random = new Random(); + + for (var i = 0; i < groupsNumber; i++) + { + var patients = new List(); + for (var j = 0; j < patientsNumber; j++) + { + var code = string.Format("{0}-{1}", i, j); + var length = random.Next(5, 100); + var strBuilder = new StringBuilder(); + for (int z = 0; z < length; z++) + { + strBuilder.Append(code); + if (z % 7 == 0) + { + strBuilder.Append(' '); + } + } + + patients.Add(new PatientViewModel(code) { Description = strBuilder.ToString() }); + } + + patientGroups.Add(new PatientsGroupViewModel(patients) + { + Title = "Menu - " + i.ToString(), + }); + + } + + listview.ItemsSource = patientGroups; + } + + [Preserve(AllMembers = true)] + public class GroupHeaderViewCell : ViewCell + { + TapGestureRecognizer tapGesture; + + public GroupHeaderViewCell() + { + Height = 40; + var grd = new Grid { BackgroundColor = Colors.Aqua, Padding = new Thickness(5, 10) }; + tapGesture = new TapGestureRecognizer(); + tapGesture.Tapped += HeaderCell_OnTapped; + grd.GestureRecognizers.Add(tapGesture); +#pragma warning disable CS0618 // Type or member is obsolete + var lbl = new Label { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.FillAndExpand, TextColor = Colors.Black, FontSize = 16 }; +#pragma warning restore CS0618 // Type or member is obsolete + lbl.SetBinding(Label.TextProperty, new Binding("Title")); + lbl.SetBinding(Label.AutomationIdProperty, new Binding("Title")); + + grd.Children.Add(lbl); + View = grd; + } + + void HeaderCell_OnTapped(object sender, EventArgs e) + { + var cell = (Layout)sender; + var vm = cell.BindingContext as PatientsGroupViewModel; + + if (vm != null) + { + vm.Toggle(); + } + } + } + + [Preserve(AllMembers = true)] + public class ItemTestViewCell : ViewCell + { + public ItemTestViewCell() + { + + var grd = new Grid { BackgroundColor = Colors.Yellow }; +#pragma warning disable CS0618 // Type or member is obsolete + var lbl = new Label { HorizontalOptions = LayoutOptions.FillAndExpand, TextColor = Colors.Black, FontSize = 16, LineBreakMode = LineBreakMode.WordWrap }; +#pragma warning restore CS0618 // Type or member is obsolete + lbl.SetBinding(Label.TextProperty, new Binding("Description")); + grd.Children.Add(lbl); + View = grd; + } + } + + [Preserve(AllMembers = true)] + public class RangeObservableCollection : ObservableCollection + { + private bool _suppressNotification = false; + + protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) + { + if (!_suppressNotification) + base.OnCollectionChanged(e); + } + + public void AddRange(IEnumerable list) + { + if (list == null) + throw new ArgumentNullException("list"); + + _suppressNotification = true; + + foreach (var item in list) + { + Add(item); + } + _suppressNotification = false; + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); + } + } + + [Preserve(AllMembers = true)] + public class PatientsGroupViewModel : RangeObservableCollection + { + public bool IsCollapsed { get; private set; } + + public string Title { get; set; } + + private readonly List _patients; + + public PatientsGroupViewModel(List patients) + { + _patients = patients; + + UpdateCollection(); + } + + public void Toggle() + { + IsCollapsed = !IsCollapsed; + + UpdateCollection(); + } + + private void UpdateCollection() + { + if (!IsCollapsed) + { + AddRange(_patients); + } + else + { + Clear(); + } + } + } + + [Preserve(AllMembers = true)] + public class PatientViewModel + { + public PatientViewModel(string code) + { + Code = code; + } + + public string Code { get; set; } + + public string Description { get; set; } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40858.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40858.cs new file mode 100644 index 000000000000..c032d8634197 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40858.cs @@ -0,0 +1,35 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 40858, "Long clicking a text entry in a ListView header/footer cause a crash", PlatformAffected.Android)] +public class Bugzilla40858 : TestContentPage +{ + protected override void Init() + { + Content = new StackLayout + { + Children = + { + new ListView + { + Header = new Editor + { + AutomationId = "Header", + HeightRequest = 50, + Text = "ListView Header -- Editor" + }, + Footer = new Entry + { + AutomationId = "Footer", + HeightRequest = 50, + Text = "ListView Footer -- Entry" + } + } + } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40955.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40955.cs new file mode 100644 index 000000000000..622bca95a5f6 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla40955.cs @@ -0,0 +1,193 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 40955, "Memory leak with FormsAppCompatActivity and NavigationPage", PlatformAffected.Android)] +public class Bugzilla40955 : TestFlyoutPage +{ + const string DestructorMessage = "NavigationPageEx Destructor called"; + const string Page1Title = "Page1"; + const string Page2Title = "Page2"; + const string Page3Title = "Page3"; + const string LabelPage1 = "Open the drawer menu and select Page2"; + const string LabelPage2 = "Open the drawer menu and select Page3"; + static string LabelPage3 = $"The console should have displayed the text '{DestructorMessage}' at least once. If not, this test has failed."; + static string Success = string.Empty; + + static FlyoutPage Reference; + + protected override void Init() + { + var masterPage = new MasterPage(); + Flyout = masterPage; + masterPage.ListView.ItemSelected += (sender, e) => + { + var item = e.SelectedItem as MasterPageItem; + if (item != null) + { + Detail = new NavigationPageEx((Page)Activator.CreateInstance(item.TargetType)); + masterPage.ListView.SelectedItem = null; + IsPresented = false; + } + }; + + Detail = new NavigationPageEx(new _409555_Page1()); + Reference = this; + } + + [Preserve(AllMembers = true)] + public class MasterPageItem + { + public string IconSource { get; set; } + + public Type TargetType { get; set; } + + public string Title { get; set; } + } + + [Preserve(AllMembers = true)] + public class MasterPage : ContentPage + { + public MasterPage() + { + Title = "Menu"; +#pragma warning disable CS0618 // Type or member is obsolete + ListView = new ListView { VerticalOptions = LayoutOptions.FillAndExpand, SeparatorVisibility = SeparatorVisibility.None }; +#pragma warning restore CS0618 // Type or member is obsolete + + ListView.ItemTemplate = new DataTemplate(() => + { + var ic = new ImageCell(); + ic.SetBinding(TextCell.TextProperty, "Title"); + return ic; + }); + + Content = new StackLayout + { + Children = { ListView } + }; + + var masterPageItems = new List(); + masterPageItems.Add(new MasterPageItem + { + Title = Page1Title, + TargetType = typeof(_409555_Page1) + }); + masterPageItems.Add(new MasterPageItem + { + Title = Page2Title, + TargetType = typeof(_409555_Page2) + }); + masterPageItems.Add(new MasterPageItem + { + Title = Page3Title, + TargetType = typeof(_409555_Page3) + }); + + ListView.ItemsSource = masterPageItems; + } + + public ListView ListView { get; } + } + + [Preserve(AllMembers = true)] + public class NavigationPageEx : NavigationPage + { + public NavigationPageEx(Page root) : base(root) + { + } + + ~NavigationPageEx() + { + Debug.WriteLine(DestructorMessage); + Success = DestructorMessage; + } + } + + [Preserve(AllMembers = true)] + public class _409555_Page1 : ContentPage + { + public _409555_Page1() + { + Title = Page1Title; + + var lbl = new Label + { + Text = LabelPage1 + }; + + lbl.GestureRecognizers.Add(new TapGestureRecognizer + { + Command = new Command(OpenMaster) + }); + + Content = new StackLayout + { + Children = { lbl } + }; + } + } + + static void OpenMaster() + { + Reference.IsPresented = true; + } + + [Preserve(AllMembers = true)] + public class _409555_Page2 : ContentPage + { + public _409555_Page2() + { + Title = Page2Title; + var lbl = new Label + { + Text = LabelPage2 + }; + + lbl.GestureRecognizers.Add(new TapGestureRecognizer + { + Command = new Command(OpenMaster) + }); + Content = new StackLayout { Children = { lbl } }; + } + } + + [Preserve(AllMembers = true)] + public class _409555_Page3 : ContentPage + { + public _409555_Page3() + { + Title = Page3Title; + + var lbl = new Label + { + Text = LabelPage3 + }; + + lbl.GestureRecognizers.Add(new TapGestureRecognizer + { + Command = new Command(async () => await DisplayAlert("Alert", Success, "Ok")) + }); + + var successLabel = new Label(); + Content = new StackLayout + { + Children = + { + lbl + } + }; + } + + protected override void OnAppearing() + { + base.OnAppearing(); + GarbageCollectionHelper.Collect(); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41038.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41038.cs new file mode 100644 index 000000000000..0201b8ea9dc2 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41038.cs @@ -0,0 +1,78 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 41038, "FlyoutPage loses menu icon on iOS after reusing NavigationPage as Detail")] +public class Bugzilla41038 : TestFlyoutPage +{ + NavigationPage _navPage; + + protected override void Init() + { + Title = "Main"; + + var btnViewA = new Button() { Text = "ViewA", AutomationId = "ViewA" }; + btnViewA.Clicked += Button_Clicked; + + var btnViewB = new Button() { Text = "ViewB", AutomationId = "ViewB" }; + btnViewB.Clicked += Button_Clicked; + + var stack = new StackLayout(); + stack.Children.Add(btnViewA); + stack.Children.Add(btnViewB); + + var root = new ContentPage() { Title = "Flyout", Content = stack }; + + _navPage = new NavigationPage(new ViewA()); + + Flyout = root; + Detail = _navPage; + + } + + private async void Button_Clicked(object sender, EventArgs e) + { + Page root = _navPage.Navigation.NavigationStack[0]; + + await _navPage.Navigation.PopToRootAsync(false); + + Page newRoot = null; + + var btn = (Button)sender; + if (btn.Text == "ViewA") + newRoot = new ViewA(); + else + newRoot = new ViewB(); + + + await _navPage.Navigation.PushAsync(newRoot); + _navPage.Navigation.RemovePage(root); + IsPresented = false; + } + + public class ViewA : ContentPage + { + public ViewA() + { + Title = "ViewA"; + Content = new Label() + { + Text = "Verify that the hamburger icon is visible. Click the icon and switch to ViewB. If the icon does not disappear, the test has passed.", + HorizontalTextAlignment = TextAlignment.Center, + VerticalTextAlignment = TextAlignment.Center + }; + } + } + + public class ViewB : ContentPage + { + public ViewB() + { + Title = "ViewB"; + Content = new Label() { Text = "View B" }; + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41153.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41153.cs new file mode 100644 index 000000000000..c18eef5d8d24 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41153.cs @@ -0,0 +1,78 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Windows.Input; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 41153, "jobject must not be IntPtr.Zero with TabbedPage and ToolbarItems")] +public class Bugzilla41153 : TestTabbedPage +{ + MyViewModel _Vm = new MyViewModel(); + const string Tab1 = "Tab 1"; + const string Tab1Content = "On Tab 1"; + const string Tab2 = "Tab 2"; + const string Tab3 = "Tab 3"; + const string Tab3Content = "On Tab 3"; + const string ToolbarItemText = "Toolbar Item"; + const string Success = "Success"; + + [Preserve(AllMembers = true)] + class MyViewModel : INotifyPropertyChanged + { + string _toolBarItemText; + public string ToolbarItemText + { + get + { + return _toolBarItemText; + } + set + { + _toolBarItemText = value; + OnPropertyChanged(); + } + } + + ICommand _toolBarItemCommand; + public ICommand ToolbarItemCommand + { + get + { + if (_toolBarItemCommand == null) + { + _toolBarItemCommand = new Command(() => + { + ToolbarItemText = Success; + }); + } + + return _toolBarItemCommand; + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + } + + protected override void Init() + { + var page1 = new ContentPage { Content = new Label { Text = Tab1Content, AutomationId = Tab1Content }, BindingContext = _Vm }; + var toolBarItem = new ToolbarItem() { AutomationId = ToolbarItemText }; + toolBarItem.SetBinding(ToolbarItem.CommandProperty, nameof(MyViewModel.ToolbarItemCommand)); + toolBarItem.SetBinding(ToolbarItem.TextProperty, nameof(MyViewModel.ToolbarItemText)); + page1.ToolbarItems.Add(toolBarItem); + var page2 = new ContentPage(); + var page3 = new ContentPage { Content = new Label { Text = Tab3Content, AutomationId = Tab3Content } }; + Children.Add(new NavigationPage(page1) { Title = Tab1, AutomationId = Tab1 }); + Children.Add(new NavigationPage(page2) { Title = Tab2, AutomationId = Tab2 }); + Children.Add(new NavigationPage(page3) { Title = Tab3, AutomationId = Tab3 }); + _Vm.ToolbarItemText = ToolbarItemText; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41271.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41271.cs new file mode 100644 index 000000000000..845434fc79b7 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41271.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 41271, "[UWP] Memory Leak from ListView in TabbedPage", PlatformAffected.UWP)] +public class Bugzilla41271 : TestTabbedPage +{ + const string ListMain = "mainList"; + + [Preserve(AllMembers = true)] + class Person + { + public Person(string firstName, string lastName, string city, string state) + { + FirstName = firstName; + LastName = lastName; + City = city; + State = state; + } + public string FirstName { get; set; } + public string LastName { get; set; } + public string City { get; set; } + public string State { get; set; } + } + [Preserve(AllMembers = true)] + class ListViewCell : ViewCell + { + Label firstNameLabel = new Label(); + Label lastNameLabel = new Label(); + Label cityLabel = new Label(); + Label stateLabel = new Label(); + + public ListViewCell() + { + View = new StackLayout + { + Orientation = StackOrientation.Horizontal, + Children = + { + firstNameLabel, + lastNameLabel, + cityLabel, + stateLabel + } + }; + } + + protected override void OnBindingContextChanged() + { + base.OnBindingContextChanged(); + var item = BindingContext as Person; + if (item != null) + { + firstNameLabel.Text = item.FirstName; + lastNameLabel.Text = item.LastName; + cityLabel.Text = item.City; + stateLabel.Text = item.State; + AutomationId = item.State; + } + } + } + [Preserve(AllMembers = true)] + class ListViewPage : ContentPage + { + ListView _ListView; + List _People = new List(); + + public ListViewPage(string id) + { + Title = $"List {id}"; + AutomationId = $"List {id}"; + + for (var x = 0; x < 1000; x++) + { + _People.Add(new Person("Bob", "Bobson", "San Francisco", $"California #{x}")); + } + + _ListView = new ListView(ListViewCachingStrategy.RecycleElement) + { + ItemTemplate = new DataTemplate(typeof(ListViewCell)), + AutomationId = ListMain + }; + Content = _ListView; + } + + protected override void OnAppearing() + { + base.OnAppearing(); + + _ListView.ItemsSource = _People; + } + + protected override void OnDisappearing() + { + base.OnDisappearing(); + + _ListView.ItemsSource = null; + } + } + + protected override void Init() + { + var counter = 1; + + for (var x = 0; x < 10; x++) + { + Children.Add(new ListViewPage(counter.ToString())); + counter++; + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41424.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41424.cs new file mode 100644 index 000000000000..d54b89b55525 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla41424.cs @@ -0,0 +1,59 @@ +using System.Threading; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 41424, "[Android] Clicking cancel on a DatePicker does not cause it to unfocus", PlatformAffected.Android)] +public class Bugzilla41424 : TestContentPage +{ + const string DatePicker = "DatePicker"; + + protected override void Init() + { + var stepsTitleLabel = new Label() { Text = "Test steps:" }; + var step1Label = new Label() { Text = "• Click 'Click to focus DatePicker'" }; + var step2Label = new Label() { Text = "• Click 'Cancel' or back button" }; + var step3Label = new Label() { Text = "• Click 'Click to focus DatePicker'" }; + var step4Label = new Label() { Text = "• Check that date selector appears" }; + var datePickerFocusStateLabel = new Label() { AutomationId = "focusstate" }; + var datePicker = new DatePicker + { + AutomationId = DatePicker + }; + datePicker.Focused += (sender, args) => { datePickerFocusStateLabel.Text = "focused"; }; + + var datePickerFocusButton = new Button + { + Text = "Click to focus DatePicker", + Command = new Command(() => datePicker.Focus()) + }; + + var getDatePickerFocusStateButton = new Button + { + Text = "Click to view focus state", + AutomationId = "getfocusstate", + Command = new Command(() => + { + datePickerFocusStateLabel.Text = datePicker.IsFocused ? "focused" : "unfocused"; + }) + }; + + Content = new StackLayout + { + Children = + { + stepsTitleLabel, + step1Label, + step2Label, + step3Label, + step4Label, + datePicker, + datePickerFocusButton, + getDatePickerFocusStateButton, + datePickerFocusStateLabel + } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla42074.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla42074.cs new file mode 100644 index 000000000000..356c9e31ba04 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla42074.cs @@ -0,0 +1,34 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 42074, "[Android] Clicking cancel on a TimePicker does not cause it to unfocus", PlatformAffected.Android)] +public class Bugzilla42074 : TestContentPage +{ + const string TimePicker = "TimePicker"; + + protected override void Init() + { + var timePicker = new TimePicker + { + AutomationId = TimePicker + }; + var timePickerFocusButton = new Button + { + Text = "Click to focus TimePicker", + AutomationId = "focusbtn", + Command = new Command(() => timePicker.Focus()) + }; + Content = new StackLayout + { + Children = + { + timePicker, + timePickerFocusButton + } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla42329.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla42329.cs new file mode 100644 index 000000000000..0c93a4487b03 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla42329.cs @@ -0,0 +1,206 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 42329, "ListView in Frame and FormsAppCompatActivity Memory Leak")] +public class Bugzilla42329 : TestFlyoutPage +{ + const string DestructorMessage = "ContentPageEx Destructor called"; + const string Page1Title = "Page1"; + const string Page2Title = "Page2"; + const string Page3Title = "Page3"; + const string LabelPage1 = "Open the drawer menu and select Page2"; + const string LabelPage2 = "Open the drawer menu and select Page3"; + readonly static string LabelPage3 = $"The console should have displayed the text '{DestructorMessage}' at least once. If not, this test has failed."; + static string Success { get; set; } = string.Empty; + static FlyoutPage Reference; + + protected override void Init() + { + var rootPage = new RootPage(); + Flyout = rootPage; + rootPage.ListView.ItemSelected += (sender, e) => + { + var item = e.SelectedItem as RootPageItem; + if (item != null) + { + Detail = new NavigationPage((Page)Activator.CreateInstance(item.TargetType)); + rootPage.ListView.SelectedItem = null; + IsPresented = false; + } + }; + + Detail = new NavigationPage(new _42329_FrameWithListView()); + Reference = this; + } + + [Preserve(AllMembers = true)] + public class RootPage : ContentPage + { + public RootPage() + { + Title = "Menu"; +#pragma warning disable CS0618 // Type or member is obsolete + ListView = new ListView { VerticalOptions = LayoutOptions.FillAndExpand, SeparatorVisibility = SeparatorVisibility.None }; +#pragma warning restore CS0618 // Type or member is obsolete + + ListView.ItemTemplate = new DataTemplate(() => + { + var ic = new ImageCell(); + ic.SetBinding(TextCell.TextProperty, "Title"); + ic.SetBinding(TextCell.AutomationIdProperty, "Title"); + return ic; + }); + + Content = new StackLayout + { + Children = { ListView } + }; + + var rootPageItems = new List(); + rootPageItems.Add(new RootPageItem + { + Title = Page1Title, + TargetType = typeof(Bugzilla42329._42329_FrameWithListView) + }); + rootPageItems.Add(new RootPageItem + { + Title = Page2Title, + TargetType = typeof(Bugzilla42329._42329_Page2) + }); + rootPageItems.Add(new RootPageItem + { + Title = Page3Title, + TargetType = typeof(Bugzilla42329._42329_Page3) + }); + + ListView.ItemsSource = rootPageItems; + } + + public ListView ListView { get; } + } + + [Preserve(AllMembers = true)] + public class RootPageItem + { + public string IconSource { get; set; } + + public Type TargetType { get; set; } + + public string Title { get; set; } + } + + [Preserve(AllMembers = true)] + public class ContentPageEx : ContentPage + { + ~ContentPageEx() + { + Success = "Destructor called"; + Log.Warning("Bugzilla42329", DestructorMessage); + } + } + + [Preserve(AllMembers = true)] + public class _42329_FrameWithListView : ContentPageEx + { + public _42329_FrameWithListView() + { + var lv = new ListView(); + var label = new Label() { Text = LabelPage1, AutomationId = LabelPage1 }; + label.GestureRecognizers.Add(new TapGestureRecognizer + { + Command = new Command(OpenRoot) + }); + var frame = new Frame { Content = lv }; + + Title = Page1Title; + Content = new StackLayout + { + Children = + { + label, + frame + } + }; + } + } + + static void OpenRoot() + { + Reference.IsPresented = true; + } + + [Preserve(AllMembers = true)] + public class _42329_Page2 : ContentPage + { + public _42329_Page2() + { + var lbl = new Label + { + Text = LabelPage2, + AutomationId = LabelPage2 + }; + lbl.GestureRecognizers.Add(new TapGestureRecognizer + { + Command = new Command(OpenRoot) + }); + + Title = Page2Title; + Content = new StackLayout + { + Children = + { + lbl + } + }; + } + } + + [Preserve(AllMembers = true)] + public class _42329_Page3 : ContentPage + { + Label lblFlag; + Label otherLabel; + public _42329_Page3() + { + Title = Page3Title; + Success = Success; + lblFlag = new Label + { + Text = LabelPage3, + HorizontalTextAlignment = TextAlignment.Center, + TextColor = Colors.Red + }; + + otherLabel = new Label + { + HorizontalOptions = LayoutOptions.Center, + FontAttributes = FontAttributes.Bold, + AutomationId = Success + + }; + Content = new StackLayout + { + Children = + { + lblFlag, + otherLabel + } + }; + } + + protected override void OnAppearing() + { + base.OnAppearing(); + GarbageCollectionHelper.Collect(); + otherLabel.Text = Success; + otherLabel.AutomationId = Success; + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla42832.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla42832.cs new file mode 100644 index 000000000000..b3d360b97d59 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla42832.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 42832, "Scrolling a ListView with active ContextAction Items causes NRE", PlatformAffected.Android)] +public class Bugzilla42832 : TestContentPage +{ + ListView listview; + + protected override void Init() + { + var items = new List(); + for (int i = 0; i < 20; i++) + { + items.Add($"Item #{i}"); + } + + var template = new DataTemplate(typeof(TestCell)); + template.SetBinding(TextCell.TextProperty, "."); + template.SetBinding(TextCell.AutomationIdProperty, "."); + + listview = new ListView(ListViewCachingStrategy.RetainElement) + { + AutomationId = "mainList", + ItemsSource = items, + ItemTemplate = template + }; + var label = new Label + { + Text = "Touch and hold the item #0, until \"Test Item\" appear. So scroll the list until the end. If the app don't crash the test has passed" + }; + Content = new StackLayout + { + Children = + { + label, + listview + } + }; + } + + [Preserve(AllMembers = true)] + public class TestCell : TextCell + { + public TestCell() + { + var menuItem = new MenuItem { Text = "Test Item" }; + ContextActions.Add(menuItem); + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43161.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43161.cs new file mode 100644 index 000000000000..7ffa9d47a95e --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43161.cs @@ -0,0 +1,51 @@ +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 43161, "[iOS] Setting Accessory in ViewCellRenderer breaks layout", PlatformAffected.iOS)] +public class Bugzilla43161 : TestContentPage +{ + const string Instructions = "On iOS, all three of the following ListViews should have ListItems labeled with numbers and a right arrow. If any of the ListViews does not contain numbers, this test has failed."; + const string ListView1 = "Accessory with Context Actions"; + const string ListView2 = "Accessory with RecycleElement"; + const string ListView3 = "Accessory with RetainElement"; + + [Preserve(AllMembers = true)] + public class AccessoryViewCell : ViewCell + { + public AccessoryViewCell() + { + var label = new Label(); + label.SetBinding(Label.TextProperty, "."); + label.SetBinding(Label.AutomationIdProperty, "."); + View = label; + } + } + + [Preserve(AllMembers = true)] + public class AccessoryViewCellWithContextActions : AccessoryViewCell + { + public AccessoryViewCellWithContextActions() + { + var label = new Label(); + label.SetBinding(Label.TextProperty, "."); + View = label; + + var delete = new MenuItem { Text = "Delete" }; + ContextActions.Add(delete); + } + } + + protected override void Init() + { + var label = new Label { Text = Instructions }; + var listView = new ListView { ItemTemplate = new DataTemplate(typeof(AccessoryViewCellWithContextActions)), ItemsSource = Enumerable.Range(0, 9), Header = ListView1 }; + var listView2 = new ListView(ListViewCachingStrategy.RecycleElement) { ItemTemplate = new DataTemplate(typeof(AccessoryViewCell)), ItemsSource = Enumerable.Range(10, 19), Header = ListView2 }; + var listView3 = new ListView { ItemTemplate = new DataTemplate(typeof(AccessoryViewCell)), ItemsSource = Enumerable.Range(20, 29), Header = ListView3 }; + + Content = new StackLayout { Children = { label, listView, listView2, listView3 } }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43469.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43469.cs new file mode 100644 index 000000000000..1bf41b69ea89 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43469.cs @@ -0,0 +1,53 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 43469, "Calling DisplayAlert twice in WinRT causes a crash", PlatformAffected.WinRT)] + +public class Bugzilla43469 : TestContentPage +{ + const string kButtonText = "Click to call DisplayAlert six times. Click as fast as you can to close them as they popup to ensure it doesn't crash."; + protected override void Init() + { + var button = new Button { Text = kButtonText, AutomationId = "kButton" }; + + button.Clicked += async (sender, args) => + { + await DisplayAlert("First", "Text", "OK", "Cancel"); + await DisplayAlert("Second", "Text", "OK", "Cancel"); + await DisplayAlert("Three", "Text", "OK", "Cancel"); +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(new Action(async () => + { + await DisplayAlert("Fourth", "Text", "OK", "Cancel"); + })); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(new Action(async () => + { + await DisplayAlert("Fifth", "Text", "OK", "Cancel"); + })); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(new Action(async () => + { + await DisplayAlert("Sixth", "Text", "OK", "Cancel"); + })); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + }; + + Content = button; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43527.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43527.cs new file mode 100644 index 000000000000..e801971627c0 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43527.cs @@ -0,0 +1,44 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 43527, "[UWP] Detail title does not update when wrapped in a NavigationPage", PlatformAffected.WinRT)] +public class Bugzilla43527 : TestFlyoutPage +{ + protected override void Init() + { + Flyout = new ContentPage + { + Title = "Flyout", + BackgroundColor = Colors.Red + }; + + Detail = new NavigationPage(new TestPage()); + } + + class TestPage : ContentPage + { + public TestPage() + { + Title = "Test Page"; + AutomationId = "Test Page"; + + Content = new StackLayout + { + Children = { + new Label { Text = "Hello Page" }, + new Button { Text = "Change Title", AutomationId = "Change Title", Command = new Command(() => + { + Title = $"New Title: {DateTime.Now.Second}"; + AutomationId = Title; + }) + } + } + }; + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43663.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43663.cs new file mode 100644 index 000000000000..ea1321bacc24 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43663.cs @@ -0,0 +1,114 @@ +using System; +using System.Runtime.CompilerServices; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 43663, "ModalPushed and ModalPopped not working on WinRT", PlatformAffected.WinRT)] +public class Bugzilla43663 : TestNavigationPage +{ + const string Message = "Message"; + + const string GoBack = "Go back"; + + const string Cancel = "Cancel"; + + const string PushModal = "Push Modal"; + + const string PopModal = "Pop Modal"; + + const string Modal = "Modal"; + protected override void Init() + { + Application.Current.ModalPushed += ModalPushed; + Application.Current.ModalPopped += ModalPopped; + + var initialPage = new ContentPage(); + var insertedPage = new ContentPage + { + Content = new StackLayout + { + Children = + { + new Label + { + Text = "This page's appearing unsubscribes from the ModalPushed/ModalPopped events", + HorizontalTextAlignment = TextAlignment.Center + }, + new Button + { + Text = GoBack, + Command = new Command(async () => await Navigation.PopModalAsync()) + } + } + } + }; + insertedPage.Appearing += (s, e) => + { + Application.Current.ModalPushed -= ModalPushed; + Application.Current.ModalPopped -= ModalPopped; + }; + + var modalPage = new ContentPage(); + modalPage.Content = new StackLayout + { + Children = + { + new Label { Text = Modal, AutomationId = Modal }, + new Label + { + Text = "Now press the button bellow, and verify if you go back to previous page. If back's you've success!", + HorizontalTextAlignment= TextAlignment.Center + }, + new Button + { + Text = "Click to dismiss modal", + Command = new Command(async() => + { + await Navigation.PopModalAsync(); + }), + AutomationId = PopModal + } + }, + }; + + initialPage.Content = new StackLayout + { + VerticalOptions = LayoutOptions.Center, + Children = + { + new Label + { + Text = "Verify if after you press the \"Click to push Modal\" button, you navigate to Modal Page.", + HorizontalTextAlignment = TextAlignment.Center + }, + new Button + { + Text = "Click to push Modal", + Command = new Command(async () => await Navigation.PushModalAsync(modalPage)), + AutomationId = PushModal + }, + new Button + { + Text = GoBack, + Command = new Command(async () => await Navigation.PopAsync()) + } + } + }; + + PushAsync(initialPage); + Navigation.InsertPageBefore(insertedPage, initialPage); + } + + void ModalPushed(object sender, ModalPushedEventArgs e) + { + DisplayAlert("Pushed", Message, Cancel); + } + + void ModalPopped(object sender, ModalPoppedEventArgs e) + { + DisplayAlert("Popped", Message, Cancel); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43941.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43941.cs new file mode 100644 index 000000000000..21e3cea305ce --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla43941.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 43941, "Memory leak with ListView's RecycleElement on iOS", PlatformAffected.iOS)] +public class Bugzilla43941 : TestNavigationPage +{ + protected override void Init() + { + PushAsync(new LandingPage43941()); + } +} + +[Preserve(AllMembers = true)] +public class ContentPage43941 : ContentPage +{ + public ContentPage43941() + { + Interlocked.Increment(ref LandingPage43941.Counter); + System.Diagnostics.Debug.WriteLine("Page: " + LandingPage43941.Counter); + + var list = new List(); + for (var i = 0; i < 30; i++) + { + list.Add(i); + } + + Title = "ContentPage43941"; + Content = new ListView + { + HasUnevenRows = true, + ItemsSource = list, + AutomationId = "ListView" + }; + } + + ~ContentPage43941() + { + Interlocked.Decrement(ref LandingPage43941.Counter); + System.Diagnostics.Debug.WriteLine("Page: " + LandingPage43941.Counter); + } +} + +[Preserve(AllMembers = true)] +public class LandingPage43941 : ContentPage +{ + public static int Counter; + public Label Label; + + public LandingPage43941() + { + Label = new Label + { + Text = "Counter: " + Counter, + AutomationId = "counterlabel", + HorizontalTextAlignment = TextAlignment.Center, + VerticalTextAlignment = TextAlignment.Center + }; + + Content = new StackLayout + { + Orientation = StackOrientation.Vertical, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + Spacing = 15, + Children = + { + new Label + { + Text = "Click Push to show a ListView. When you hit the Back button, Counter will show the number of pages that have not been finalized yet." + + " If you click GC, the counter should be 0." + }, + Label, + new Button + { + Text = "GC", + AutomationId = "GC", + Command = new Command(o => + { + GarbageCollectionHelper.Collect(); + Label.Text = "Counter: " + Counter; + }) + }, + new Button + { + Text = "Push", + AutomationId = "Push", + Command = new Command(async o => + { + await Navigation.PushAsync(new ContentPage43941()); + }) + } + } + }; + } + + protected override void OnAppearing() + { + base.OnAppearing(); + + if (Label != null) + Label.Text = "Counter: " + Counter; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44044.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44044.cs new file mode 100644 index 000000000000..b0b5fc514ed1 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44044.cs @@ -0,0 +1,52 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.PlatformConfiguration; +using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific; +using Button = Microsoft.Maui.Controls.Button; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 44044, "TabbedPage steals swipe gestures", PlatformAffected.Android)] +public class Bugzilla44044 : TestTabbedPage +{ + string _btnToggleSwipe = "btnToggleSwipe"; + string _btnDisplayAlert = "btnDisplayAlert"; + + protected override void Init() + { + Children.Add(new ContentPage() + { + Title = "Page 1", + Content = new StackLayout + { + Children = + { + new Button + { + Text = "Click to Toggle Swipe Paging", + Command = new Command(() => On().SetIsSwipePagingEnabled(!On().IsSwipePagingEnabled())), + AutomationId = _btnToggleSwipe + } + } + } + }); + + Children.Add(new ContentPage() + { + Title = "Page 2", + Content = new StackLayout + { + Children = + { + new Button + { + Text = "Click to DisplayAlert", + Command = new Command(() => DisplayAlert("Page 2", "Message", "Cancel")), + AutomationId = _btnDisplayAlert + } + } + } + }); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44129.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44129.cs new file mode 100644 index 000000000000..43ebd1f30a51 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44129.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.ObjectModel; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 44129, "Crash when adding tabbed page after removing all pages using DataTemplates")] +public class Bugzilla44129 : TestTabbedPage +{ + protected override void Init() + { + // Initialize ui here instead of ctor + var viewModels = new ObservableCollection(); + viewModels.Add("First"); + viewModels.Add("Second"); + var template = new DataTemplate(() => + { + ContentPage page = new ContentPage(); + var crashMe = new Button { Text = "Crash Me" }; + crashMe.Clicked += (sender, args) => + { + viewModels.Clear(); + viewModels.Add("Third"); + }; + + page.Content = crashMe; + page.SetBinding(ContentPage.TitleProperty, "."); + page.SetBinding(ContentPage.AutomationIdProperty, "."); + + return page; + }); + + ItemTemplate = template; + ItemsSource = viewModels; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44166.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44166.cs new file mode 100644 index 000000000000..9c55197dae14 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44166.cs @@ -0,0 +1,159 @@ +using System; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Threading; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Devices; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 44166, "FlyoutPage instances do not get disposed upon GC")] +public class Bugzilla44166 : TestContentPage +{ + protected override void Init() + { + var label = new Label() { Text = "Testing..." }; + + var goButton = new Button { Text = "Go", AutomationId = "Go" }; + goButton.Clicked += (sender, args) => Application.Current.MainPage = new _44166MDP(); + + var gcButton = new Button { Text = "GC", AutomationId = "GC" }; + gcButton.Clicked += (sender, args) => + { + GarbageCollectionHelper.Collect(); + + if (_44166MDP.Counter > 0) + { + Debug.WriteLine($">>>>>>>> Post-GC, {_44166MDP.Counter} {nameof(_44166MDP)} allocated"); + } + + if (_44166Master.Counter > 0) + { + Debug.WriteLine($">>>>>>>> Post-GC, {_44166Master.Counter} {nameof(_44166Master)} allocated"); + } + + if (_44166Detail.Counter > 0) + { + Debug.WriteLine($">>>>>>>> Post-GC, {_44166Detail.Counter} {nameof(_44166Detail)} allocated"); + } + + if (_44166NavContent.Counter > 0) + { + Debug.WriteLine($">>>>>>>> Post-GC, {_44166NavContent.Counter} {nameof(_44166NavContent)} allocated"); + } + + int success = 0; + + //some reason there's always 1 instance around i don't know why yet, if we were leaking it should be 8 here + if (DeviceInfo.Platform == DevicePlatform.macOS) + success = 4; + + if (_44166NavContent.Counter + _44166Detail.Counter + _44166Master.Counter + _44166MDP.Counter == success) + { + label.Text = "Success"; + } + }; + + Content = new StackLayout + { + Children = { label, goButton, gcButton } + }; + } +} + +[Preserve(AllMembers = true)] +public class _44166MDP : FlyoutPage +{ + public static int Counter; + + public _44166MDP() + { + Interlocked.Increment(ref Counter); + Debug.WriteLine($"++++++++ {nameof(_44166MDP)} constructor, {Counter} allocated"); + + Flyout = new _44166Master(); + Detail = new _44166Detail(); + } + + ~_44166MDP() + { + Interlocked.Decrement(ref Counter); + Debug.WriteLine($"-------- {nameof(_44166MDP)} destructor, {Counter} allocated"); + } +} + +[Preserve(AllMembers = true)] +public class _44166Master : ContentPage +{ + public static int Counter; + + public _44166Master() + { + Interlocked.Increment(ref Counter); + Debug.WriteLine($"++++++++ {nameof(_44166Master)} constructor, {Counter} allocated"); + + Title = "Flyout"; + var goButton = new Button { Text = "Return", AutomationId = "Return" }; + goButton.Clicked += (sender, args) => Application.Current.MainPage = new Bugzilla44166(); + + Content = new StackLayout + { + Children = { goButton } + }; + } + + ~_44166Master() + { + Interlocked.Decrement(ref Counter); + Debug.WriteLine($"-------- {nameof(_44166Master)} destructor, {Counter} allocated"); + } +} + +[Preserve(AllMembers = true)] +public class _44166Detail : NavigationPage +{ + public static int Counter; + + public _44166Detail() + { + Interlocked.Increment(ref Counter); + Debug.WriteLine($"++++++++ {nameof(_44166Detail)} constructor, {Counter} allocated"); + + Title = "Detail"; + PushAsync(new _44166NavContent()); + } + + ~_44166Detail() + { + Interlocked.Decrement(ref Counter); + Debug.WriteLine($"-------- {nameof(_44166Detail)} destructor, {Counter} allocated"); + } +} + +[Preserve(AllMembers = true)] +public class _44166NavContent : ContentPage +{ + public static int Counter; + + public _44166NavContent() + { + Interlocked.Increment(ref Counter); + Debug.WriteLine($"++++++++ {nameof(_44166NavContent)} constructor, {Counter} allocated"); + + var goButton = new Button { Text = "Previous", AutomationId = "Previous" }; + goButton.Clicked += (sender, args) => Application.Current.MainPage = new Bugzilla44166(); + + Content = new StackLayout + { + Children = { goButton } + }; + } + + ~_44166NavContent() + { + Interlocked.Decrement(ref Counter); + Debug.WriteLine($"-------- {nameof(_44166NavContent)} destructor, {Counter} allocated"); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44338.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44338.cs new file mode 100644 index 000000000000..715d0bc9e59a --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44338.cs @@ -0,0 +1,54 @@ +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 44338, "Tapping off of a cell with an open context action causes a crash in iOS 10", PlatformAffected.iOS)] +public class Bugzilla44338 : TestContentPage +{ + string[] _items; + public string[] Items + { + get + { + if (_items == null) + { + _items = new string[] { "A", "B", "C" }; + } + + return _items; + } + } + + protected override void Init() + { + Content = new ListView + { + ItemsSource = Items, + ItemTemplate = new DataTemplate(() => + { + var label = new Label(); + label.SetBinding(Label.TextProperty, "."); + label.SetBinding(Label.AutomationIdProperty, "."); + var view = new ViewCell + { + View = new StackLayout + { + Children = + { + label + } + } + }; + view.ContextActions.Add(new MenuItem + { + Text = "Action", + Command = new Command(() => DisplayAlert("Alert", "Context Action Pressed", "Close")) + }); + return view; + }) + }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44886.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44886.cs new file mode 100644 index 000000000000..c315ea59d38c --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla44886.cs @@ -0,0 +1,87 @@ +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 44886, "UWP Listview ItemSelected event triggered twice for each selection", PlatformAffected.UWP)] +public class Bugzilla44886 : TestContentPage +{ + const string Item1 = "Item 1"; + const string Instructions = "Select one of the items in the list. The text in blue should show 1, indicating that the ItemSelected event fired once. If it shows 2, this test has failed. Be sure to also test Keyboard selection and Narrator selection. On UWP, the ItemSelected event should fire when an item is highlighted and again when it is un-highlighted (by pressing spacebar)."; + const string CountId = "countId"; + + Label _CountLabel = new Label { AutomationId = CountId, TextColor = Colors.Blue }; + MyViewModel _vm = new MyViewModel(); + + [Preserve(AllMembers = true)] + class MyViewModel : INotifyPropertyChanged + { + int _count; + public int Count + { + get { return _count; } + set + { + if (value != _count) + { + _count = value; + RaisePropertyChanged(); + } + } + } + + void RaisePropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler handler = PropertyChanged; + + handler?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + #region INotifyPropertyChanged implementation + + public event PropertyChangedEventHandler PropertyChanged; + + #endregion + } + + protected override void Init() + { + BindingContext = _vm; + + _CountLabel.SetBinding(Label.TextProperty, nameof(MyViewModel.Count)); + + var listView = new ListView + { + ItemsSource = new List { Item1, "Item 2", "Item 3", "Item 4", "Item 5" } + }; + listView.ItemTemplate = new DataTemplate(() => + { + var cell = new TextCell(); + cell.SetBinding(TextCell.TextProperty, "."); + cell.SetBinding(TextCell.AutomationIdProperty, "."); + return cell; + }); + listView.ItemSelected += ListView_ItemSelected; + + var stack = new StackLayout { Children = { new Label { Text = Instructions }, _CountLabel, listView } }; + Content = stack; + } + + void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) + { + if (e.SelectedItem == null) + { + return; //ItemSelected is called on deselection, which results in SelectedItem being set to null + } + + _vm.Count++; + + ListView lst = (ListView)sender; + lst.SelectedItem = null; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45027.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45027.cs new file mode 100644 index 000000000000..6a941de96fce --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45027.cs @@ -0,0 +1,79 @@ +using System.Collections.Generic; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 45027, "App crashes when double tapping on ToolbarItem or MenuItem very quickly", PlatformAffected.Android)] +public class Bugzilla45027 : TestContentPage +{ + const string BUTTON_ACTION_TEXT = "Action"; + const string BUTTON_DELETE_TEXT = "Delete"; + + List _list; + public List List + { + get + { + if (_list == null) + { + _list = new List(); + for (var i = 0; i < 10; i++) + _list.Add(i); + } + + return _list; + } + } + + protected override void Init() + { + var stackLayout = new StackLayout + { + Orientation = StackOrientation.Vertical, + Children = + { + new Label + { + Text = "Long tap list items to display context menu. Double tapping each action rapidly should not crash.", + HorizontalTextAlignment = TextAlignment.Center + } + } + }; + + var listView = new ListView + { + ItemsSource = List, + ItemTemplate = new DataTemplate(() => + { + var label = new Label(); + label.SetBinding(Label.TextProperty, new Binding(".")); + label.SetBinding(Label.AutomationIdProperty, new Binding(".")); + + return new ViewCell + { + View = new ContentView + { + Content = label, + }, + ContextActions = { new MenuItem + { + Text = BUTTON_ACTION_TEXT, + AutomationId = BUTTON_ACTION_TEXT + }, + new MenuItem + { + Text = BUTTON_DELETE_TEXT, + AutomationId = BUTTON_DELETE_TEXT, + IsDestructive = true + } } + }; + }) + }; + stackLayout.Children.Add(listView); + + Content = stackLayout; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45125.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45125.cs new file mode 100644 index 000000000000..41e16a0f651d --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45125.cs @@ -0,0 +1,237 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 45125, "ListView lacks a way to get information about visible elements (such as FirstVisibleItem) to restore visual positions of elements", PlatformAffected.iOS)] +public class Bugzilla45125 : TestContentPage +{ + int _TestNumber = 0; + + const string Instructions = "The black area below should show text listing appearing and disappearing events for the ListView beside it. It should update as you scroll the ListView, with each row firing a single Disappearing event and a single Appearing event as it leaves and enters the visible screen, respectively. If this does not happen, this test has failed."; + const string AppearingLabelId = "appearing"; + const string DisappearingLabelId = "disappearing"; + const string TestButtonId = "TestButtonId"; + + static int _Appearing = 0; + static int _Disappearing = 0; + + static Label _status = new Label + { + TextColor = Colors.White, + //TODO: NoWrap causes the Label to be missing from the Horizontal StackLayout + //LineBreakMode = LineBreakMode.NoWrap + }; + + static Label _groupsAppearing = new Label + { + TextColor = Colors.Green, + AutomationId = AppearingLabelId + }; + + static Label _groupsDisappearing = new Label + { + TextColor = Colors.Blue, + AutomationId = DisappearingLabelId + }; + + static ScrollView _scroll = new ScrollView + { + BackgroundColor = Colors.Black, + Content = _status, + MinimumWidthRequest = 200 + }; + + [Preserve(AllMembers = true)] + class GroupItem + { + public string DisplayText { get; set; } + } + + [Preserve(AllMembers = true)] + class GroupedData : List + { + public string GroupName { get; set; } + } + + [Preserve(AllMembers = true)] + class MyCell : ViewCell + { + public MyCell() + { + Label newLabel = new Label(); + newLabel.SetBinding(Label.TextProperty, nameof(GroupItem.DisplayText)); + View = newLabel; + } + } + + [Preserve(AllMembers = true)] + class HeaderCell : ViewCell + { + public HeaderCell() + { + Label newLabel = new Label(); + newLabel.SetBinding(Label.TextProperty, nameof(GroupedData.GroupName)); + View = newLabel; + } + } + + protected override void Init() + { + _status.Text = _groupsAppearing.Text = _groupsDisappearing.Text = ""; + _Appearing = _Disappearing = 0; + _scroll.SetScrolledPosition(0, 0); + + InitTest(ListViewCachingStrategy.RecycleElement, true); + } + + void InitTest(ListViewCachingStrategy cachingStrategy, bool useTemplate) + { + List groups = GetGroups(); + + var listView = new ListView(cachingStrategy) + { + ItemsSource = groups, + ItemTemplate = new DataTemplate(typeof(MyCell)), + HasUnevenRows = true, + + // Must be grouped to repro + IsGroupingEnabled = true + }; + + if (useTemplate) + listView.GroupHeaderTemplate = new DataTemplate(typeof(HeaderCell)); + else + listView.GroupDisplayBinding = new Binding(nameof(GroupedData.GroupName)); + + // Must attach to the ListView's events to repro + listView.ItemAppearing += ListView_ItemAppearing; + listView.ItemDisappearing += ListView_ItemDisappearing; + + var horStack = new StackLayout + { + Orientation = StackOrientation.Horizontal, + Children = { _scroll, listView }, + HeightRequest = 300 + }; + + Button nextButton = new Button { Text = "Next", AutomationId = TestButtonId }; + nextButton.Clicked += NextButton_Clicked; + StackLayout stack = new StackLayout + { + Children = { new Label { Text = Instructions }, _groupsAppearing, _groupsDisappearing, horStack, nextButton } + }; + Content = stack; + + var lastGroup = groups.Last(); + var lastItem = lastGroup.First(); + + var firstGroup = groups.First(); + var firstItem = firstGroup.First(); + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.StartTimer(TimeSpan.FromSeconds(1), () => { listView.ScrollTo(lastItem, lastGroup, ScrollToPosition.End, true); return false; }); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.StartTimer(TimeSpan.FromSeconds(2), () => { listView.ScrollTo(firstItem, firstItem, ScrollToPosition.MakeVisible, true); return false; }); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + + _TestNumber++; + } + + void NextButton_Clicked(object sender, EventArgs e) + { + _status.Text = _groupsAppearing.Text = _groupsDisappearing.Text = ""; + _Appearing = _Disappearing = 0; + _scroll.SetScrolledPosition(0, 0); + + switch (_TestNumber) + { + default: + InitTest(ListViewCachingStrategy.RecycleElement, useTemplate: true); + break; + case 1: + InitTest(ListViewCachingStrategy.RetainElement, useTemplate: true); + break; + case 2: + InitTest(ListViewCachingStrategy.RetainElement, useTemplate: false); + break; + case 3: + InitTest(ListViewCachingStrategy.RecycleElement, useTemplate: false); + break; + } + } + + List GetGroups() + { + List groups = new List(); + + for (int i = 1; i < 100; i++) + { + var group = new GroupedData { GroupName = $"Group {i}" }; + + group.Add(new GroupItem { DisplayText = $"Item {i}" }); + + groups.Add(group); + } + + return groups; + } + + static string GetItemText(object item) + { + var groupDisplayTextItem = item as TemplatedItemsList, Cell>; + var groupItem = item as GroupedData; + var itemItem = item as GroupItem; + + var text = item.ToString(); + + if (groupDisplayTextItem != null) + text = groupDisplayTextItem.Name; + else if (groupItem != null) + text = groupItem.GroupName; + else if (itemItem != null) + text = itemItem.DisplayText; + + return text; + } + + void ListView_ItemDisappearing(object sender, ItemVisibilityEventArgs e) + { + var text = GetItemText(e.Item); + + if (_status.Text?.Length > 500) + _status.Text = ""; + + _Disappearing++; + + _groupsDisappearing.Text = _Disappearing.ToString(); + + _status.Text += $"\r\n {text} Disappearing"; + _scroll.ScrollToAsync(_status, ScrollToPosition.MakeVisible, false); + } + + void ListView_ItemAppearing(object sender, ItemVisibilityEventArgs e) + { + var text = GetItemText(e.Item); + + if (_status.Text?.Length > 500) + _status.Text = ""; + + _Appearing++; + + _groupsAppearing.Text = _Appearing.ToString(); + + _status.Text += $"\r\n {text} Appearing"; + _scroll.ScrollToAsync(_status, ScrollToPosition.MakeVisible, false); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45743.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45743.cs new file mode 100644 index 000000000000..840960672788 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45743.cs @@ -0,0 +1,70 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 45743, "[iOS] Calling DisplayAlert via BeginInvokeOnMainThread blocking other calls on iOS", PlatformAffected.iOS)] +public class Bugzilla45743 : TestNavigationPage +{ + protected override void Init() + { + PushAsync(new ContentPage + { + Content = new StackLayout + { + AutomationId = "Page1", + Children = + { + new Label { Text = "Page 1" } + } + } + }); + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(async () => + { + await DisplayAlert("Title", "Message", "Accept", "Cancel"); + }); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(async () => + { + await PushAsync(new ContentPage + { + AutomationId = "Page2", + Content = new StackLayout + { + Children = + { + new Label { Text = "Page 2", AutomationId = "Page 2" } + } + } + }); + }); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(async () => + { + await DisplayAlert("Title 2", "Message", "Accept", "Cancel"); + }); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(async () => + { + await DisplayActionSheet("ActionSheet Title", "Cancel", "Close", new string[] { "Test", "Test 2" }); + }); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45926.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45926.cs new file mode 100644 index 000000000000..ee5340793cd1 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla45926.cs @@ -0,0 +1,109 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 45926, "MessagingCenter prevents subscriber from being collected", PlatformAffected.All)] +public class Bugzilla45926 : TestNavigationPage +{ + protected override void Init() + { + Button createPage, sendMessage, doGC; + + Label instanceCount = new Label(); + Label messageCount = new Label(); + + instanceCount.Text = $"Instances: {_45926SecondPage.InstanceCounter.ToString()}"; + messageCount.Text = $"Messages: {_45926SecondPage.MessageCounter.ToString()}"; + + var content = new ContentPage + { + Title = "Test", + Content = new StackLayout + { + VerticalOptions = LayoutOptions.Center, + Children = { + (createPage = new Button { Text = "New Page" }), + (sendMessage = new Button { Text = "Send Message" }), + (doGC = new Button { Text = "Do GC" }), + instanceCount, messageCount + } + } + }; + + createPage.Clicked += (s, e) => + { + PushAsync(new _45926IntermediatePage()); + PushAsync(new _45926SecondPage()); + }; + + sendMessage.Clicked += (s, e) => + { +#pragma warning disable CS0618 // Type or member is obsolete + MessagingCenter.Send(this, "Test"); +#pragma warning restore CS0618 // Type or member is obsolete + }; + + doGC.Clicked += (sender, e) => + { + GarbageCollectionHelper.Collect(); + instanceCount.Text = $"Instances: {_45926SecondPage.InstanceCounter.ToString()}"; + messageCount.Text = $"Messages: {_45926SecondPage.MessageCounter.ToString()}"; + }; + + PushAsync(content); + } +} + +[Preserve(AllMembers = true)] +public class _45926IntermediatePage : ContentPage +{ + public _45926IntermediatePage() + { + Content = new Label { Text = "Intermediate Page" }; + } +} + +[Preserve(AllMembers = true)] +public class _45926SecondPage : ContentPage +{ + public static int InstanceCounter = 0; + public static int MessageCounter = 0; + + public _45926SecondPage() + { + Interlocked.Increment(ref InstanceCounter); + + Content = new Label + { + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + Text = "Second Page #" + (InstanceCounter) + }; + +#pragma warning disable CS0618 // Type or member is obsolete + MessagingCenter.Subscribe(this, "Test", OnMessage); +#pragma warning restore CS0618 // Type or member is obsolete + } + + protected override void OnDisappearing() + { + base.OnDisappearing(); + } + + void OnMessage(Bugzilla45926 app) + { + System.Diagnostics.Debug.WriteLine("Got Test message!"); + Interlocked.Increment(ref MessageCounter); + } + + ~_45926SecondPage() + { + Interlocked.Decrement(ref InstanceCounter); + System.Diagnostics.Debug.WriteLine("~SecondPage: {0}", GetHashCode()); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla46363.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla46363.cs new file mode 100644 index 000000000000..7c602555434f --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla46363.cs @@ -0,0 +1,82 @@ +using System.Collections.Generic; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 46363, "TapGestureRecognizer blocks List View Context Actions", PlatformAffected.Android)] +public class Bugzilla46363 : TestContentPage +{ + const string Target = "Two"; + const string ContextAction = "Context Action"; + const string TapSuccess = "Tap Success"; + const string TapFailure = "Tap command executed more than once"; + const string ContextSuccess = "Context Menu Success"; + const string Testing = "Testing"; + + static Command s_tapCommand; + static Command s_contextCommand; + + protected override void Init() + { + var list = new List { "One", Target, "Three", "Four" }; + + var lv = new ListView + { + ItemsSource = list, + ItemTemplate = new DataTemplate(typeof(_46363Template)) + }; + + var instructions = new Label(); + var result = new Label { Text = Testing }; + + s_tapCommand = new Command(() => + { + if (result.Text == TapSuccess || result.Text == TapFailure) + { + // We want this test to fail if the tap command is executed more than once + result.Text = TapFailure; + } + else + { + result.Text = TapSuccess; + } + }); + + s_contextCommand = new Command(() => + { + result.Text = ContextSuccess; + }); + + var layout = new StackLayout { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill }; + + layout.Children.Add(instructions); + layout.Children.Add(result); + layout.Children.Add(lv); + + Content = layout; + } + + [Preserve(AllMembers = true)] + class _46363Template : ViewCell + { + public _46363Template() + { + var label = new Label(); + label.SetBinding(Label.TextProperty, "."); + View = new StackLayout { Children = { label } }; + + ContextActions.Add(new MenuItem + { + Text = ContextAction, + Command = s_contextCommand + }); + + View.GestureRecognizers.Add(new TapGestureRecognizer + { + Command = s_tapCommand + }); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla46363_2.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla46363_2.cs new file mode 100644 index 000000000000..17b64594a13d --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla46363_2.cs @@ -0,0 +1,90 @@ +using System.Collections.Generic; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 46363, "TapGestureRecognizer blocks List View Context Actions1", + PlatformAffected.Android, issueTestNumber: 1)] +public class Bugzilla46363_2 : TestContentPage +{ + // This test case covers a scenario similar to Bugzilla46363, but with the TapGesture + // added to a nested StackLayout within the ViewCell template + + const string Target = "Two"; + const string ContextAction = "Context Action"; + const string TapSuccess = "Tap Success"; + const string TapFailure = "Tap command executed more than once"; + const string ContextSuccess = "Context Menu Success"; + const string Testing = "Testing"; + + static Command s_tapCommand; + static Command s_contextCommand; + + protected override void Init() + { + var list = new List { "One", Target, "Three", "Four" }; + + var lv = new ListView + { + ItemsSource = list, + ItemTemplate = new DataTemplate(typeof(_46363Template_2)) + }; + + var instructions = new Label(); + var result = new Label { Text = Testing }; + + s_tapCommand = new Command(() => + { + if (result.Text == TapSuccess || result.Text == TapFailure) + { + // We want this test to fail if the tap command is executed more than once + result.Text = TapFailure; + } + else + { + result.Text = TapSuccess; + } + }); + + s_contextCommand = new Command(() => + { + result.Text = ContextSuccess; + }); + + var layout = new StackLayout { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.Fill }; + + layout.Children.Add(instructions); + layout.Children.Add(result); + layout.Children.Add(lv); + + Content = layout; + } + + [Preserve(AllMembers = true)] + class _46363Template_2 : ViewCell + { + public _46363Template_2() + { + var label = new Label(); + label.SetBinding(Label.TextProperty, "."); + + var innerStackLayout = new StackLayout { Children = { label }, Padding = new Thickness(4, 4, 4, 10) }; + var outerStackLayout = new StackLayout { Children = { innerStackLayout } }; + + View = outerStackLayout; + + ContextActions.Add(new MenuItem + { + Text = ContextAction, + Command = s_contextCommand + }); + + innerStackLayout.GestureRecognizers.Add(new TapGestureRecognizer + { + Command = s_tapCommand + }); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla47923.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla47923.cs new file mode 100644 index 000000000000..cc5d21fe84dd --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla47923.cs @@ -0,0 +1,122 @@ +using System.Collections.Generic; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 47923, "Vectors don\'t work in Images, and work badly in Buttons", PlatformAffected.Android)] +public class Bugzilla47923 : TestNavigationPage +{ + protected override void Init() + { + PushAsync(new LandingPage()); + } + + [Preserve(AllMembers = true)] + public class VectorImagePage : ContentPage + { + public VectorImagePage(Aspect aspect) + { + var scrollView = new ScrollView(); + var stackLayout = new StackLayout + { + Orientation = StackOrientation.Vertical, + Spacing = 10 + }; + + var vectors = new[] { "cartman", "heart", "error" }; + + for (var i = 0; i < vectors.Length; i++) + { + for (var j = 0; j < 3; j++) + { + var image = new Image + { + Source = vectors[i], + WidthRequest = j == 1 ? 150 : 300, + HeightRequest = j == 2 ? 150 : 300, + BackgroundColor = i == 0 ? Colors.Red : (i == 1 ? Colors.Green : Colors.Yellow), + HorizontalOptions = LayoutOptions.Center, + Aspect = aspect + }; + stackLayout.Children.Add(image); + } + } + + scrollView.Content = stackLayout; + Content = scrollView; + } + } + + [Preserve(AllMembers = true)] + public class CellViewPage : ContentPage + { + public CellViewPage() + { + var list = new List(); + for (var i = 0; i < 50; i++) + list.Add(i); + + var listView = new ListView + { + ItemsSource = list, + ItemTemplate = new DataTemplate(() => new ImageCell { ImageSource = "cartman" }) + }; + + Content = listView; + } + } + + [Preserve(AllMembers = true)] + public class LandingPage : ContentPage + { + public LandingPage() + { + var scrollView = new ScrollView(); + var stackLayout = new StackLayout + { + Orientation = StackOrientation.Vertical, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + Spacing = 10 + }; + + var button1 = new Button + { + Text = "AspectFit", + Command = new Command(() => { Navigation.PushAsync(new VectorImagePage(Aspect.AspectFit)); }), + HorizontalOptions = LayoutOptions.Center + }; + stackLayout.Children.Add(button1); + + var button2 = new Button + { + Text = "AspectFill", + Command = new Command(() => { Navigation.PushAsync(new VectorImagePage(Aspect.AspectFill)); }), + HorizontalOptions = LayoutOptions.Center + }; + stackLayout.Children.Add(button2); + + var button3 = new Button + { + Text = "Fill", + Command = new Command(() => { Navigation.PushAsync(new VectorImagePage(Aspect.Fill)); }), + HorizontalOptions = LayoutOptions.Center + }; + stackLayout.Children.Add(button3); + + var button4 = new Button + { + Text = "Test cell views", + Command = new Command(() => { Navigation.PushAsync(new CellViewPage()); }), + HorizontalOptions = LayoutOptions.Center + }; + stackLayout.Children.Add(button4); + + scrollView.Content = stackLayout; + Content = scrollView; + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla51825.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla51825.cs new file mode 100644 index 000000000000..628ba469f42f --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla51825.cs @@ -0,0 +1,42 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 51825, "[iOS] Korean input in SearchBar doesn't work", PlatformAffected.iOS)] +public class Bugzilla51815 : TestContentPage +{ + protected override void Init() + { + var sb = new SearchBar { AutomationId = "Bugzilla51825SearchBar" }; + var text = new Label { AutomationId = "Bugzilla51825Label" }; + sb.TextChanged += (sender, e) => + { + text.Text = sb.Text; + }; + + Content = new StackLayout + { + Children = + { + sb, + new Button + { + AutomationId = "Bugzilla51825Button", + Text = "Change SearchBar text", + Command = new Command(() => + { + sb.Text = "Test"; + }) + }, + text, + new Label + { + Text = "The label above should match the text in the SearchBar; " + + "additionally, typing Korean characters should properly combine them." + } + } + }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla52419.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla52419.cs new file mode 100644 index 000000000000..bf87bc8f0b4e --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla52419.cs @@ -0,0 +1,81 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 52419, "[A] OnAppearing called for previous pages in a tab's navigation when switching active tabs", PlatformAffected.Android)] +public class Bugzilla52419 : TestTabbedPage +{ + protected override void Init() + { + var nav1 = new NavigationPage { Title = "Tab Page 1" }; + nav1.PushAsync(new Bugzilla52419Page1()); + var nav2 = new NavigationPage { Title = "Tab Page 2" }; + nav2.PushAsync(new Bugzilla52419Page2()); + Children.Add(nav1); + Children.Add(nav2); + } +} + +class Bugzilla52419Page1 : ContentPage +{ + public Label _timesAppeared { get; set; } + int _count; + + string _guid = Guid.NewGuid().ToString(); + public Bugzilla52419Page1() + { + _timesAppeared = new Label + { + Text = "Times Appeared: " + _count.ToString(), + AutomationId = "AppearanceLabel" + }; + Content = new StackLayout + { + Children = + { + new Label + { + Text = "Page Guid: " + _guid + }, + _timesAppeared, + new Label + { + Text = "Click the button a couple times, switch to the second tab, and then back to the first. The Appearing event (which increase the counter) should only occur for the visible first tab." + }, + new Button + { + Text = "Push new page", + Command = new Command(() => Navigation.PushAsync(new Bugzilla52419Page1())) + } + } + }; + Appearing += OnAppearing; + } + + void OnAppearing(object sender, EventArgs e) + { + _count++; + _timesAppeared.Text = "Times Appeared: " + _count.ToString(); + } +} + +class Bugzilla52419Page2 : ContentPage +{ + public Bugzilla52419Page2() + { + Title = "Tab Page 2"; + Content = new StackLayout + { + Children = + { + new Label + { + Text = "Other content" + } + } + }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla53179_1.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla53179_1.cs new file mode 100644 index 000000000000..2e2726ffd3ee --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla53179_1.cs @@ -0,0 +1,65 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 53179, + "1PopAsync crashing after RemovePage when support packages are updated to 25.1.1", + PlatformAffected.Android, issueTestNumber: 1)] +public class Bugzilla53179_1 : TestNavigationPage +{ + ContentPage _intermediate1; + ContentPage _intermediate2; + + protected override async void Init() + { + _intermediate1 = Intermediate(); + _intermediate2 = Intermediate(); + + await PushAsync(Root()); + await PushAsync(_intermediate1); + await PushAsync(_intermediate2); + await PushAsync(Last()); + } + + const string StartTest = "Start Test"; + const string RootLabel = "Root"; + + ContentPage Last() + { + var test = new Button { Text = StartTest }; + + var instructions = new Label + { + Text = + $"Tap the button labeled '{StartTest}'. The app should navigate to a page displaying the label " + + $"'{RootLabel}'. If the application crashes, the test has failed." + }; + + var layout = new StackLayout(); + + layout.Children.Add(instructions); + layout.Children.Add(test); + + test.Clicked += (sender, args) => + { + Navigation.RemovePage(_intermediate2); + Navigation.RemovePage(_intermediate1); + + Navigation.PopAsync(true); + }; + + return new ContentPage { Content = layout }; + } + + static ContentPage Root() + { + return new ContentPage { Content = new Label { Text = RootLabel } }; + } + + static ContentPage Intermediate() + { + return new ContentPage { Content = new Label { Text = "Page" } }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla53179_2.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla53179_2.cs new file mode 100644 index 000000000000..81b1094c7144 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla53179_2.cs @@ -0,0 +1,55 @@ +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 53179, "Removing page during OnAppearing throws exception", PlatformAffected.Android, + issueTestNumber: 2)] +public class Bugzilla53179_2 : TestContentPage +{ + const string Success = "Success"; + + protected override void Init() + { + Appearing += async (sender, args) => + { + var nav = new NavigationPage(Root()); + Application.Current.MainPage = nav; + await nav.PushAsync(Intermediate()); + await nav.PushAsync(new PageWhichRemovesAnEarlierPageOnAppearing()); + }; + } + + static ContentPage Root() + { + return new ContentPage { Content = new Label { Text = "Root" } }; + } + + static ContentPage Intermediate() + { + return new ContentPage { Content = new Label { Text = "Intermediate page" } }; + } + + [Preserve(AllMembers = true)] + class PageWhichRemovesAnEarlierPageOnAppearing : ContentPage + { + public PageWhichRemovesAnEarlierPageOnAppearing() + { + var instructions = new Label { Text = "If you can see this, the test has passed" }; + + Content = new StackLayout { Children = { instructions, new Label { Text = Success } } }; + } + + protected override void OnAppearing() + { + var toRemove = Navigation.NavigationStack.Skip(1).First(); + + // toRemove should be the IntermediatePage + Navigation.RemovePage(toRemove); + + base.OnAppearing(); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla56710.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla56710.cs new file mode 100644 index 000000000000..5294779d5e86 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla56710.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.ObjectModel; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 56710, "ContextActionsCell.OnMenuItemPropertyChanged throws NullReferenceException", PlatformAffected.iOS)] +public class Bugzilla56710 : TestNavigationPage +{ + protected override void Init() + { + var root = new ContentPage + { + Content = new Button + { + Text = "Go to Test Page", + Command = new Command(() => PushAsync(new TestPage())) + } + }; + + PushAsync(root); + } +} + +[Preserve(AllMembers = true)] +public class TestPage : ContentPage +{ + ObservableCollection Items; + + public TestPage() + { + Items = new ObservableCollection(); + Items.Add(new Bugzilla56710TestItem { Text = "Item 1", ItemText = "Action 1" }); + Items.Add(new Bugzilla56710TestItem { Text = "Item 2", ItemText = "Action 2" }); + Items.Add(new Bugzilla56710TestItem { Text = "Item 3", ItemText = "Action 3" }); + + var testListView = new ListView + { + ItemsSource = Items, + ItemTemplate = new DataTemplate(typeof(TestCell)) + }; + + Content = testListView; + } + + protected override void OnDisappearing() + { + base.OnDisappearing(); + + Items.Clear(); + } +} + +[Preserve(AllMembers = true)] +public class Bugzilla56710TestItem +{ + public string Text { get; set; } + public string ItemText { get; set; } +} + +[Preserve(AllMembers = true)] +public class TestCell : ViewCell +{ + public TestCell() + { + var menuItem = new MenuItem(); + menuItem.SetBinding(MenuItem.TextProperty, "ItemText"); + ContextActions.Add(menuItem); + + + var textLabel = new Label(); + textLabel.SetBinding(Label.TextProperty, "Text"); + View = textLabel; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57317.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57317.cs new file mode 100644 index 000000000000..4fe2832eed16 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57317.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.ObjectModel; +using System.Windows.Input; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 57317, "Modifying Cell.ContextActions can crash on Android", PlatformAffected.Android)] +public class Bugzilla57317 : TestContentPage +{ + protected override void Init() + { + var tableView = new TableView(); + var tableSection = new TableSection(); + var switchCell = new TextCell + { + Text = "Cell", + AutomationId = "Cell" + }; + + var menuItem = new MenuItem + { + Text = "Self-Deleting item", + Command = new Command(() => switchCell.ContextActions.RemoveAt(0)), + IsDestructive = true + }; + switchCell.ContextActions.Add(menuItem); + tableSection.Add(switchCell); + tableView.Root.Add(tableSection); + Content = tableView; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57515.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57515.cs new file mode 100644 index 000000000000..1d41957c7675 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57515.cs @@ -0,0 +1,127 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 57515, "PinchGestureRecognizer not getting called on Android ", PlatformAffected.Android)] +public class Bugzilla57515 : TestContentPage +{ + const string ZoomImage = "zoomImg"; + const string ZoomContainer = "zoomContainer"; + + protected override void Init() + { + var layout = new Grid + { + RowDefinitions = new RowDefinitionCollection + { + new RowDefinition { Height = 80 }, + new RowDefinition { Height = GridLength.Star } + } + }; + + var scaleLabel = new Label(); + layout.Children.Add(scaleLabel); + + var pinchToZoomContainer = new PinchToZoomContainer + { + Margin = new Thickness(80), + AutomationId = ZoomContainer, + Content = new Image + { + AutomationId = ZoomImage, + Source = ImageSource.FromFile("oasis.jpg") + } + }; + + Grid.SetRow(pinchToZoomContainer, 1); + layout.Children.Add(pinchToZoomContainer); + + scaleLabel.BindingContext = pinchToZoomContainer; + scaleLabel.SetBinding(Label.TextProperty, new Binding("CurrentScale")); + + Content = layout; + } + + class PinchToZoomContainer : ContentView + { + public static readonly BindableProperty CurrentScaleProperty = + BindableProperty.Create("CurrentScale", typeof(double), typeof(PinchToZoomContainer), 1.0); + + public double CurrentScale + { + get { return (double)GetValue(CurrentScaleProperty); } + set { SetValue(CurrentScaleProperty, value); } + } + + double startScale = 1; + double xOffset = 0; + double yOffset = 0; + + public PinchToZoomContainer() + { + var pinchGesture = new PinchGestureRecognizer(); + pinchGesture.PinchUpdated += OnPinchUpdated; + GestureRecognizers.Add(pinchGesture); + } + + void OnPinchUpdated(object sender, PinchGestureUpdatedEventArgs e) + { + if (e.Status == GestureStatus.Started) + { + // Store the current scale factor applied to the wrapped user interface element, + // and zero the components for the center point of the translate transform. + startScale = Content.Scale; + Content.AnchorX = 0; + Content.AnchorY = 0; + } + if (e.Status == GestureStatus.Running) + { + // Calculate the scale factor to be applied. + CurrentScale += (e.Scale - 1) * startScale; + CurrentScale = Math.Max(1, CurrentScale); + + // The ScaleOrigin is in relative coordinates to the wrapped user interface element, + // so get the X pixel coordinate. + double renderedX = Content.X + xOffset; + double deltaX = renderedX / Width; + double deltaWidth = Width / (Content.Width * startScale); + double originX = (e.ScaleOrigin.X - deltaX) * deltaWidth; + + // The ScaleOrigin is in relative coordinates to the wrapped user interface element, + // so get the Y pixel coordinate. + double renderedY = Content.Y + yOffset; + double deltaY = renderedY / Height; + double deltaHeight = Height / (Content.Height * startScale); + double originY = (e.ScaleOrigin.Y - deltaY) * deltaHeight; + + // Calculate the transformed element pixel coordinates. + double targetX = xOffset - (originX * Content.Width) * (CurrentScale - startScale); + double targetY = yOffset - (originY * Content.Height) * (CurrentScale - startScale); + + // Apply translation based on the change in origin. + Content.TranslationX = targetX.Clamp(-Content.Width * (CurrentScale - 1), 0); + Content.TranslationY = targetY.Clamp(-Content.Height * (CurrentScale - 1), 0); + + // Apply scale factor + Content.Scale = CurrentScale; + } + if (e.Status == GestureStatus.Completed) + { + // Store the translation delta's of the wrapped user interface element. + xOffset = Content.TranslationX; + yOffset = Content.TranslationY; + } + } + } +} + +public static class DoubleExtensions +{ + public static double Clamp(this double self, double min, double max) + { + return Math.Min(max, Math.Max(self, min)); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57717.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57717.cs new file mode 100644 index 000000000000..c1b2330a8d17 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57717.cs @@ -0,0 +1,26 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 57717, "Setting background color on Button in Android FormsApplicationActivity causes NRE", PlatformAffected.Android)] +public class Bugzilla57717 : TestContentPage +{ + const string ButtonText = "I am a button"; + + protected override void Init() + { + var layout = new StackLayout(); + + var instructions = new Label { Text = "If you can see this, the test has passed." }; + + var button = new Button { Text = ButtonText, AutomationId = ButtonText, BackgroundColor = Colors.CornflowerBlue }; + + layout.Children.Add(instructions); + layout.Children.Add(button); + + Content = layout; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57749.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57749.cs new file mode 100644 index 000000000000..2c06a04cae1e --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla57749.cs @@ -0,0 +1,33 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 57749, "After enabling a disabled button it is not clickable", PlatformAffected.UWP)] +public class Bugzilla57749 : TestContentPage +{ + protected override void Init() + { + button1.Text = "Click me"; + button1.AutomationId = "btnClick"; + button1.IsEnabled = false; + button1.Clicked += Button1_Clicked1; + this.Content = button1; + } + Button button1 = new Button(); + + private void Button1_Clicked1(object sender, EventArgs e) + { + this.DisplayAlert("Button test", "Button was clicked", "Ok"); + } + + protected override async void OnAppearing() + { + base.OnAppearing(); + await Task.Delay(100); + button1.IsEnabled = true; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla58779.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla58779.cs new file mode 100644 index 000000000000..cd42292d7057 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla58779.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.ObjectModel; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 58779, "[MacOS] DisplayActionSheet on MacOS needs scroll bars if list is long", PlatformAffected.All)] +public class Bugzilla58779 : TestContentPage +{ + const string ButtonId = "button"; + const string CancelId = "cancel"; + + protected override void Init() + { +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Button button = new Button + { + Text = "Click Here", + FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Button), false), + BorderWidth = 1, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.CenterAndExpand, + AutomationId = ButtonId, + }; +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + + // The root page of your application + var content = new StackLayout + { + VerticalOptions = LayoutOptions.Center, + Children = { + new Label { + HorizontalTextAlignment = TextAlignment.Center, + Text = "Tap on the button to show the DisplayActionSheet with 15 items" + }, + new Label { + HorizontalTextAlignment = TextAlignment.Center, + Text = "The list of items should be scrollable and Cancel should be visible" + }, + button + + } + }; + + button.Clicked += (sender, e) => + { + String[] string_array = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15" }; + this.DisplayActionSheet("title", CancelId, "destruction", string_array); + }; + + Content = content; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla58833.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla58833.cs new file mode 100644 index 000000000000..c28ad845e28d --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla58833.cs @@ -0,0 +1,82 @@ +using System.Collections.Generic; +using System.Diagnostics; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 58833, "ListView SelectedItem Binding does not fire", PlatformAffected.Android)] +public class Bugzilla58833 : TestContentPage +{ + const string ItemSelectedSuccess = "ItemSelected Success"; + const string TapGestureSucess = "TapGesture Fired"; + Label _resultLabel; + static Label s_tapGestureFired; + + [Preserve(AllMembers = true)] + class TestCell : ViewCell + { + readonly Label _content; + + internal static int s_index; + + public TestCell() + { + _content = new Label(); + + if (s_index % 2 == 0) + { + _content.GestureRecognizers.Add(new TapGestureRecognizer + { + Command = new Command(() => + { + s_tapGestureFired.Text = TapGestureSucess; + }) + }); + } + + View = _content; + ContextActions.Add(new MenuItem { Text = s_index++ + " Action" }); + } + + protected override void OnBindingContextChanged() + { + base.OnBindingContextChanged(); + _content.Text = (string)BindingContext; + } + } + + protected override void Init() + { + TestCell.s_index = 0; + + _resultLabel = new Label { Text = "Testing..." }; + s_tapGestureFired = new Label { Text = "Testing..." }; + + var items = new List(); + for (int i = 0; i < 5; i++) + items.Add($"Item #{i}"); + + var list = new ListView + { + ItemTemplate = new DataTemplate(typeof(TestCell)), + ItemsSource = items + }; + list.ItemSelected += List_ItemSelected; + + Content = new StackLayout + { + Children = { + _resultLabel, + s_tapGestureFired, + list + } + }; + } + + void List_ItemSelected(object sender, SelectedItemChangedEventArgs e) + { + _resultLabel.Text = ItemSelectedSuccess; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla58875.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla58875.cs new file mode 100644 index 000000000000..482338e85874 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla58875.cs @@ -0,0 +1,76 @@ +using System.Collections.ObjectModel; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 58875, "Back navigation disables Context Action in whole app, if Context Action left open", PlatformAffected.iOS)] +public class Bugzilla58875 : TestNavigationPage +{ + const string Button1Id = "Button1Id"; + const string ContextAction = "More"; + const string Target = "Swipe me"; + + protected override void Init() + { + var page1 = new Page1(); + Navigation.PushAsync(page1); + } + + [Preserve(AllMembers = true)] + class ListViewPage : ContentPage + { + public ListViewPage() + { + BindingContext = this; + + var listView = new ListView(ListViewCachingStrategy.RecycleElement) + { + ItemTemplate = new DataTemplate(() => + { + var label = new Label { }; + label.SetBinding(Label.TextProperty, "."); + var viewcell = new ViewCell + { + View = new StackLayout { Children = { label } } + }; + viewcell.ContextActions.Add(new MenuItem { Text = ContextAction }); + viewcell.ContextActions.Add(new MenuItem { Text = "Delete", IsDestructive = true }); + return viewcell; + }) + }; + + listView.SetBinding(ListView.ItemsSourceProperty, nameof(Items)); + + Items = new ObservableCollection { + "Item 1", + Target, + "Item 3", + "Swipe me too, leave me open", + "Swipe left -> right (trigger back navigation)" + }; + + Content = listView; + } + + public ObservableCollection Items { get; set; } + } + + [Preserve(AllMembers = true)] + class Page1 : ContentPage + { + public Page1() + { + var button = new Button { Text = "Tap me", AutomationId = Button1Id }; + button.Clicked += Button_Clicked; + Content = button; + } + + void Button_Clicked(object sender, System.EventArgs e) + { + var listPage = new ListViewPage(); + Navigation.PushAsync(listPage); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59580.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59580.cs new file mode 100644 index 000000000000..2702d0db4496 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59580.cs @@ -0,0 +1,35 @@ +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 59580, "Raising Command.CanExecutChanged causes crash on Android", + PlatformAffected.Android)] +public class Bugzilla59580 : TestContentPage +{ + protected override void Init() + { + var tableView = new TableView(); + var tableSection = new TableSection(); + var switchCell = new TextCell + { + AutomationId = "Cell", + Text = "Cell" + }; + + var menuItem = new MenuItem + { + AutomationId = "Fire CanExecuteChanged", + Text = "Fire CanExecuteChanged", + Command = new DelegateCommand(_ => + ((DelegateCommand)switchCell.ContextActions.Single().Command).RaiseCanExecuteChanged()), + IsDestructive = true + }; + switchCell.ContextActions.Add(menuItem); + tableSection.Add(switchCell); + tableView.Root.Add(tableSection); + Content = tableView; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59718.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59718.cs new file mode 100644 index 000000000000..e6e17bdd91b8 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59718.cs @@ -0,0 +1,125 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.PlatformConfiguration; +using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific; +using Microsoft.Maui.Graphics; +using Label = Microsoft.Maui.Controls.Label; +using ListView = Microsoft.Maui.Controls.ListView; +using WindowsOS = Microsoft.Maui.Controls.PlatformConfiguration.Windows; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 59718, "Multiple issues with listview and navigation in UWP", PlatformAffected.UWP)] +public class Bugzilla59718 : TestContentPage +{ + const string GoBackButtonId = "GoBackButtonId"; + const string Target1 = "Label with TapGesture Cricket"; + const string Target1b = "Label with TapGesture Cricket Tapped!"; + const string Target2 = "Label with no TapGesture Cricket"; + const string Target3 = "You came here from Cricket."; + + Label _ItemTappedLabel; + Label _LabelTappedLabel; + ListView _list; + + class Grouping : ObservableCollection + { + public K Key { get; private set; } + + public Grouping(K key, IEnumerable items) + { + Key = key; + foreach (var item in items) + this.Items.Add(item); + + } + } + + protected override void Init() + { + _LabelTappedLabel = new Label { TextColor = Colors.Red }; + _ItemTappedLabel = new Label { TextColor = Colors.Purple }; + + _list = new ListView + { + IsGroupingEnabled = true, + GroupDisplayBinding = new Binding("Key"), + ItemTemplate = new DataTemplate(() => + { + var tapLabel = new Label(); + tapLabel.SetBinding(Label.TextProperty, ".", stringFormat: "Label with TapGesture {0}"); + + var tap = new TapGestureRecognizer(); + tap.Tapped += (s, e) => + { + _LabelTappedLabel.Text = $"{tapLabel.Text} Tapped!"; + }; + + tapLabel.GestureRecognizers.Add(tap); + + var noTap = new Label(); + noTap.SetBinding(Label.TextProperty, ".", stringFormat: "Label with no TapGesture {0}"); + + var view = new ViewCell { View = new StackLayout { Children = { noTap, tapLabel } } }; + return view; + }) + }; + + _list.On().SetSelectionMode(Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific.ListViewSelectionMode.Inaccessible); + + _list.ItemTapped += ListView_ItemTapped; + + Content = new StackLayout { Children = { _LabelTappedLabel, _ItemTappedLabel, _list } }; + } + + protected override void OnAppearing() + { + _list.ItemsSource = new ObservableCollection> + { + new Grouping("Sports", new string[] {"Cricket", "Football" }), + new Grouping("Mobile", new string[] {"Samsung", "Apple" }), + new Grouping("Microsoft", new string[] {"Office", "Windows" }), + new Grouping("Games", new string[] {"Online", "Offline" }), + new Grouping("Test", new string[] {"test1", "test2" }), + new Grouping("Variable", new string[] {"String", "Int" }), + }; + ; + + base.OnAppearing(); + } + + async void ListView_ItemTapped(object sender, ItemTappedEventArgs e) + { + _ItemTappedLabel.Text = $"{e.Item}"; + + await Navigation.PushAsync(new NextPage(_ItemTappedLabel.Text)); + + ((ListView)sender).SelectedItem = null; + } + + class NextPage : ContentPage + { + public NextPage(string source) + { + var button = new Button { Text = "Go back", AutomationId = GoBackButtonId }; + button.Clicked += Button_Clicked; + Content = new StackLayout + { + Children = { + new Label { Text = $"You came here from {source}." }, + button + } + }; + } + + async void Button_Clicked(object sender, System.EventArgs e) + { + await Navigation.PopAsync(); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59863_0.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59863_0.cs new file mode 100644 index 000000000000..765dfe87930b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59863_0.cs @@ -0,0 +1,54 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 59863, "TapGestureRecognizer extremely finicky", PlatformAffected.Android)] +public class Bugzilla59863_0 : TestContentPage +{ + int _singleTaps; + const string SingleTapBoxId = "singleTapView"; + + const string Singles = "singles(s)"; + + protected override void Init() + { + var instructions = new Label + { + Text = "Tap the box below several times quickly. " + + "The number displayed below should match the number of times you tap the box." + }; + + var singleTapCounter = new Label { Text = $"{_singleTaps} {Singles}" }; + + var singleTapBox = new BoxView + { + WidthRequest = 100, + HeightRequest = 100, + BackgroundColor = Colors.Bisque, + AutomationId = SingleTapBoxId + }; + + var singleTap = new TapGestureRecognizer + { + Command = new Command(() => + { + _singleTaps = _singleTaps + 1; + singleTapCounter.Text = $"{_singleTaps} {Singles} on {SingleTapBoxId}"; + }) + }; + + singleTapBox.GestureRecognizers.Add(singleTap); + + Content = new StackLayout + { + Margin = 40, + HorizontalOptions = LayoutOptions.Fill, + VerticalOptions = LayoutOptions.Fill, + Children = { instructions, singleTapBox, singleTapCounter } + }; + } + +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59863_1.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59863_1.cs new file mode 100644 index 000000000000..bb5bbba0d54d --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59863_1.cs @@ -0,0 +1,55 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 59863, "TapGestureRecognizer extremely finicky1", PlatformAffected.Android, + issueTestNumber: 1)] +public class Bugzilla59863_1 : TestContentPage +{ + int _doubleTaps; + const string DoubleTapBoxId = "doubleTapView"; + + const string Doubles = "double(s)"; + + protected override void Init() + { + var instructions = new Label + { + Text = "Tap the box below once. The counter should not increment. " + + "Double tap the box. The counter should increment." + }; + + var doubleTapCounter = new Label { Text = $"{_doubleTaps} {Doubles} on {DoubleTapBoxId}" }; + + var doubleTapBox = new BoxView + { + WidthRequest = 100, + HeightRequest = 100, + BackgroundColor = Colors.Chocolate, + AutomationId = DoubleTapBoxId + }; + + var doubleTap = new TapGestureRecognizer + { + NumberOfTapsRequired = 2, + Command = new Command(() => + { + _doubleTaps = _doubleTaps + 1; + doubleTapCounter.Text = $"{_doubleTaps} {Doubles} on {DoubleTapBoxId}"; + }) + }; + + doubleTapBox.GestureRecognizers.Add(doubleTap); + + Content = new StackLayout + { + Margin = 40, + HorizontalOptions = LayoutOptions.Fill, + VerticalOptions = LayoutOptions.Fill, + Children = { instructions, doubleTapBox, doubleTapCounter } + }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59863_2.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59863_2.cs new file mode 100644 index 000000000000..cc063e60cfe1 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla59863_2.cs @@ -0,0 +1,71 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 59863, "TapGestureRecognizer extremely finicky2", PlatformAffected.Android, + issueTestNumber: 2)] +public class Bugzilla59863_2 : TestContentPage +{ + int _mixedSingleTaps; + int _mixedDoubleTaps; + const string MixedTapBoxId = "mixedTapView"; + + const string Singles = "singles(s)"; + const string Doubles = "double(s)"; + + protected override void Init() + { + var instructions = new Label + { + Text = "Tap the box below once. The single tap counter should increment. " + + "Double tap the box. The double tap counter should increment, " + + "but the single tap counter should not." + }; + + var mixedSingleTapCounter = new Label { Text = $"{_mixedSingleTaps} {Singles}" }; + var mixedDoubleTapCounter = new Label { Text = $"{_mixedDoubleTaps} {Doubles}" }; + + var mixedTapBox = new BoxView + { + WidthRequest = 100, + HeightRequest = 100, + BackgroundColor = Colors.Coral, + AutomationId = MixedTapBoxId + }; + + var mixedDoubleTap = new TapGestureRecognizer + { + NumberOfTapsRequired = 2, + Command = new Command(() => + { + _mixedDoubleTaps = _mixedDoubleTaps + 1; + mixedDoubleTapCounter.Text = $"{_mixedDoubleTaps} {Doubles} on {MixedTapBoxId}"; + }) + }; + + var mixedSingleTap = new TapGestureRecognizer + { + NumberOfTapsRequired = 1, + Command = new Command(() => + { + _mixedSingleTaps = _mixedSingleTaps + 1; + mixedSingleTapCounter.Text = $"{_mixedSingleTaps} {Singles} on {MixedTapBoxId}"; + }) + }; + + mixedTapBox.GestureRecognizers.Add(mixedDoubleTap); + mixedTapBox.GestureRecognizers.Add(mixedSingleTap); + + Content = new StackLayout + { + Margin = 40, + HorizontalOptions = LayoutOptions.Fill, + VerticalOptions = LayoutOptions.Fill, + Children = { instructions, mixedTapBox, mixedSingleTapCounter, mixedDoubleTapCounter } + }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60045.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60045.xaml new file mode 100644 index 000000000000..af117d4d2ae4 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60045.xaml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60045.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60045.xaml.cs new file mode 100644 index 000000000000..f535d0dc33ef --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60045.xaml.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 60045, + "ListView with RecycleElement strategy doesn't handle CanExecute of TextCell Command properly", + PlatformAffected.iOS)] +public partial class Bugzilla60045 : TestContentPage +{ + public const string ClickThis = "Click This"; + public const string Fail = "Fail"; + + public object Items { get; set; } + + public Bugzilla60045() + { + + InitializeComponent(); + + } + + protected override void Init() + { + Items = new[] + { + new { + Action = new Command(async () => + { + await DisplayAlert(Fail, "Well, this is embarrassing.", "Ok"); + }, + () => false) } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60122.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60122.cs new file mode 100644 index 000000000000..18e932ea340a --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60122.cs @@ -0,0 +1,46 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 60122, "LongClick on image not working", PlatformAffected.Android)] +public class Bugzilla60122 : TestContentPage +{ + const string ImageId = "60122Image"; + const string Success = "Success"; + + protected override void Init() + { + var customImage = new _60122Image + { + AutomationId = ImageId, + Source = "coffee.png" + }; + + var instructions = new Label + { + Text = $"Long press the image below; the label below it should change to read {Success}" + }; + + var result = new Label { Text = "Testing..." }; + + customImage.LongPress += (sender, args) => { result.Text = Success; }; + + Content = new StackLayout + { + Children = { instructions, customImage, result } + }; + } + + public class _60122Image : Image + { + public event EventHandler LongPress; + + public void HandleLongPress(object sender, EventArgs e) + { + LongPress?.Invoke(this, new EventArgs()); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60524.cs b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60524.cs new file mode 100644 index 000000000000..f20f0078309a --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Bugzilla60524.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Bugzilla, 60524, "NRE when rendering ListView with grouping enabled and HasUnevenRows set to true", PlatformAffected.iOS)] +public class Bugzilla60524 : TestNavigationPage +{ + [Preserve(AllMembers = true)] + public class GroupedItemsPage : ContentPage + { + private ObservableCollection> model; + private ListView listView; + + public GroupedItemsPage() + { + listView = new ListView(ListViewCachingStrategy.RetainElement) { HasUnevenRows = true }; + listView.IsGroupingEnabled = true; + listView.ItemTemplate = new GroupedItemsDataTemplateSelector(); + + var headerCell = new DataTemplate(typeof(TextCell)); + headerCell.SetBinding(TextCell.TextProperty, "Key"); + this.listView.GroupHeaderTemplate = headerCell; + + this.model = new ObservableCollection>(); + this.GetItems(); + + this.SetMainContent(); + } + + private void GetItems() + { + var zeroGroup = new Grouping("Group 0", new List + { + }); + + var firstGroup = new Grouping("Group 1", new List { + new GroupedItem("Group 1", "Item 1"), + new GroupedItem("Group 1", "Item 2") + }); + + var secondGroup = new Grouping("Group 2", new List { + new GroupedItem("Group 2", "Item 3"), + new GroupedItem("Group 2", "Item 4") + }); + + model.Add(zeroGroup); + model.Add(firstGroup); + model.Add(secondGroup); + + this.listView.ItemsSource = model; + } + + private void SetMainContent() + { +#pragma warning disable CS0618 // Type or member is obsolete + var content = new StackLayout + { + VerticalOptions = LayoutOptions.FillAndExpand, + Children = { new Label { Text = "If this page does not crash, this test has passed." }, this.listView } + }; +#pragma warning restore CS0618 // Type or member is obsolete + + Content = content; + } + } + [Preserve(AllMembers = true)] + public class GroupedItemsDataTemplateSelector : Microsoft.Maui.Controls.DataTemplateSelector + { + private readonly DataTemplate firstGroupTemplate; + private readonly DataTemplate secondGroupTemplate; + + public GroupedItemsDataTemplateSelector() + { + // Retain instances + var firstTemplate = new DataTemplate(typeof(TextCell)); + firstTemplate.SetBinding(TextCell.TextProperty, "Item"); + this.firstGroupTemplate = firstTemplate; + + var secondTemplate = new DataTemplate(typeof(ImageCell)); + secondTemplate.SetBinding(ImageCell.TextProperty, "Item"); + this.secondGroupTemplate = secondTemplate; + } + + protected override DataTemplate OnSelectTemplate(object item, BindableObject container) + { + var model = item as GroupedItem; + + if (model == null) + { + return null; + } + + return model.Group == "Group 1" ? this.firstGroupTemplate : this.secondGroupTemplate; + } + } + [Preserve(AllMembers = true)] + public class GroupedItem + { + public string Group { get; set; } + + public string Item { get; set; } + + public GroupedItem(string group, string item) + { + this.Group = group; + this.Item = item; + } + } + [Preserve(AllMembers = true)] + public class Grouping : ObservableCollection + { + public K Key { get; private set; } + + public IList Values + { + get { return this.Items; } + } + + public Grouping(K key, IEnumerable items) + { + Key = key; + foreach (var item in items) + { + this.Items.Add(item); + } + } + + public Grouping(IGrouping grouping) + { + Key = grouping.Key; + foreach (var item in grouping) + { + this.Items.Add(item); + } + } + + public void AddRange(IList values) + { + foreach (var item in values) + { + this.Items.Add(item); + } + } + } + [Preserve(AllMembers = true)] + public class GroupingKey + { + public string Title { get; private set; } + + public string Abbreviation { get; private set; } + + public GroupingKey(string Title, string abbrevation) + { + this.Title = Title; + this.Abbreviation = abbrevation; + } + } + + protected override void Init() + { + Navigation.PushAsync(new GroupedItemsPage()); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/FlyoutBehaviorShell.cs b/src/Controls/tests/TestCases.HostApp/Issues/FlyoutBehaviorShell.cs new file mode 100644 index 000000000000..876e13448eb3 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/FlyoutBehaviorShell.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.PlatformConfiguration; +using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.None, 0, "Shell Flyout Behavior", + PlatformAffected.All)] + +public class FlyoutBehaviorShell : TestShell +{ + BackButtonBehavior _behavior; + const string title = "Basic Test"; + const string FlyoutItem = "Flyout Item"; + const string EnableFlyoutBehavior = "EnableFlyoutBehavior"; + const string DisableFlyoutBehavior = "DisableFlyoutBehavior"; + const string LockFlyoutBehavior = "LockFlyoutBehavior"; + const string OpenFlyout = "OpenFlyout"; + const string EnableBackButtonBehavior = "EnableBackButtonBehavior"; + const string DisableBackButtonBehavior = "DisableBackButtonBehavior"; + + protected override void Init() + { + _behavior = new BackButtonBehavior(); + var page = GetContentPage(title); + Shell.SetBackButtonBehavior(page, _behavior); + AddContentPage(page).Title = FlyoutItem; + Shell.SetFlyoutBehavior(this.CurrentItem, FlyoutBehavior.Disabled); + } + + ContentPage GetContentPage(string title) + { +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0618 // Type or member is obsolete + ContentPage page = new ContentPage() + { + Title = title, + Content = new StackLayout() + { + VerticalOptions = LayoutOptions.FillAndExpand, + BackgroundColor = Colors.Red, + Children = + { + new Button() + { + Text = "Enable Flyout Behavior", + Command = new Command(() => + { + Shell.SetFlyoutBehavior(this.CurrentItem, FlyoutBehavior.Flyout); + this.FlyoutIsPresented = false; + }), + AutomationId = EnableFlyoutBehavior + }, + new Button() + { + Text = "Disable Flyout Behavior", + Command = new Command(() => + { + Shell.SetFlyoutBehavior(this.CurrentItem, FlyoutBehavior.Disabled); + this.FlyoutIsPresented = false; + }), + AutomationId = DisableFlyoutBehavior + }, + new Button() + { + Text = "Lock Flyout Behavior", + Command = new Command(() => + { + Shell.SetFlyoutBehavior(this.CurrentItem, FlyoutBehavior.Locked); + }), + AutomationId = LockFlyoutBehavior + }, + new StackLayout() + { + VerticalOptions = LayoutOptions.CenterAndExpand + }, + new Button() + { + Text = "Open Flyout", + Command = new Command(() => + { + this.FlyoutIsPresented = true; + }), + AutomationId = OpenFlyout, + VerticalOptions = LayoutOptions.End + }, + new Button() + { + Text = "Enable Back Button Behavior", + Command = new Command(() => + { + _behavior.IsEnabled = true; + }), + AutomationId = EnableBackButtonBehavior, + VerticalOptions = LayoutOptions.End + + }, + new Button() + { + Text = "Disable Back Button Behavior", + Command = new Command(() => + { + _behavior.IsEnabled = false; + }), + AutomationId = DisableBackButtonBehavior, + VerticalOptions = LayoutOptions.End + } + } + } + }; +#pragma warning restore CS0618 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + + return page; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/GitHub1331.xaml b/src/Controls/tests/TestCases.HostApp/Issues/GitHub1331.xaml new file mode 100644 index 000000000000..a2860c9cdf12 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/GitHub1331.xaml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/GitHub1331.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/GitHub1331.xaml.cs new file mode 100644 index 000000000000..18c1eaf059d4 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/GitHub1331.xaml.cs @@ -0,0 +1,74 @@ +using System.Collections.ObjectModel; +using System.Windows.Input; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.Xaml; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1331, "[Android] ViewCell shows ContextActions on tap instead of long press", + PlatformAffected.Android)] +public partial class GitHub1331 : TestContentPage +{ + const string Action = "Action 1"; + const string ActionItemTapped = "Action Item Tapped"; + const string CellItem = "item 1"; + + public GitHub1331() + { + + InitializeComponent(); + + var mainViewModel = new GH1331ViewModel + { + Items = new ObservableCollection(new[] + { + new GH1331ItemViewModel + { + Text = CellItem, + ActionText = Action, + ActionTappedCommand = + new Command(() => Result.Text = ActionItemTapped) + }, + new GH1331ItemViewModel + { + Text = "item 2", + ActionText = "Action 2", + ActionTappedCommand = + new Command(() => DisplayAlert("Action tapped", "item 2", "Cancel")) + }, + new GH1331ItemViewModel + { + Text = "item 3", + ActionText = "Action 3", + ActionTappedCommand = + new Command(() => DisplayAlert("Action tapped", "item 3", "Cancel")) + } + }) + }; + + BindingContext = mainViewModel; + + Title = "GH 1331"; + + } + + protected override void Init() + { + } + + [Preserve(AllMembers = true)] + class GH1331ViewModel + { + public ObservableCollection Items { get; set; } + } + + [Preserve(AllMembers = true)] + class GH1331ItemViewModel + { + public string Text { get; set; } + public string ActionText { get; set; } + public ICommand ActionTappedCommand { get; set; } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/GitHub1355_Forms.cs b/src/Controls/tests/TestCases.HostApp/Issues/GitHub1355_Forms.cs new file mode 100644 index 000000000000..252d6964c77c --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/GitHub1355_Forms.cs @@ -0,0 +1,44 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1355, "Setting Main Page in quick succession causes crash on Android", PlatformAffected.Android, issueTestNumber: 1)] +public class Issue1355_Forms : TestContentPage +{ + int _runCount = 0; + int _maxRunCount = 2; + const string Success = "Success"; + + protected override void Init() + { + Appearing += OnAppearing; + } + + private void OnAppearing(object o, EventArgs eventArgs) + { + Application.Current.MainPage = CreatePage(); + } + + ContentPage CreatePage() + { + var page = new ContentPage + { + Content = new Label { Text = Success, AutomationId = Success }, + Title = $"CreatePage Iteration: {_runCount}" + }; + + page.Appearing += (sender, args) => + { + _runCount += 1; + if (_runCount <= _maxRunCount) + { + Application.Current.MainPage = new NavigationPage(CreatePage()); + } + }; + + return page; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/GitHub1650.cs b/src/Controls/tests/TestCases.HostApp/Issues/GitHub1650.cs new file mode 100644 index 000000000000..934ade6dbef0 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/GitHub1650.cs @@ -0,0 +1,47 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1650, "[macOS] Completed event of Entry raised on Tab key", PlatformAffected.macOS)] +public class GitHub1650 : TestContentPage +{ + Label _completedCountLabel = new Label + { + Text = "Completed count: 0", + AutomationId = "CompletedCountLabel" + }; + + int _completedCount; + public int CompletedCount + { + get { return _completedCount; } + set + { + _completedCount = value; + _completedCountLabel.Text = $"Completed count: {value}"; + } + } + + protected override void Init() + { + // Setup our completed entry + var entry = new Entry + { + Placeholder = "Press enter here!", + AutomationId = "CompletedTargetEntry" + }; + entry.Completed += (sender, e) => + { + CompletedCount++; + }; + + StackLayout layout = new StackLayout(); + layout.Children.Add(_completedCountLabel); + layout.Children.Add(entry); + + Content = layout; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/GitHub1776.cs b/src/Controls/tests/TestCases.HostApp/Issues/GitHub1776.cs new file mode 100644 index 000000000000..600be506c7ec --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/GitHub1776.cs @@ -0,0 +1,103 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1776, "Button Released not being triggered", PlatformAffected.macOS)] +public class GitHub1776 : TestContentPage +{ + Label PressedLabel; + int _pressedCount; + int PressedCount + { + get { return _pressedCount; } + set + { + _pressedCount = value; + PressedLabel.Text = $"Pressed: {_pressedCount}"; + } + } + + Label ReleasedLabel; + int _releasedCount; + int ReleasedCount + { + get { return _releasedCount; } + set + { + _releasedCount = value; + ReleasedLabel.Text = $"Released: {_releasedCount}"; + } + } + + Label ClickedLabel; + int _clickedCount; + int ClickedCount + { + get { return _clickedCount; } + set + { + _clickedCount = value; + ClickedLabel.Text = $"Clicked: {_clickedCount}"; + } + } + + Label CommandLabel; + int _commandCount; + int CommandCount + { + get { return _commandCount; } + set + { + _commandCount = value; + CommandLabel.Text = $"Command: {_commandCount}"; + } + } + + protected override void Init() + { + PressedLabel = new Label(); + ReleasedLabel = new Label(); + ClickedLabel = new Label(); + CommandLabel = new Label(); + + var button = new Button + { + Text = "Press me!", + AutomationId = "TheButton" + }; + button.Pressed += (s, e) => + { + PressedCount++; + }; + button.Released += (s, e) => + { + ReleasedCount++; + }; + button.Clicked += (s, e) => + { + ClickedCount++; + }; + button.Command = new Command(() => + { + CommandCount++; + }); + + PressedCount = 0; + ReleasedCount = 0; + ClickedCount = 0; + CommandCount = 0; + + StackLayout layout = new StackLayout(); + + layout.Children.Add(button); + layout.Children.Add(PressedLabel); + layout.Children.Add(ReleasedLabel); + layout.Children.Add(ClickedLabel); + layout.Children.Add(CommandLabel); + + Content = layout; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Github5623.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Github5623.xaml index 27720a659064..edc8b3c9b290 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Github5623.xaml +++ b/src/Controls/tests/TestCases.HostApp/Issues/Github5623.xaml @@ -35,4 +35,4 @@ - \ No newline at end of file + diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Github6384.cs b/src/Controls/tests/TestCases.HostApp/Issues/Github6384.cs index ce832af19de0..514f75b0ca71 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Github6384.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Github6384.cs @@ -3,64 +3,63 @@ using Microsoft.Maui.Controls.CustomAttributes; using Microsoft.Maui.Controls.Internals; -namespace Maui.Controls.Sample.Issues +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 6384, "content page in tabbed page not showing inside shell tab", PlatformAffected.iOS | PlatformAffected.Android)] +public class Github6384 : TestShell { - [Preserve(AllMembers = true)] - [Issue(IssueTracker.Github, 6384, "content page in tabbed page not showing inside shell tab", PlatformAffected.iOS | PlatformAffected.Android)] - public class Github6384 : TestShell + protected override void Init() { - protected override void Init() + var tabOneButton = new Button { - var tabOneButton = new Button - { - AutomationId = "NavigationButton", - Text = "Push me!" - }; + AutomationId = "NavigationButton", + Text = "Push me!" + }; - tabOneButton.Clicked += TabOneButton_Clicked; + tabOneButton.Clicked += TabOneButton_Clicked; - var tabOnePage = new ContentPage { Content = tabOneButton }; + var tabOnePage = new ContentPage { Content = tabOneButton }; - var tabTwoPage = new ContentPage { Content = new Label { Text = "Go to TabOne" } }; - var tabOne = new Tab { Title = "TabOne" }; - var tabTwo = new Tab { Title = "TabTwo" }; - tabOne.Items.Add(tabOnePage); - tabTwo.Items.Add(tabTwoPage); + var tabTwoPage = new ContentPage { Content = new Label { Text = "Go to TabOne" } }; + var tabOne = new Tab { Title = "TabOne" }; + var tabTwo = new Tab { Title = "TabTwo" }; + tabOne.Items.Add(tabOnePage); + tabTwo.Items.Add(tabTwoPage); - Items.Add( - new TabBar - { - Items = { tabOne, tabTwo } - } - ); - } + Items.Add( + new TabBar + { + Items = { tabOne, tabTwo } + } + ); + } - private void TabOneButton_Clicked(object sender, System.EventArgs e) + private void TabOneButton_Clicked(object sender, System.EventArgs e) + { + var subTabPageOne = new ContentPage { - var subTabPageOne = new ContentPage + Content = new Label { - Content = new Label - { - Text = "SubPage One", - AutomationId = "SubTabLabel1", - VerticalTextAlignment = TextAlignment.Center, - } - }; - var subTabPageTwo = new ContentPage + Text = "SubPage One", + AutomationId = "SubTabLabel1", + VerticalTextAlignment = TextAlignment.Center, + } + }; + var subTabPageTwo = new ContentPage + { + Content = new Label { - Content = new Label - { - Text = "SubPage Two", - AutomationId = "SubTabLabel2", - VerticalTextAlignment = TextAlignment.Center, - } - }; + Text = "SubPage Two", + AutomationId = "SubTabLabel2", + VerticalTextAlignment = TextAlignment.Center, + } + }; - var tabbedPage = new TabbedPage { Title = "TabbedPage" }; - tabbedPage.Children.Add(subTabPageOne); - tabbedPage.Children.Add(subTabPageTwo); - Shell.SetTabBarIsVisible(tabbedPage, false); - this.Navigation.PushAsync(tabbedPage); - } + var tabbedPage = new TabbedPage { Title = "TabbedPage" }; + tabbedPage.Children.Add(subTabPageOne); + tabbedPage.Children.Add(subTabPageTwo); + Shell.SetTabBarIsVisible(tabbedPage, false); + this.Navigation.PushAsync(tabbedPage); } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/HeaderFooterShellFlyout.cs b/src/Controls/tests/TestCases.HostApp/Issues/HeaderFooterShellFlyout.cs new file mode 100644 index 000000000000..31520a765917 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/HeaderFooterShellFlyout.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.PlatformConfiguration; +using Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific; +using Microsoft.Maui.Devices; +using Microsoft.Maui.Graphics; +using VisualElement = Microsoft.Maui.Controls.VisualElement; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.None, 0, "Shell Flyout Header Footer", + PlatformAffected.All)] + +public class HeaderFooterShellFlyout : TestShell +{ + protected override void Init() + { + var page = new ContentPage(); + + AddFlyoutItem(page, "Flyout Item"); + page.Content = new StackLayout() + { + Children = + { + new Label() + { + Text = "Open the Flyout and Toggle the Header and Footer. If it changes after each click test has passed", + AutomationId = "PageLoaded" + } + } + }; + + Items.Add(new MenuItem() + { + Text = "Toggle Header/Footer Template", + Command = new Command(() => + { + if (FlyoutHeaderTemplate == null) + { + FlyoutHeaderTemplate = new DataTemplate(() => + { + return new Label() { Text = "Header Template" }; + }); + + FlyoutFooterTemplate = new DataTemplate(() => + { + return new Label() { Text = "Footer Template" }; + }); + } + else if (FlyoutHeaderTemplate != null) + { + FlyoutHeaderTemplate = null; + FlyoutFooterTemplate = null; + } + }), + AutomationId = "ToggleHeaderFooterTemplate" + }); + + Items.Add(new MenuItem() + { + Text = "Toggle Header/Footer View", + Command = new Command(() => + { + if (FlyoutHeader != null) + { + FlyoutHeader = null; + FlyoutFooter = null; + } + else + { + FlyoutHeader = new StackLayout() + { + Children = { + new Label() { Text = "Header" } + }, + AutomationId = "Header View" + }; + + FlyoutFooter = new StackLayout() + { + Orientation = StackOrientation.Horizontal, + Children = { + new Label() { Text = "Footer" } + }, + AutomationId = "Footer View" + }; + } + }), + AutomationId = "ToggleHeaderFooter" + }); + + Items.Add(new MenuItem() + { + Text = "Resize Header/Footer", + Command = new Command(async () => + { + FlyoutHeaderTemplate = null; + FlyoutFooterTemplate = null; + if (FlyoutHeader == null) + { + FlyoutHeader = new StackLayout() + { + Children = { + new Label() { Text = "Header" } + }, + AutomationId = "Header View" + }; + + FlyoutFooter = new StackLayout() + { + Children = { + new Label() { Text = "Footer" } + }, + AutomationId = "Footer View" + }; + + await Task.Delay(10); + } + + var headerLabel = (VisualElement)FlyoutHeader; + var footerLabel = (VisualElement)FlyoutFooter; + headerLabel.BackgroundColor = Colors.LightBlue; + + if (footerLabel is not null) + footerLabel.BackgroundColor = Colors.LightBlue; + + if (headerLabel.HeightRequest == 60) + { + headerLabel.HeightRequest = 200; + + if (footerLabel is not null) + footerLabel.HeightRequest = 200; + } + else + { + headerLabel.HeightRequest = 60; + + if (footerLabel is not null) + footerLabel.HeightRequest = 60; + } + }), + AutomationId = "ResizeHeaderFooter" + }); + + if (DeviceInfo.Platform == DevicePlatform.iOS) + { + Items.Add(new MenuItem() + { + Text = "Zero Margin Header Test", + Command = new Command(() => + { + FlyoutHeader = + new StackLayout() + { + AutomationId = "ZeroMarginLayout", + Margin = 0, + Children = + { + new Label() { Text = "Header View" } + }, + BackgroundColor = Colors.Purple, + IgnoreSafeArea = true + }; + + FlyoutHeaderTemplate = null; + FlyoutBehavior = FlyoutBehavior.Locked; + }), + AutomationId = "ZeroMarginHeader" + }); + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue10134.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue10134.cs new file mode 100644 index 000000000000..13a2e1f54526 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue10134.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 10134, "Shell Top Tabbar focus issue", PlatformAffected.iOS)] +public class Issue10134 : TestShell +{ + protected override void Init() + { + ContentPage page1 = AddTopTab("Tab 1"); + page1.Title = "Top Bar Page 1"; + + for (int i = 2; i < 20; i++) + { + AddTopTab($"Tab {i}"); + } + + page1.Content = + new StackLayout() + { + Children = + { + new Label() + { + Text = "Scroll and click on any of the currently non visible tabs. After clicking, if the Top Tabs don't scroll back to the beginninig the test has passed" + } + } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1023.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1023.cs new file mode 100644 index 000000000000..20fc6f00bd78 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1023.cs @@ -0,0 +1,132 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.None, 1023, "Automate GC checks of picker disposals", PlatformAffected.iOS)] +public class Bugzilla1023 : TestNavigationPage +{ + protected override void Init() + { + PushAsync(new LandingPage1023()); + } +} + +[Preserve(AllMembers = true)] +public class LandingPage1023 : ContentPage +{ + public static int Counter; + public Label Label; + + public LandingPage1023() + { + Label = new Label + { + Text = "Counter: " + Counter, + HorizontalTextAlignment = TextAlignment.Center, + VerticalTextAlignment = TextAlignment.Center + }; + + Content = new StackLayout + { + Orientation = StackOrientation.Vertical, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + Spacing = 15, + Children = + { + new Label + { + Text = "Click Push to show a ListView. When you hit the Back button, Counter will show the number of pages that have not been finalized yet." + + " If you click GC, the counter should be 0." + }, + Label, + new Button + { + Text = "GC", + AutomationId = "GC", + Command = new Command(o => + { + GarbageCollectionHelper.Collect(); + Label.Text = "Counter: " + Counter; + }) + }, + new Button + { + Text = "Push", + AutomationId = "Push", + Command = new Command(async o => + { + await Navigation.PushAsync(new ContentPage1023()); + }) + } + } + }; + } + + protected override void OnAppearing() + { + base.OnAppearing(); + + if (Label != null) + Label.Text = "Counter: " + Counter; + } +} + +[Preserve(AllMembers = true)] +public class ContentPage1023 : ContentPage +{ + public ContentPage1023() + { + Interlocked.Increment(ref LandingPage1023.Counter); + System.Diagnostics.Debug.WriteLine("Page: " + LandingPage1023.Counter); + + Content = new ListView + { + HasUnevenRows = true, + ItemsSource = new List { "DatePicker", "Picker", "TimePicker" }, + ItemTemplate = new DataTemplateSelector1023(), + AutomationId = "ListView" + }; + } + + ~ContentPage1023() + { + Interlocked.Decrement(ref LandingPage1023.Counter); + System.Diagnostics.Debug.WriteLine("Page: " + LandingPage1023.Counter); + } +} + +[Preserve(AllMembers = true)] +public class DataTemplateSelector1023 : DataTemplateSelector +{ + public DataTemplate DatePickerTemplate { get; set; } + public DataTemplate PickerTemplate { get; set; } + public DataTemplate TimePickerTemplate { get; set; } + + public DataTemplateSelector1023() + { + DatePickerTemplate = new DataTemplate(() => new ViewCell { View = new DatePicker() }); + PickerTemplate = new DataTemplate(() => new ViewCell { View = new Picker() }); + TimePickerTemplate = new DataTemplate(() => new ViewCell { View = new TimePicker() }); + } + + protected override DataTemplate OnSelectTemplate(object item, BindableObject container) + { + switch (item as string) + { + case "DatePicker": + return DatePickerTemplate; + case "Picker": + return PickerTemplate; + case "TimePicker": + return TimePickerTemplate; + } + + return null; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1024.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1024.cs new file mode 100644 index 000000000000..3c3714d900dd --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1024.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.None, 1024, "Entry and Editor are leaking when used in ViewCell", PlatformAffected.iOS)] +public class Bugzilla1024 : TestNavigationPage +{ + protected override void Init() + { + PushAsync(new LandingPage1024()); + } +} + +[Preserve(AllMembers = true)] +public class LandingPage1024 : ContentPage +{ + public static int Counter; + public Label Label; + + public LandingPage1024() + { + Label = new Label + { + Text = "Counter: " + Counter, + HorizontalTextAlignment = TextAlignment.Center, + VerticalTextAlignment = TextAlignment.Center + }; + + Content = new StackLayout + { + Orientation = StackOrientation.Vertical, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + Spacing = 15, + Children = + { + new Label + { + Text = "Click Push to show a ListView. When you hit the Back button, Counter will show the number of pages that have not been finalized yet." + + " If you click GC, the counter should be 0." + }, + Label, + new Button + { + Text = "GC", + AutomationId = "GC", + Command = new Command(o => + { + GarbageCollectionHelper.Collect(); + Label.Text = "Counter: " + Counter; + }) + }, + new Button + { + Text = "Push", + AutomationId = "Push", + Command = new Command(async o => + { + await Navigation.PushAsync(new ContentPage1024()); + }) + } + } + }; + } + + protected override void OnAppearing() + { + base.OnAppearing(); + + if (Label != null) + Label.Text = "Counter: " + Counter; + } +} + +[Preserve(AllMembers = true)] +public class ContentPage1024 : ContentPage +{ + public ContentPage1024() + { + Interlocked.Increment(ref LandingPage1024.Counter); + System.Diagnostics.Debug.WriteLine("Page: " + LandingPage1024.Counter); + + Content = new ListView + { + HasUnevenRows = true, + ItemsSource = new List { "Entry", "Editor" }, + ItemTemplate = new InputViewDataTemplateSelector(), + AutomationId = "ListView" + }; + } + + ~ContentPage1024() + { + Interlocked.Decrement(ref LandingPage1024.Counter); + System.Diagnostics.Debug.WriteLine("Page: " + LandingPage1024.Counter); + } +} + +[Preserve(AllMembers = true)] +public class InputViewDataTemplateSelector : DataTemplateSelector +{ + public DataTemplate EntryTemplate { get; set; } + public DataTemplate EditorTemplate { get; set; } + + public InputViewDataTemplateSelector() + { + EntryTemplate = new DataTemplate(() => new ViewCell { View = new Entry { BackgroundColor = Colors.DarkGoldenrod, Text = "Entry" } }); + EditorTemplate = new DataTemplate(() => new ViewCell { View = new Editor { BackgroundColor = Colors.Bisque, Text = "Editor" } }); + } + + protected override DataTemplate OnSelectTemplate(object item, BindableObject container) + { + switch (item as string) + { + case "Entry": + return EntryTemplate; + case "Editor": + return EditorTemplate; + } + + return null; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1028.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1028.cs new file mode 100644 index 000000000000..5eefc98800e0 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1028.cs @@ -0,0 +1,32 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1028, "ViewCell in TableView raises exception - root page is ContentPage, Content is TableView", PlatformAffected.WinPhone, NavigationBehavior.PushModalAsync)] + +public class Issue1028 : TestContentPage +{ + // Issue1028, ViewCell with StackLayout causes exception when nested in a table section. This occurs when the app's root page is a ContentPage with a TableView. + protected override void Init() + { + Content = new TableView + { + Root = new TableRoot("Table Title") { + new TableSection ("Section 1 Title") { + new ViewCell { + View = new StackLayout { + Children = { + new Label { + Text = "Custom Slider View:", + AutomationId = "Custom Slider View:" + }, + } + } + } + } + } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue10608.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue10608.cs new file mode 100644 index 000000000000..77a311af46a5 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue10608.cs @@ -0,0 +1,95 @@ +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 10608, "[Bug] [Shell] [iOS] Locked flyout causes application to freezes when quickly switching between tabs", PlatformAffected.iOS)] +public class Issue10608 : TestShell +{ + public Issue10608() + { + } + + void AddPage(string title) + { + var page = CreateContentPage(title); + + page.Content = new Grid() + { + Children = + { + new ScrollView() + { + Content = + new StackLayout() + { + Children = + { + new Button() + { + Text = "Learn More", + Margin = new Thickness(0,10,0,0), + BackgroundColor = Colors.Purple, + TextColor = Colors.White, + AutomationId = "LearnMoreButton" + } + } + } + } + } + }; + } + + protected override void Init() + { + FlyoutBehavior = FlyoutBehavior.Locked; + + AddPage("Click"); + AddPage("Between"); + AddPage("These Flyouts"); + AddPage("Really Fast"); + AddPage("If it doesn't"); + AddPage("Lock test has passed"); + + int i = 0; + foreach (var item in Items) + { + item.Items[0].AutomationId = $"FlyoutItem{i}"; + item.Items[0].Items.Add(new ContentPage() + { + Title = "Page" + }); + + i++; + } + + Items.Add(new MenuItem() + { + Text = "Let me click for you", + AutomationId = $"FlyoutItem{i}", + Command = new Command(async () => + { + for (int j = 0; j < 5; j++) + { + CurrentItem = Items[0].Items[0]; + await Task.Delay(10); + CurrentItem = Items[1].Items[0]; + await Task.Delay(10); + } + + CurrentItem = Items[0].Items[0]; + }) + }); + + Items[0].Items[0].Items[0].Title = "Tab 1"; + Items[0].Items[0].Items[0].AutomationId = "Tab1AutomationId"; + Items[1].Items[0].Items[0].Title = "Tab 2"; + Items[1].Items[0].Items[0].AutomationId = "Tab2AutomationId"; + + Items[0].FlyoutDisplayOptions = FlyoutDisplayOptions.AsMultipleItems; + Items[1].FlyoutDisplayOptions = FlyoutDisplayOptions.AsMultipleItems; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue11107.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue11107.cs new file mode 100644 index 000000000000..7719e376817b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue11107.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 11107, "[Bug][iOS] Shell Navigation implicitly adds Tabbar", PlatformAffected.iOS)] + +public class Issue11107 : TestShell +{ + bool _tabBarIsVisible = false; + Label _tabBarLabel; + public Issue11107() : this(false) + { + } + + public Issue11107(bool tabBarIsVisible) + { + _tabBarIsVisible = tabBarIsVisible; + + Shell.SetTabBarIsVisible(this, _tabBarIsVisible); + Shell.SetNavBarHasShadow(this, false); + _tabBarLabel.Text = $"TabBarIsVisible: {_tabBarIsVisible}"; + } + + protected override void Init() + { + _tabBarLabel = new Label(); + ContentPage firstPage = new ContentPage() + { + Content = new StackLayout() + { + Children = + { + _tabBarLabel, + new Label() + { + Text = "If this page has a tab bar the test has failed", + AutomationId = "Page1Loaded" + }, + new Button() + { + Text = "Run test again with TabBarIsVisible Toggled", + Command = new Command(() => + { + Application.Current.MainPage = new Issue11107(!Shell.GetTabBarIsVisible(this)); + }), + AutomationId = "RunTestTabBarIsVisible" + }, + new Button() + { + Text = "Run with Two Tabs and TabBarIsVisible False", + Command = new Command(() => + { + var shell = new Issue11107(false); + shell.AddBottomTab("Second Tab"); + Application.Current.MainPage = shell; + }), + AutomationId = "RunTestTwoTabs" + } + } + } + }; + + ContentPage secondPage = new ContentPage() + { + Content = new StackLayout() + { + Children = + { + new Label() + { + Text = "Hold Please!! Or fail the test if nothing happens." + } + } + } + }; + + var item1 = AddFlyoutItem(firstPage, "Page1"); + item1.Items[0].Title = "Tab 1"; + item1.Items[0].AutomationId = "Tab1AutomationId"; + var item2 = AddFlyoutItem(secondPage, "Page2"); + + item1.Route = "FirstPage"; + Routing.RegisterRoute("Issue11107HeaderPage", typeof(Issue11107HeaderPage)); + + CurrentItem = item2; + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(async () => + { + await Task.Delay(1000); + await GoToAsync("//FirstPage/Issue11107HeaderPage"); + }); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + } + + [Preserve(AllMembers = true)] + public class Issue11107HeaderPage : ContentPage + { + public Issue11107HeaderPage() + { + Content = new StackLayout() + { + Children = + { + new Label() + { + Text = "If this page has a tab bar the test has failed", + AutomationId = "SecondPageLoaded" + }, + new Label() + { + Text = "Click the Back Button" + } + } + }; + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue11214.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue11214.cs new file mode 100644 index 000000000000..90c36754393b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue11214.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 11214, "When adding FlyoutItems during Navigating only first one is shown", PlatformAffected.iOS)] +public class Issue11214 : TestShell +{ + FlyoutItem _itemexpanderItems; + protected override void Init() + { + _itemexpanderItems = new FlyoutItem() + { + Title = "Expando Magic", + FlyoutDisplayOptions = FlyoutDisplayOptions.AsMultipleItems + }; + + ContentPage contentPage = new ContentPage() + { + Content = new StackLayout() + { + Children = + { + new Label() + { + Text = "Open the Flyout", + AutomationId = "PageLoaded" + } + } + } + }; + + AddFlyoutItem(contentPage, "Top Item"); + + var flyoutItem = AddFlyoutItem("Click Me and You Should see 2 Items show up"); + flyoutItem.Route = "ExpandMe"; + flyoutItem.AutomationId = "ExpandMe"; + Items.Add(_itemexpanderItems); + } + + protected override void OnNavigating(ShellNavigatingEventArgs args) + { + base.OnNavigating(args); + + if (!args.Target.FullLocation.ToString().Contains("ExpandMe", StringComparison.OrdinalIgnoreCase)) + { + return; + } + + args.Cancel(); + + if (_itemexpanderItems.Items.Count == 0 || + _itemexpanderItems.Items[0].Items.Count == 0) + { + for (int i = 0; i < 2; i++) + { + _itemexpanderItems.Items.Add(new ShellContent() + { + Title = $"Some Item: {i}", + Content = new ContentPage() + }); + } + } + else + { + _itemexpanderItems.Items.Clear(); + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue11244.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue11244.cs new file mode 100644 index 000000000000..3b9a75a24656 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue11244.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 11244, "[Bug] BackButtonBehavior no longer displays on the first routed page in 4.7", + PlatformAffected.iOS)] +public class Issue11244 : TestShell +{ + protected async override void Init() + { + var page1 = AddContentPage(); + ContentPage page = new ContentPage() + { + Content = new StackLayout() + { + Children = + { + new Label() + { + Text = "The app bar should have text instead of a hamburger" + }, + new Button() + { + Text = "Run test again", + Command = new Command(async () => + { + CurrentItem = page1; + await Task.Delay(1000); + await GoToAsync("//MainPage"); + }) + } + } + } + }; + + Shell.SetBackButtonBehavior(page, + new BackButtonBehavior() + { + TextOverride = "Logout", + Command = new Command(() => { }) + }); + + var page2 = AddContentPage(page); + page2.Route = "MainPage"; + await Task.Delay(1000); + await GoToAsync("//MainPage"); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue11247.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue11247.cs new file mode 100644 index 000000000000..a727e04e087b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue11247.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.Shapes; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 11247, + "[Bug] Shell FlyoutIsPresented not working if set in \"navigating\" handler", + PlatformAffected.iOS)] +public class Issue11247 : TestShell +{ + protected override void Init() + { + var page = CreateContentPage("FlyoutItem 1"); + CreateContentPage("FlyoutItem 2"); + + Items.Add(new MenuItem() + { + Text = "Click Me To Close Flyout", + AutomationId = "CloseFlyout", + Command = new Command(() => + { + FlyoutIsPresented = false; + }) + }); + + page.Content = new StackLayout() + { + Children = + { + new Label() + { + Text = "If the flyout wasn't open when this test started the test has failed" + }, + new Label() + { + Text = "Now, Open the Flyout and Click on FlyoutItem 2. Nothing should happen and flyout should remain open" + } + } + }; + } + + protected override void OnNavigating(ShellNavigatingEventArgs args) + { + base.OnNavigating(args); + + if (args.CanCancel) + { + args.Cancel(); + } + + FlyoutIsPresented = true; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue11523.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue11523.cs new file mode 100644 index 000000000000..67c4ff30788d --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue11523.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 11523, "[Bug] FlyoutBehavior.Disabled removes back-button from navbar", + PlatformAffected.iOS)] +public class Issue11523 : TestShell +{ + protected override async void Init() + { + ContentPage contentPage = new ContentPage() + { + Content = + new StackLayout() + { + Children = + { + new Label() + { + Text = "This Page Should Have a Back Button that you should click", + AutomationId = "PageLoaded" + } + } + } + }; + + var firstPage = AddBottomTab("First Page"); + firstPage.Content = + new StackLayout() + { + Children = + { + new Label() + { + Text = "This Page Should Have a Hamburger Menu Icon when you return to it", + + } + } + }; + + await Task.Delay(1000); + + contentPage.Appearing += (_, __) => + { + this.FlyoutBehavior = FlyoutBehavior.Disabled; + }; + + contentPage.Disappearing += (_, __) => + { + this.FlyoutBehavior = FlyoutBehavior.Flyout; + }; + + await Navigation.PushAsync(contentPage); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue11869.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue11869.cs new file mode 100644 index 000000000000..9914febe7aa1 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue11869.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 11869, "[Bug] ShellContent.IsVisible issue on Android", + PlatformAffected.Android)] +public class Issue11869 : TestShell +{ + protected override void Init() + { + ContentPage contentPage = new ContentPage(); + var tabbar = AddContentPage(contentPage, title: "Tab 1"); + AddBottomTab("Tab 2"); + AddBottomTab("Tab 3"); + AddTopTab("TopTab2"); + AddTopTab("TopTab3"); + + contentPage.Content = + new StackLayout() + { + Children = + { + new Button + { + Text = "Hide Bottom Tab 2", + Command = new Command(() => + { + Items[0].Items[1].Items[0].IsVisible = false; + }), + AutomationId = "HideBottom2" + }, + new Button + { + Text = "Hide Bottom Tab 3", + Command = new Command(() => + { + Items[0].Items[2].Items[0].IsVisible = false; + }), + AutomationId = "HideBottom3" + }, + new Button + { + Text = "Hide Top Tab 2", + Command = new Command(() => + { + Items[0].Items[0].Items[1].IsVisible = false; + }), + AutomationId = "HideTop2" + }, + new Button + { + Text = "Hide Top Tab 3", + Command = new Command(() => + { + Items[0].Items[0].Items[2].IsVisible = false; + }), + AutomationId = "HideTop3" + }, + new Button + { + Text = "Show All Tabs", + Command = new Command(() => + { + Items[0].Items[1].Items[0].IsVisible = true; + Items[0].Items[2].Items[0].IsVisible = true; + Items[0].Items[0].Items[1].IsVisible = true; + Items[0].Items[0].Items[2].IsVisible = true; + }), + AutomationId = "ShowAllTabs" + } + } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue12126.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue12126.cs new file mode 100644 index 000000000000..02c157db6b07 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue12126.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 12126, "", + PlatformAffected.iOS)] +public class Issue12126 : TestShell +{ + bool firstNavigated = true; + protected override void Init() + { + var page1 = AddFlyoutItem("Tab 1"); + AddBottomTab("Tab 2"); + Shell.SetTabBarIsVisible(page1, true); + } + + protected override async void OnNavigated(ShellNavigatedEventArgs args) + { + base.OnNavigated(args); + + if (firstNavigated) + { + firstNavigated = false; + ContentPage contentPage = new ContentPage(); + contentPage.Content = new Label() + { + Text = "If you don't see any bottom tabs the test has failed" + }; + Shell.SetTabBarIsVisible(contentPage, true); + + ContentPage contentPage2 = new ContentPage(); + contentPage2.Content = + new StackLayout() + { + Children = + { + new Label() + { + Text = "Click The Back Arrow", + AutomationId = "TestReady" + } + } + }; + + Shell.SetTabBarIsVisible(contentPage2, false); + await Navigation.PushAsync(contentPage); + await Navigation.PushAsync(contentPage2); + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue12246.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue12246.cs new file mode 100644 index 000000000000..14eb90b6f631 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue12246.cs @@ -0,0 +1,69 @@ +using System.Collections.ObjectModel; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 12246, "[Bug] iOS 14 App freezes when password is entered after email", PlatformAffected.iOS)] +public class Issue12246 : TestContentPage +{ + const string Entry = "Entry"; + const string Password = "Password"; + const string Success = "Success"; + + protected override void Init() + { + var layout = new StackLayout() { Margin = 40, Spacing = 10, VerticalOptions = LayoutOptions.Center }; + + var instructions = new Label + { + Text = $"Focus the 'Email' Entry. Type in some text. Then focus the 'Password' Entry." + + $" Type in some text. Now focus the 'Email' Entry again. The '{Success}' Label should appear. " + + $"If the '{Success}' Label does not appear or the application hangs, this test has failed." + }; + + var result = new Label { Text = Success, IsVisible = false }; + + var entry = new Entry() + { + Visual = VisualMarker.Material, + Keyboard = Keyboard.Email, + Placeholder = "Email", + TextColor = Colors.Purple, + AutomationId = Entry + }; + + var password = new Entry + { + Visual = VisualMarker.Material, + IsPassword = true, + Placeholder = "Password", + TextColor = Colors.Purple, + AutomationId = Password + }; + + var passwordConfirmation = new Entry + { + Visual = VisualMarker.Material, + IsPassword = true, + Placeholder = "Confirm Password", + TextColor = Colors.Purple + }; + + password.Unfocused += (sender, args) => + { + result.IsVisible = true; + }; + + layout.Children.Add(instructions); + layout.Children.Add(entry); + layout.Children.Add(password); + layout.Children.Add(passwordConfirmation); + layout.Children.Add(result); + + Content = layout; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue12320.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue12320.cs new file mode 100644 index 000000000000..0c9f10348596 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue12320.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 12320, "[iOS] TabBarIsVisible = True/False doesn't work on Back Navigation When using BackButtonBehavior", + PlatformAffected.iOS)] + +public class Issue12320 : TestShell +{ + bool firstNavigated = true; + protected override void Init() + { + var page1 = new ContentPage(); + page1.Content = new Label() + { + Text = "If you don't see any bottom tabs the test has failed" + }; + + AddFlyoutItem(page1, "Tab 1"); + AddBottomTab("Tab 2"); + Shell.SetTabBarIsVisible(page1, true); + } + + protected override async void OnNavigated(ShellNavigatedEventArgs args) + { + base.OnNavigated(args); + + if (firstNavigated) + { + firstNavigated = false; + ContentPage contentPage = new ContentPage(); + contentPage.Content = new Label() + { + Text = "Click the Coffee Cup in the Nav Bar", + AutomationId = "TestReady" + }; + + Shell.SetTabBarIsVisible(contentPage, false); + Shell.SetBackButtonBehavior(contentPage, new BackButtonBehavior() { IconOverride = "coffee.png" }); + await Navigation.PushAsync(contentPage); + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue12652.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue12652.cs new file mode 100644 index 000000000000..30d48abd9b10 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue12652.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 12652, "[Bug] NullReferenceException in the Shell on UWP when navigating back to Shell Section with multiple content items", + PlatformAffected.UWP)] +public class Issue12652 : TestShell +{ + protected override void Init() + { + AddBottomTab("Main 1") + .Content = new StackLayout() + { + Children = + { + new Label() + { + Text = @"Click on the tabs in the following order + Top 3, + Main 2, + Main 1, + Top 3, + Main 2. + If nothing crashes test has passed.", + AutomationId = "TopTabPage2" + } + } + }; + + AddBottomTab("Main 2") + .Content = new StackLayout() + { + Children = + { + new Label() + { + Text = "Hello From Page 2", + AutomationId = "TopTabPage2" + } + } + }; + + + AddTopTab("Top 2"); + + AddTopTab("Top 3") + .Content = new StackLayout() + { + Children = + { + new Label() + { + Text = "Hello From Page 3", + AutomationId = "TopTabPage3" + } + } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue12685.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue12685.cs new file mode 100644 index 000000000000..baf7f1755f0a --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue12685.cs @@ -0,0 +1,61 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.Shapes; +using Microsoft.Maui.Graphics; +using Path = Microsoft.Maui.Controls.Shapes.Path; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 12685, "[iOs][Bug] TapGestureRecognizer in Path does not work on iOS", PlatformAffected.iOS)] + +public partial class Issue12685 : TestContentPage +{ + const string StatusLabelId = "StatusLabelId"; + const string PathId = "PathId"; + + const string ResetStatus = "Path touch event not fired, touch path above."; + const string ClickedStatus = "Path was clicked, click reset button to start over."; + + protected override void Init() + { + var layout = new StackLayout(); + var statusLabel = new Label + { + AutomationId = StatusLabelId, + Text = ResetStatus, + }; + + var lgb = new LinearGradientBrush(); + lgb.GradientStops.Add(new GradientStop(Colors.White, 0)); + lgb.GradientStops.Add(new GradientStop(Colors.Orange, 1)); + + var pathGeometry = new PathGeometry(); + PathFigureCollectionConverter.ParseStringToPathFigureCollection(pathGeometry.Figures, "M0,0 V300 H300 V-300 Z"); + + var path = new Path + { + AutomationId = PathId, + Data = pathGeometry, + Fill = lgb + }; + + var touch = new TapGestureRecognizer + { + Command = new Command(_ => statusLabel.Text = ClickedStatus), + }; + path.GestureRecognizers.Add(touch); + + var resetButton = new Button + { + Text = "Reset", + Command = new Command(_ => statusLabel.Text = ResetStatus), + }; + + layout.Children.Add(path); + layout.Children.Add(statusLabel); + layout.Children.Add(resetButton); + + Content = layout; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue12777.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue12777.cs new file mode 100644 index 000000000000..ef24f2d678fb --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue12777.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.ObjectModel; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 12777, "[Bug] CarouselView NRE if item template is not specified", PlatformAffected.iOS)] +public class Issue12777 : TestContentPage +{ + public Issue12777() + { + BindingContext = new Issue12777ViewModel1(); + } + + protected override void Init() + { + var layout = new StackLayout(); + + var instructions = new Label + { + Padding = new Thickness(12), + BackgroundColor = Colors.Black, + TextColor = Colors.White, + Text = "Without exceptions, the test has passed." + }; + + var carouselView = new CarouselView + { + AutomationId = "TestCarouselView" + }; + + carouselView.SetBinding(ItemsView.ItemsSourceProperty, nameof(Issue12777ViewModel1.Items)); + + layout.Children.Add(instructions); + layout.Children.Add(carouselView); + + Content = layout; + } +} + +[Preserve(AllMembers = true)] +public class Issue12777Model1 +{ + public Color Color { get; set; } + public string Name { get; set; } +} + +[Preserve(AllMembers = true)] +public class Issue12777ViewModel1 : BindableObject +{ + ObservableCollection _items; + + public Issue12777ViewModel1() + { + LoadItems(); + } + + public ObservableCollection Items + { + get { return _items; } + set + { + _items = value; + OnPropertyChanged(); + } + } + + void LoadItems() + { + Items = new ObservableCollection(); + + var random = new Random(); + + for (int n = 0; n < 5; n++) + { + Items.Add(new Issue12777Model1 + { + Color = Color.FromRgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)), + Name = $"{n + 1}" + }); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue13203.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue13203.cs new file mode 100644 index 000000000000..868e3a0c9e96 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue13203.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Issue(IssueTracker.Github, 13203, "[Bug] [iOS] CollectionView does not bind to items if `IsVisible=False`", PlatformAffected.iOS)] +public class Issue13203 : TestContentPage +{ + const string Success = "Success"; + + protected override void Init() + { + var cv = new CollectionView + { + IsVisible = false, + + ItemTemplate = new DataTemplate(() => + { + var label = new Label(); + label.SetBinding(Label.TextProperty, new Binding(nameof(Item.Text))); + return label; + }) + }; + + var source = new List { new Item { Text = Success } }; + cv.ItemsSource = source; + + Content = cv; + + Appearing += (sender, args) => { cv.IsVisible = true; }; + } + + class Item + { + public string Text { get; set; } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1323.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1323.cs new file mode 100644 index 000000000000..b75052016109 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1323.cs @@ -0,0 +1,39 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1323, "tabbed page BarTextColor is not pervasive and can't be applied after instantiation", PlatformAffected.iOS)] +public class Issue1323 : TestTabbedPage +{ + protected override void Init() + { + BarBackgroundColor = Color.FromArgb("#61a60e"); + BarTextColor = Color.FromArgb("#ffffff"); + BackgroundColor = Color.FromArgb("#61a60e"); + + var page = new ContentPage { Title = "Page 1", Content = new Button { Text = "Pop", Command = new Command(async () => await Navigation.PopModalAsync()) } }; + var page2 = new ContentPage { Title = "Page 2" }; + var page3 = new ContentPage { Title = "Page 3" }; + var page4 = new ContentPage { Title = "Page 4" }; + + Children.Add(page); + Children.Add(page2); + Children.Add(page3); + Children.Add(page4); + } + + protected override void OnAppearing() + { + base.OnAppearing(); + BarTextColor = Colors.White; + Children.RemoveAt(1); + Children.Insert(1, new ContentPage { Title = "Page5", IconImageSource = "Loyalty.png" }); + + Children.RemoveAt(3); + Children.Insert(2, new ContentPage { Title = "Page6", IconImageSource = "Gift.png" }); + BarTextColor = Colors.White; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1342.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1342.cs new file mode 100644 index 000000000000..85e71e1fd5a9 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1342.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Text; +using System.Windows.Input; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1342, "[iOS] ListView throws Exception on ObservableCollection.Add/Remove for non visible list view", + PlatformAffected.iOS)] +public class Issue1342 : TestNavigationPage +{ + const string add2 = "add2"; + const string add3 = "add3"; + const string success = "No crash means success"; + + protected override void Init() + { + PushAsync(new MainPageCode + { + BindingContext = new MainViewModel + { + ViewModel1 = new ListViewModel + { + Items = new ObservableCollection(new[] { $"Click {add2}", $"Click {add3}", success }) + }, + ViewModel2 = new ListViewModel + { + Items = new ObservableCollection(new[] { "item2.1", "item2.2", "item2.3" }) + }, + ViewModel3 = new ListViewModel + { + Items = new ObservableCollection() + } + } + }); + } + + [Preserve(AllMembers = true)] + public partial class MainPageCode : TabbedPage + { + public MainPageCode() + { + ToolbarItems.Add(new Microsoft.Maui.Controls.ToolbarItem() { Text = "add1" }); + ToolbarItems.Add(new Microsoft.Maui.Controls.ToolbarItem() { Text = $"{add2}" }); + ToolbarItems.Add(new Microsoft.Maui.Controls.ToolbarItem() { Text = $"{add3}" }); + ToolbarItems.Add(new Microsoft.Maui.Controls.ToolbarItem() { Text = "reload" }); + ToolbarItems.Add(new Microsoft.Maui.Controls.ToolbarItem() { Text = "visible" }); + + + ToolbarItems[0].SetBinding(ToolbarItem.CommandProperty, "Add1Command"); + ToolbarItems[1].SetBinding(ToolbarItem.CommandProperty, "Add2Command"); + ToolbarItems[2].SetBinding(ToolbarItem.CommandProperty, "Add3Command"); + ToolbarItems[3].SetBinding(ToolbarItem.CommandProperty, "Add4Command"); + ToolbarItems[4].SetBinding(ToolbarItem.CommandProperty, "Add5Command"); + + ListPageCode page = new ListPageCode(); + page.SetBinding(ListPageCode.BindingContextProperty, "ViewModel1"); + Children.Add(page); + + page = new ListPageCode(); + page.SetBinding(ListPageCode.BindingContextProperty, "ViewModel2"); + Children.Add(page); + + page = new ListPageCode(); + page.SetBinding(ListPageCode.BindingContextProperty, "ViewModel3"); + Children.Add(page); + } + } + + [Preserve(AllMembers = true)] + public class MainViewModel + { + + void AddItems(ObservableCollection list) + { + list.Add("new item"); + } + + public MainViewModel() + { + Add1Command = new Command(() => AddItems(ViewModel1.Items)); + Add2Command = new Command(() => AddItems(ViewModel2.Items)); + Add3Command = new Command(() => AddItems(ViewModel3.Items)); + Add4Command = new Command(() => + { + ViewModel1.ReloadData(); + ViewModel2.ReloadData(); + ViewModel3.ReloadData(); + }); + Add5Command = new Command(() => + { + ViewModel1.ChangeListViewVisability(); + ViewModel2.ChangeListViewVisability(); + ViewModel3.ReloadData(); + }); + } + + public ListViewModel ViewModel1 { get; set; } + public ListViewModel ViewModel2 { get; set; } + public ListViewModel ViewModel3 { get; set; } + + public ICommand Add1Command { get; } + public ICommand Add2Command { get; } + public ICommand Add3Command { get; } + public ICommand Add4Command { get; } + public ICommand Add5Command { get; } + } + + [Preserve(AllMembers = true)] + public class ListViewModel : INotifyPropertyChanged + { + public ObservableCollection Items { get; set; } + public bool IsVisible { get; set; } = true; + + public event PropertyChangedEventHandler PropertyChanged; + + public void ReloadData() + { + Items = new ObservableCollection(); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Items))); + } + + public void ChangeListViewVisability() + { + IsVisible = !IsVisible; + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsVisible))); + + } + } + + [Preserve(AllMembers = true)] + public partial class ListPageCode : ContentPage + { + public ListPageCode() + { + IconImageSource = "coffee.png"; + ListView view = new ListView(ListViewCachingStrategy.RecycleElement); + Content = view; + + view.SetBinding(ListView.ItemsSourceProperty, "Items"); + view.SetBinding(ListView.IsVisibleProperty, "IsVisible"); + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue13916.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue13916.cs new file mode 100644 index 000000000000..219f315b17a5 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue13916.cs @@ -0,0 +1,65 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 13916, "[iOS] iOS Application crashes on Back press when navigated to using GoToAsync with \"//\" or \"///\" route if 2 or more things are removed from the navigation stack", + PlatformAffected.iOS)] + +public class Issue13916 : TestShell +{ + static int pageCount = 1; + protected override void Init() + { + Routing.RegisterRoute(nameof(Issue13916SuccessPage), typeof(Issue13916SuccessPage)); + + AddFlyoutItem(CreateContentPage(), "Push Me"); + } + + + public class Issue13916SuccessPage : ContentPage + { + public Issue13916SuccessPage() + { + StackLayout layout = new StackLayout(); + Label label = new Label() + { + Text = "Success", + AutomationId = "Success" + }; + layout.Children.Add(label); + Content = layout; + } + } + + ContentPage CreateContentPage() + { + StackLayout layout = new StackLayout(); + Button button = new Button() + { + Text = "Click Me", + AutomationId = $"ClickMe{pageCount}", + Command = new Command(async () => + { + if (Navigation.NavigationStack.Count >= 3) + { + await GoToAsync($"../../{nameof(Issue13916SuccessPage)}"); + } + else + { + await Navigation.PushAsync(CreateContentPage()); + } + }) + }; + pageCount++; + + layout.Children.Add(button); + + return new ContentPage() + { + Content = layout + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1414.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1414.cs new file mode 100644 index 000000000000..fb88955ffac2 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1414.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1414, "InvalidCastException when scrolling and refreshing TableView", PlatformAffected.iOS)] +public class Issue1414 : TestContentPage +{ + ViewCell BuildCell(int sectionIndex, int cellIndex) + { + var grid = new Grid + { + ColumnDefinitions = { + new ColumnDefinition { Width = GridLength.Star }, + new ColumnDefinition { Width = GridLength.Star } + }, + AutomationId = $"Row-{sectionIndex}-{cellIndex}" + }; + + if (cellIndex % 2 == 0) + { + grid.AddChild(new Label { Text = $"Cell {sectionIndex}-{cellIndex}" }, 0, 0); + grid.AddChild(new Label { Text = $"Label" }, 1, 0); + grid.BackgroundColor = Colors.Fuchsia; + } + else + { + grid.AddChild(new Label { Text = $"Cell {sectionIndex}-{cellIndex}" }, 0, 0); + grid.AddChild(new Entry { Text = $"Entry" }, 1, 0); + grid.BackgroundColor = Colors.Yellow; + } + + return new ViewCell + { + View = grid, + }; + } + + protected override void Init() + { + var tableView = new Microsoft.Maui.Controls.TableView + { + HasUnevenRows = true, + Intent = TableIntent.Form, + Root = new TableRoot(), + AutomationId = "TableView" + }; + + for (int sectionIndex = 0; sectionIndex < 5; sectionIndex++) + { + var section = new TableSection($"Section {sectionIndex}"); + + for (int cellIndex = 0; cellIndex < 25; cellIndex++) + { + section.Add(BuildCell(sectionIndex, cellIndex)); + } + + tableView.Root.Add(section); + } + + Content = tableView; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1439.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1439.cs new file mode 100644 index 000000000000..b332e6731438 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1439.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Issue(IssueTracker.Github, 1439, "ItemTapped event for a grouped ListView is not working as expected.", PlatformAffected.UWP)] +public class Issue1439 : TestContentPage +{ + public const string Group_1 = "Group 1"; + public const string Group_2 = "Group 2"; + + public const string A = "A"; + public const string B = "B"; + public const string C = "C"; + public const string D = "D"; + + const string lblItem = "lblItem"; + const string lblGroup = "lblGroup"; + +#pragma warning disable CS0618 // Type or member is obsolete + StackLayout _layout = new StackLayout { Spacing = 30, VerticalOptions = LayoutOptions.FillAndExpand }; +#pragma warning restore CS0618 // Type or member is obsolete + ListView _listView; + Label _label1 = new Label { VerticalOptions = LayoutOptions.Start }; + Label _label2 = new Label { VerticalOptions = LayoutOptions.Start, AutomationId = lblItem }; + Label _label3 = new Label { VerticalOptions = LayoutOptions.Start, AutomationId = lblGroup }; + + protected override void Init() + { + BindingContext = new ViewModel(); + + _listView = new ListView { VerticalOptions = LayoutOptions.Start, IsGroupingEnabled = true, RowHeight = 50, HeightRequest = 300 }; + _listView.ItemTapped += _listView_ItemTapped; + _listView.SetBinding(ListView.ItemsSourceProperty, new Binding(nameof(ViewModel.Items))); + _listView.SetBinding(ListView.SelectedItemProperty, new Binding(nameof(ViewModel.SelectedItem))); + _listView.GroupDisplayBinding = new Binding(nameof(Group.Title)); + + _label1.SetBinding(Label.TextProperty, new Binding(nameof(ViewModel.SelectedItem), stringFormat: "SelectedItem: {0}")); + + _layout.Children.Add(_listView); + _layout.Children.Add(_label1); + _layout.Children.Add(_label2); + _layout.Children.Add(_label3); + + Content = _layout; + } + + void _listView_ItemTapped(object sender, ItemTappedEventArgs e) + { + _label2.Text = $"{e.Item}"; + _label3.Text = $"{((Group)e.Group).Title}"; + } + + [Preserve(AllMembers = true)] + class ViewModel : ObservableObject + { + ObservableCollection _items; + public ObservableCollection Items + { + get { return _items; } + set { SetProperty(ref _items, value); } + } + + string _selectedItem = null; + public string SelectedItem + { + get { return _selectedItem; } + set { SetProperty(ref _selectedItem, value); } + } + + public ViewModel() + { + Items = + new ObservableCollection(new Group[] { + new Group(new string[] { A, B }, Group_1), + new Group(new string[] { C, D }, Group_2) + }); + } + } + + [Preserve(AllMembers = true)] + class Group : ObservableCollection + { + public string Title { get; set; } + public Group(IEnumerable items, string title) + { + Title = title; + + foreach (var item in items) + { + Add(item); + } + } + } + + [Preserve(AllMembers = true)] + class ObservableObject : INotifyPropertyChanged + { + protected virtual bool SetProperty( + ref T backingStore, T value, + [CallerMemberName] string propertyName = "", + Action onChanged = null) + { + if (EqualityComparer.Default.Equals(backingStore, value)) + return false; + + backingStore = value; + onChanged?.Invoke(); + OnPropertyChanged(propertyName); + return true; + } + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "") => + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue15542.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue15542.cs new file mode 100644 index 000000000000..ef2b12495e5a --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue15542.cs @@ -0,0 +1,50 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 15542, "[Bug] Shell.TitleView does not render on iOS 16", PlatformAffected.iOS)] +public class Issue15542 : TestShell +{ + protected override void Init() + { + AddTopTab(createContentPage("title 1"), "page 1"); + AddTopTab(createContentPage("title 2"), "page 2"); + AddTopTab(createContentPage("title 3"), "page 3"); + + static ContentPage createContentPage(string titleView) + { + Label safeArea = new Label(); + ContentPage page = new ContentPage() + { + Content = new StackLayout() + { + Children = + { + new Label() + { + Text = "If the TitleView is not visible the test has failed.", + AutomationId = "Instructions" + }, + safeArea + } + } + }; + + if (!string.IsNullOrWhiteSpace(titleView)) + { + SetTitleView(page, + new Grid() + { + BackgroundColor = Colors.Red, + AutomationId = "TitleViewId", + Children = { new Label() { Text = titleView, VerticalTextAlignment = TextAlignment.End } } + }); + } + + return page; + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue15565.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue15565.cs new file mode 100644 index 000000000000..6e0068e66fe9 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue15565.cs @@ -0,0 +1,54 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 15565, "[Bug] Shell TitleView and ToolBarItems rendering strange display on iOS 16", + PlatformAffected.iOS)] +public class Issue15565 : TestShell +{ + protected override void Init() + { + AddTopTab(createContentPage("title 1"), "page 1"); + AddTopTab(createContentPage("title 2"), "page 2"); + AddTopTab(createContentPage("title 3"), "page 3"); + + static ContentPage createContentPage(string titleView) + { + Label safeArea = new Label(); + ContentPage page = new ContentPage() + { + Content = new StackLayout() + { + Children = + { + new Label() + { + Text = "If the TitleView is not visible at the same time as the ToolbarItems, the test has failed.", + AutomationId = "Instructions" + }, + safeArea + } + } + }; + + page.ToolbarItems.Add(new ToolbarItem() { Text = "Item 1" }); + page.ToolbarItems.Add(new ToolbarItem() { Text = "Item 2" }); + + if (!string.IsNullOrWhiteSpace(titleView)) + { + SetTitleView(page, + new Grid() + { + BackgroundColor = Colors.Red, + AutomationId = "TitleViewId", + Children = { new Label() { Text = titleView, VerticalTextAlignment = TextAlignment.End } } + }); + } + + return page; + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1557.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1557.cs new file mode 100644 index 000000000000..27d52c0a420c --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1557.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1557, "Setting source crashes if view was detached from visual tree", PlatformAffected.iOS, + navigationBehavior: NavigationBehavior.PushAsync)] +public class Issue1557 : TestContentPage +{ + const int Delay = 3000; + + ObservableCollection _items = new ObservableCollection { "foo", "bar" }; + + protected override void Init() + { + var listView = new ListView + { + ItemsSource = _items + }; + + Content = listView; + + Task.Delay(Delay).ContinueWith(async t => + { + var list = (ListView)Content; + + await Navigation.PopAsync(); + + list.ItemsSource = new List { "test" }; + }, TaskScheduler.FromCurrentSynchronizationContext()); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1614.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1614.cs new file mode 100644 index 000000000000..3140d9be3d2b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1614.cs @@ -0,0 +1,32 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1614, "iOS 11 prevents InputAccessoryView from showing in landscape mode", PlatformAffected.iOS)] +public class Issue1614 : TestContentPage +{ + protected override void Init() + { + var stackLayout = new StackLayout(); + var picker = new Picker + { + AutomationId = "Picker" + }; + var datePicker = new DatePicker + { + AutomationId = "DatePicker" + }; + var timePicker = new TimePicker + { + AutomationId = "TimePicker" + }; + + stackLayout.Children.Add(picker); + stackLayout.Children.Add(datePicker); + stackLayout.Children.Add(timePicker); + + Content = stackLayout; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1658.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1658.cs new file mode 100644 index 000000000000..cc2f547d448f --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1658.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1658, "[macOS] GestureRecognizer on ListView Item not working", PlatformAffected.macOS)] + +public class Issue1658 : TestNavigationPage +{ + protected override void Init() + { + var page = new ContentPage(); + + PushAsync(page); + + page.Content = new ListView() + { + ItemsSource = new[] { "1" }, + ItemTemplate = new DataTemplate(() => + { + ViewCell cells = new ViewCell(); + + cells.ContextActions.Add(new MenuItem() + { + IconImageSource = "coffee.png", + AutomationId = "coffee.png" + }); + + var box = new BoxView + { + WidthRequest = 30, + HeightRequest = 30, + Color = Colors.Red, + AutomationId = "ColorBox" + }; + + var gr = new TapGestureRecognizer(); + gr.Command = new Command(() => + { + box.Color = box.Color == Colors.Red ? Colors.Yellow : Colors.Red; + }); + box.GestureRecognizers.Add(gr); + cells.View = new StackLayout() + { + Orientation = StackOrientation.Horizontal, + Children = + { + new Label() + { + Text = "Right click on any item within viewcell (including this label) should trigger context action on this row and you should see a coffee cup. Tap on colored box should change box color", + AutomationId = "ListViewItem" + }, + box + } + }; + + return cells; + }) + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1704.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1704.cs new file mode 100644 index 000000000000..aeb51556e2df --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1704.cs @@ -0,0 +1,556 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1704, "[Enhancement] Basic GIF animation features", PlatformAffected.UWP)] +public class Issue1704 : TestTabbedPage +{ + ContentPage _page1; + ContentPage _page2; + ContentPage _page3; + ContentPage _page4; + + protected override void Init() + { + _page1 = new OnLoadAnimationPage { Title = "On Load" }; + _page2 = new OnStartAnimationPage { Title = "On Start" }; + _page3 = new LoadImageSourceAnimationPage { Title = "Source" }; + _page4 = new MiscPage { Title = "Misc" }; + + Children.Add(_page1); + Children.Add(_page2); + Children.Add(_page3); + Children.Add(_page4); + } +} + +[Preserve(AllMembers = true)] +class OnLoadAnimationPage : ContentPage +{ + Label _referenceImageLabel; + Image _referenceImage; + Label _animatedImageLabel; + Image _animatedImage; + + public OnLoadAnimationPage() + { + _referenceImageLabel = new Label + { + Text = "Reference image (no animation).", + FontSize = 12, + FontAttributes = FontAttributes.Bold, + Margin = new Thickness(0, 12, 0, 12) + }; + + _referenceImage = new Image + { + Source = "GifTwo.gif", + HorizontalOptions = LayoutOptions.Start + }; + + _animatedImageLabel = new Label + { + Text = "Animated image (if this image isn't animating make sure you are using Fast Renderers).", + FontSize = 12, + FontAttributes = FontAttributes.Bold, + Margin = new Thickness(0, 12, 0, 12) + }; + + _animatedImage = new Image + { + Source = "GifTwo.gif", + HorizontalOptions = LayoutOptions.Start + }; + + Content = new StackLayout + { + Padding = new Thickness(0, 16), + Children = { + _referenceImageLabel, + _referenceImage, + _animatedImageLabel, + _animatedImage + } + }; + } + + protected override void OnAppearing() + { + base.OnAppearing(); + _animatedImage.IsAnimationPlaying = true; + } +} + +[Preserve(AllMembers = true)] +class OnStartAnimationPage : ContentPage +{ + Label _referenceImageLabel; + Image _referenceImage; + Label _animatedImageLabel; + Image _animatedImage; + Button _startStopButton; + + public OnStartAnimationPage() + { + _referenceImageLabel = new Label + { + Text = "Reference image (no animation).", + FontSize = 12, + FontAttributes = FontAttributes.Bold, + Margin = new Thickness(0, 12, 0, 12) + }; + + _referenceImage = new Image + { + Source = "GifOne.gif", + HorizontalOptions = LayoutOptions.Start + }; + + _animatedImageLabel = new Label + { + Text = "Animated image.", + FontSize = 12, + FontAttributes = FontAttributes.Bold, + Margin = new Thickness(0, 12, 0, 12) + }; + + _animatedImage = new Image + { + Source = "GifOne.gif", + HorizontalOptions = LayoutOptions.Start + }; + + _animatedImage.PropertyChanged += (sender, args) => + { + if (args.PropertyName == nameof(Image.IsAnimationPlaying)) + OnAnimationFinishedPlaying(sender, args); + }; + + _startStopButton = new Button { Text = "Start Animation", Margin = new Thickness(0, 20, 0, 0) }; + _startStopButton.Clicked += (object sender, EventArgs e) => + { + if (!_animatedImage.IsAnimationPlaying) + { + _animatedImage.IsAnimationPlaying = true; + _startStopButton.Text = "Stop Animation"; + } + else + { + _animatedImage.IsAnimationPlaying = false; + _startStopButton.Text = "Start Animation"; + } + }; + + Content = new ScrollView() + { + Content = + new StackLayout + { + Padding = new Thickness(0, 16), + Children = { + _startStopButton, + _referenceImageLabel, + _referenceImage, + _animatedImageLabel, + _animatedImage + } + } + }; + } + + void OnAnimationFinishedPlaying(object sender, EventArgs e) + { + _startStopButton.Text = "Start Animation"; + } +} + +// Example URI's: +// +// Small animated GIF (24 KB compressed, 14 frames) +// https://media.giphy.com/media/qyjQsUt0p0TT2/giphy.gif +// +// Medium animated GIF (184 KB compressed, 30 frames) +// https://media.giphy.com/media/xThta5b9vezPO75kL6/giphy.gif +// +// Semi large GIF (447 KB, 48 frames). +// https://media.giphy.com/media/AWNxDbtHGIJDW/giphy.gif +// +// Large animated GIF (3 MB compressed, 192 frames). +// https://media.giphy.com/media/YVYRtHiAv1t8Q/giphy.gif +// +// Large animated GIF that could trigger OOM scenarios and slow load times (12 MB compressed, 240 frames). +// http://media.giphy.com/media/mf8UbIDew7e8g/giphy.gif +// +[Preserve(AllMembers = true)] +class LoadImageSourceAnimationPage : ContentPage +{ + Label _animatedImageLabel; + Image _animatedImage; + Entry _imageSource; + Button _loadImageButton; + ActivityIndicator _loadingIndicator; + + class TimerContextData + { + public Image AnimationImage { get; set; } + public Entry ImageSource { get; set; } + public Button LoadButton { get; set; } + public ActivityIndicator LoadIndicator { get; set; } + public Timer Timer { get; set; } + } + + public LoadImageSourceAnimationPage() + { + _animatedImageLabel = new Label + { + Text = "Animated image.", + FontSize = 12, + FontAttributes = FontAttributes.Bold, + Margin = new Thickness(0, 12, 0, 12) + }; + + _animatedImage = new Image + { + HorizontalOptions = LayoutOptions.Start, + }; + + _imageSource = new Entry { Placeholder = "Image Source" }; + + _imageSource.Focused += (object sender, FocusEventArgs e) => + { + _imageSource.TextColor = null; + }; + + _loadImageButton = new Button { Text = "Load Image" }; + _loadImageButton.Clicked += (object sender, EventArgs e) => + { + if (!string.IsNullOrEmpty(_imageSource.Text) && !_animatedImage.IsLoading) + { + try + { + _loadImageButton.IsEnabled = false; + _imageSource.IsEnabled = false; + _loadingIndicator.IsVisible = true; + _loadingIndicator.IsRunning = true; + + _animatedImage.Source = ImageSource.FromUri(new Uri(_imageSource.Text)); + + var timerContext = new TimerContextData + { + AnimationImage = _animatedImage, + ImageSource = _imageSource, + LoadButton = _loadImageButton, + LoadIndicator = _loadingIndicator + }; + + var onLoadCompleteTimer = new Timer(OnLoadImageComplete, timerContext, 100, 100); + timerContext.Timer = onLoadCompleteTimer; + } + catch (Exception) + { + _imageSource.TextColor = Colors.Red; + _loadImageButton.IsEnabled = true; + _imageSource.IsEnabled = true; + _loadingIndicator.IsVisible = false; + _loadingIndicator.IsRunning = false; + } + } + }; + + _loadingIndicator = new ActivityIndicator + { + IsVisible = false, + IsRunning = false + }; + + Content = new ScrollView() + { + Content = new StackLayout + { + Padding = new Thickness(0, 16), + Children = { + _loadImageButton, + _animatedImageLabel, + _animatedImage, + _imageSource, + _loadingIndicator, + } + } + }; + } + + + protected override void OnAppearing() + { + base.OnAppearing(); + _animatedImage.IsAnimationPlaying = true; + } + + static void OnLoadImageComplete(Object state) + { + if (state is TimerContextData context) + { + lock (context) + { + if (context.AnimationImage != null && !context.AnimationImage.IsLoading) + { + var animationImage = context.AnimationImage; + var imageSource = context.ImageSource; + var loadButton = context.LoadButton; + var loadingIndicator = context.LoadIndicator; + + context.Timer?.Dispose(); + context.Timer = null; + + context.AnimationImage = null; + context.ImageSource = null; + context.LoadButton = null; + context.LoadIndicator = null; + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(() => + { + if (loadButton != null) + loadButton.IsEnabled = true; + + if (loadingIndicator != null) + { + loadingIndicator.IsVisible = false; + loadingIndicator.IsRunning = false; + } + + if (imageSource != null) + imageSource.IsEnabled = true; + + if (animationImage != null) + { + animationImage.IsAnimationPlaying = true; + } + }); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + } + } + } + } +} + +[Preserve(AllMembers = true)] +class MiscPage : ContentPage +{ + Label _noAnimationFallbackLabel; + Image _noAnimationFallbackImage; + Label _initNoAnimationLabel; + Image _initNoAnimationImage; + Button _initNoAnimationButton; + Label _stressTestLabel; + Label _stressTestIterationLabel; + Entry _stressTestItertionEntry; + Image _stressTestImage; + Button _startStressTestButton; + ProgressBar _stressTestProgressBar; + Button _stopStressTestButton; + + int _stressTestIterationCount = 1000; + AutoResetEvent _nextStressTest = new AutoResetEvent(false); + bool _abortStressTest = false; + + protected override void OnAppearing() + { + base.OnAppearing(); + _noAnimationFallbackImage.IsAnimationPlaying = true; + _stressTestImage.IsAnimationPlaying = true; + } + + public MiscPage() + { + _noAnimationFallbackLabel = new Label + { + Text = "No animation error fallback.", + FontSize = 12, + FontAttributes = FontAttributes.Bold, + Margin = new Thickness(0, 12, 0, 12) + }; + + _noAnimationFallbackImage = new Image + { + Source = "coffee.png", + HorizontalOptions = LayoutOptions.Start + }; + + _initNoAnimationLabel = new Label + { + Text = "Initial loaded without animation.", + FontSize = 12, + FontAttributes = FontAttributes.Bold, + Margin = new Thickness(0, 12, 0, 12) + }; + + _initNoAnimationImage = new Image + { + Source = "GifTwo.gif", + HorizontalOptions = LayoutOptions.Start + }; + + _initNoAnimationButton = new Button + { + Text = "Start Animation", + Margin = new Thickness(0, 12, 0, 12) + }; + + _initNoAnimationButton.Clicked += (object sender, EventArgs e) => + { + + if (!_initNoAnimationImage.IsAnimationPlaying) + { + _initNoAnimationImage.IsAnimationPlaying = true; + _noAnimationFallbackImage.IsAnimationPlaying = true; + + _initNoAnimationButton.Text = "Stop Animation"; + } + else + { + _initNoAnimationImage.IsAnimationPlaying = false; + _noAnimationFallbackImage.IsAnimationPlaying = false; + + _initNoAnimationButton.Text = "Start Animation"; + } + }; + + _stressTestLabel = new Label + { + Text = "Image loading stress test.", + FontSize = 12, + FontAttributes = FontAttributes.Bold, + Margin = new Thickness(0, 24, 0, 0) + }; + + _stressTestIterationLabel = new Label + { + Text = "Test iterations:", + FontSize = 12, + FontAttributes = FontAttributes.Bold + }; + + _stressTestItertionEntry = new Entry { Text = _stressTestIterationCount.ToString() }; + + _stressTestImage = new Image + { + Source = "GifTwo.gif", + HorizontalOptions = LayoutOptions.Start, + IsVisible = false + }; + + _startStressTestButton = new Button + { + Text = "Run Stress Test", + Margin = new Thickness(0, 12, 0, 12) + }; + + _startStressTestButton.Clicked += (object sender, EventArgs e) => + { + + _startStressTestButton.Text = "Running..."; + _startStressTestButton.IsEnabled = false; + _stopStressTestButton.IsEnabled = true; + _abortStressTest = false; + + int.TryParse(_stressTestItertionEntry.Text, out _stressTestIterationCount); + +#if WINDOWS + Task.Run(runStressTest); +#else + ThreadPool.QueueUserWorkItem(delegate + { runStressTest(); }); +#endif + }; + + _stressTestProgressBar = new ProgressBar(); + + _stopStressTestButton = new Button + { + Text = "Stop Stress Test", + IsEnabled = false, + Margin = new Thickness(0, 12, 0, 12) + }; + + _stopStressTestButton.Clicked += (object sender, EventArgs e) => + { + _stopStressTestButton.IsEnabled = false; + _abortStressTest = true; + }; + + Content = new StackLayout + { + Padding = new Thickness(0, 16), + Children = { + _noAnimationFallbackLabel, + _noAnimationFallbackImage, + _initNoAnimationLabel, + _initNoAnimationImage, + _initNoAnimationButton, + _stressTestLabel, + _stressTestIterationLabel, + _stressTestItertionEntry, + _stressTestImage, + _startStressTestButton, + _stressTestProgressBar, + _stopStressTestButton + } + }; + } + + async void runStressTest() + { + for (int i = 0; i < _stressTestIterationCount && !_abortStressTest; i++) + { +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(() => + { + if (i % 2 == 0) + { + _stressTestImage.Source = "GifTwo.gif"; + } + else + { + _stressTestImage.Source = "GifOne.gif"; + } + + _stressTestProgressBar.Progress = (double)i / (double)_stressTestIterationCount; + + _nextStressTest.Set(); + }); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + + _nextStressTest.WaitOne(); + + while (_stressTestImage.IsLoading) + await Task.Delay(10).ConfigureAwait(false); + + await Task.Delay(10).ConfigureAwait(false); + } + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(() => + { + _startStressTestButton.Text = "Run Stress Test"; + _startStressTestButton.IsEnabled = true; + _stopStressTestButton.IsEnabled = false; + if (!_abortStressTest) + _stressTestProgressBar.Progress = 1; + }); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1763.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1763.cs new file mode 100644 index 000000000000..c42de8a6ac5d --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1763.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1763, "First item of grouped ListView not firing .ItemTapped", PlatformAffected.WinPhone, NavigationBehavior.PushAsync)] +public class Issue1763 : TestTabbedPage +{ + public Issue1763() + { + + } + + protected override void Init() + { + Title = "Contacts"; + Children.Add(new ContactsPage()); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1777.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1777.cs new file mode 100644 index 000000000000..194b19b91d66 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1777.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1777, "Adding picker items when picker is in a ViewCell breaks", PlatformAffected.WinPhone)] +public class Issue1777 : TestContentPage +{ + Picker _pickerTable = null; + Picker _pickerNormal = null; + string _pickerTableId = "pickerTableId"; + string _btnText = "do magic"; + + protected override void Init() + { + StackLayout stackLayout = new StackLayout(); + Content = stackLayout; + + var instructions = new Label + { + Text = $@"Tap the ""{_btnText}"" button. Then click on the picker inside the Table. The picker should display ""test 0"". If not, the test failed." + }; + + stackLayout.Children.Add(instructions); + + TableView tableView = new TableView(); + stackLayout.Children.Add(tableView); + + TableRoot tableRoot = new TableRoot(); + tableView.Root = tableRoot; + + TableSection tableSection = new TableSection("Table"); + tableRoot.Add(tableSection); + + ViewCell viewCell = new ViewCell(); + tableSection.Add(viewCell); + + ContentView contentView = new ContentView(); +#pragma warning disable CS0618 // Type or member is obsolete + contentView.HorizontalOptions = LayoutOptions.FillAndExpand; +#pragma warning restore CS0618 // Type or member is obsolete + viewCell.View = contentView; + + _pickerTable = new Picker(); + _pickerTable.AutomationId = _pickerTableId; +#pragma warning disable CS0618 // Type or member is obsolete + _pickerTable.HorizontalOptions = LayoutOptions.FillAndExpand; +#pragma warning restore CS0618 // Type or member is obsolete + contentView.Content = _pickerTable; + + Label label = new Label(); + label.Text = "Normal"; + stackLayout.Children.Add(label); + + _pickerNormal = new Picker(); + stackLayout.Children.Add(_pickerNormal); + + Button button = new Button(); + button.Clicked += button_Clicked; + button.Text = _btnText; + stackLayout.Children.Add(button); + + //button_Clicked(button, EventArgs.Empty); + _pickerTable.SelectedIndex = 0; + _pickerNormal.SelectedIndex = 0; + } + + void button_Clicked(object sender, EventArgs e) + { + _pickerTable.Items.Add("test " + _pickerTable.Items.Count); + _pickerNormal.Items.Add("test " + _pickerNormal.Items.Count); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue17969.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue17969.xaml.cs index 3fad15402b5e..1c4c9cfa0e77 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue17969.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue17969.xaml.cs @@ -29,10 +29,6 @@ private void OnResetClicked(object sender, EventArgs e) } - public class TestItem - { - public string Name { get; set; } - } public class Animal { public string Name { get; set; } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1875.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1875.cs new file mode 100644 index 000000000000..578c25c0450f --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1875.cs @@ -0,0 +1,126 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1875, "NSRangeException adding items through ItemAppearing", PlatformAffected.iOS)] +public class Issue1875 + : TestContentPage +{ + MainViewModel _viewModel; + int _start = 0; + const int NumberOfRecords = 15; + + + protected override void Init() + { +#pragma warning disable CS0618 // Type or member is obsolete + Button loadData = new Button { Text = "Load", HorizontalOptions = LayoutOptions.FillAndExpand }; +#pragma warning restore CS0618 // Type or member is obsolete +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0618 // Type or member is obsolete + ListView mainList = new ListView + { + VerticalOptions = LayoutOptions.FillAndExpand, + HorizontalOptions = LayoutOptions.FillAndExpand + }; +#pragma warning restore CS0618 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + + mainList.SetBinding(ListView.ItemsSourceProperty, "Items"); + + _viewModel = new MainViewModel(); + BindingContext = _viewModel; + loadData.Clicked += async (sender, e) => + { + await LoadData(); + }; + + mainList.ItemAppearing += OnItemAppearing; + + Content = new StackLayout + { + Children = { + loadData, + mainList + } + }; + } + + async void OnItemAppearing(object sender, ItemVisibilityEventArgs e) + { + if (e.Item == null) + return; + var item = (int)e.Item; + if (!_viewModel.IsLoading && item == _viewModel.Items.Last()) + await LoadData(); + } + + async Task LoadData() + { + await _viewModel.LoadData(_start, NumberOfRecords); + _start = _start + NumberOfRecords; + } + + public class MainViewModel : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + + public MainViewModel() + { + } + + ObservableCollection _items; + public ObservableCollection Items + { + get + { + if (_items == null) + _items = new ObservableCollection(); + + return _items; + } + set + { + _items = value; + PropertyChanged(this, new PropertyChangedEventArgs("Items")); + } + } + + bool _isLoading; + public bool IsLoading + { + get + { + return _isLoading; + } + set + { + if (_isLoading != value) + { + _isLoading = value; + PropertyChanged(this, new PropertyChangedEventArgs("IsLoading")); + } + } + } + +#pragma warning disable 1998 // considered for removal + public async Task LoadData(int start, int numberOfRecords) +#pragma warning restore 1998 + { + IsLoading = true; + for (int counter = 0; counter < numberOfRecords; counter++) + Items.Add(start + counter); + + IsLoading = false; + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue1939.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue1939.cs new file mode 100644 index 000000000000..be33d0dfb30d --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue1939.cs @@ -0,0 +1,158 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 1939, "ArgumentOutOfRangeException on clearing a group on a grouped ListView on Android", PlatformAffected.Android)] +public class Issue1939 : TestContentPage +{ + ObservableCollection Data { get; set; } = new ObservableCollection(); + + readonly GroupedData _temp1 = new GroupedData() { GroupName = $"Group #1", HasHeader = true }; + readonly GroupedData _temp2 = new GroupedData() { GroupName = $"Group #2", HasHeader = false }; + + protected override void Init() + { + var listView = new ListView + { + IsGroupingEnabled = true, + ItemTemplate = new DataTemplate(typeof(GroupItemTemplate)), + GroupHeaderTemplate = new MyDataTemplateSelector(), + ItemsSource = Data + }; + + Content = new StackLayout + { + VerticalOptions = LayoutOptions.Center, + Children = { + new Label { Text = "This test adds two groups to this list and then clears the items from one of them. If the test crashes, this test has failed." }, + listView + } + }; + } + + protected override void OnAppearing() + { + base.OnAppearing(); + + FillResults(_temp1, 5, true); + + Data.Add(_temp1); + Data.Add(_temp2); + + FillResults(_temp2, 5, false); + } + + async void FillResults(GroupedData results, int items, bool clear) + { + results.Clear(); + + await Task.Delay(200); + + for (int i = 0; i < items; i++) + { + results.Add(new GroupItem { DisplayText = $"Text for ListView item {i}" }); + } + + if (!clear) + return; + + await Task.Delay(1000); + + results.Clear(); + } + + [Preserve(AllMembers = true)] + public class MyDataTemplateSelector : DataTemplateSelector + { + readonly DataTemplate firstGroupTemplate; + readonly DataTemplate secondGroupTemplate; + + public MyDataTemplateSelector() + { + firstGroupTemplate = new DataTemplate(typeof(GroupNoHeaderTemplate)); + secondGroupTemplate = new DataTemplate(typeof(GroupHeaderTemplate)); + } + + protected override DataTemplate OnSelectTemplate(object item, BindableObject container) + { + if (!(item is GroupedData model)) + { + return null; + } + + if (model.HasHeader) + return secondGroupTemplate; + + return firstGroupTemplate; + } + } + + [Preserve(AllMembers = true)] + public class GroupItem + { + public string DisplayText { get; set; } + } + + [Preserve(AllMembers = true)] + public class GroupedData : ObservableCollection + { + public string GroupName { get; set; } + public bool HasHeader { get; set; } + } + + [Preserve(AllMembers = true)] + public class GroupItemTemplate : ViewCell + { + public GroupItemTemplate() + { + var title = new Label() { FontSize = 14 }; + title.SetBinding(Label.TextProperty, new Binding("DisplayText", BindingMode.OneWay)); + + View = new StackLayout + { + Orientation = StackOrientation.Horizontal, + Padding = new Thickness(8), + Children = { title } + }; + } + } + + [Preserve(AllMembers = true)] + public class GroupHeaderTemplate : ViewCell + { + public GroupHeaderTemplate() + { + var title = new Label { TextColor = Colors.White, FontSize = 16 }; + title.SetBinding(Label.TextProperty, new Binding("GroupName", BindingMode.OneWay)); + +#pragma warning disable CS0618 // Type or member is obsolete + View = new StackLayout + { + Padding = new Thickness(8, 0), + VerticalOptions = LayoutOptions.StartAndExpand, + BackgroundColor = Color.FromArgb("#6D91BA"), + Orientation = StackOrientation.Horizontal, + Children = { title }, + }; +#pragma warning restore CS0618 // Type or member is obsolete + } + } + + [Preserve(AllMembers = true)] + public class GroupNoHeaderTemplate : ViewCell + { + public GroupNoHeaderTemplate() + { + View = new StackLayout + { + BackgroundColor = Colors.White, + }; + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue198.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue198.cs new file mode 100644 index 000000000000..cdfedf3f2ee8 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue198.cs @@ -0,0 +1,56 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 198, "TabbedPage shouldn't proxy content of NavigationPage", PlatformAffected.iOS)] +public class Issue198 : TestTabbedPage +{ + protected override void Init() + { + Title = "Tabbed Navigation Page"; + + var leavePageBtn = new Button + { + Text = "Leave" + }; + + // Should work as expected, however, causes NRE + leavePageBtn.Clicked += (s, e) => Navigation.PopModalAsync(); + + var navigationPageOne = new NavigationPage(new ContentPage + { + IconImageSource = "calculator.png", + Content = leavePageBtn + }) + { + Title = "Page One", + }; + var navigationPageTwo = new NavigationPage(new ContentPage + { + IconImageSource = "calculator.png", + }) + { + Title = "Page Two", + }; + var navigationPageThree = new NavigationPage(new ContentPage + { + Title = "No Crash", + }) + { + Title = "Page Three", + IconImageSource = "calculator.png" + }; + var navigationPageFour = new NavigationPage(new ContentPage()) + { + Title = "Page Four", + IconImageSource = "calculator.png" + }; + + Children.Add(navigationPageOne); + Children.Add(navigationPageTwo); + Children.Add(navigationPageThree); + Children.Add(navigationPageFour); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21728.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue21728.xaml.cs index da9a3efa0d7e..20aa727141bd 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue21728.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21728.xaml.cs @@ -8,18 +8,18 @@ namespace Maui.Controls.Sample.Issues; [Issue(IssueTracker.Github, 21728, "CollectionView item alignment issue when a single item is present with a footer", PlatformAffected.iOS)] public partial class Issue21728 : ContentPage { - public IList Items { get; set; } + public IList Items { get; set; } public Issue21728() { InitializeComponent(); BindingContext = this; - Items = new List(); - Items.Add(new TestItem() { Name = "Test Item 1" }); + Items = new List(); + Items.Add(new Issue21728TestItem() { Name = "Test Item 1" }); collectionview.ItemsSource = Items; } - public class TestItem + public class Issue21728TestItem { public string Name { get; set; } } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2266.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2266.cs new file mode 100644 index 000000000000..0bbfd1491dea --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2266.cs @@ -0,0 +1,189 @@ +using System; +using System.Collections.Generic; +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2266, "Setting a different Detail page from a FlyoutPage after 2nd time on MainPage", PlatformAffected.iOS)] +public class Issue2266 : TestContentPage +{ + protected override void Init() + { + InitPageContent(); + } + + void InitPageContent() + { +#pragma warning disable CS0618 // Type or member is obsolete + var labelHeader = new Label + { + Text = "Select a test", + FontSize = 30, + FontAttributes = FontAttributes.Bold, + VerticalOptions = LayoutOptions.Center, + HorizontalOptions = LayoutOptions.CenterAndExpand + }; +#pragma warning restore CS0618 // Type or member is obsolete + + string[] listItems = { + "FlyoutPage Navigation", + "FlyoutPage Navigation ->> Page 1", + "FlyoutPage Navigation ->> Page 2", + "FlyoutPage Navigation ->> Page 3" + }; + + var listView = new ListView + { + ItemsSource = listItems + }; + + Content = new StackLayout + { + Padding = new Thickness(0, 20, 0, 0), + Children = { + labelHeader, + listView + } + }; + + listView.ItemSelected += delegate (object sender, SelectedItemChangedEventArgs e) + { + if (e.SelectedItem == null) + return; + if (e.SelectedItem.Equals(listItems[0])) + { + Application.Current.MainPage = FlyoutPageHost; + } + else if (e.SelectedItem.Equals(listItems[1]) || e.SelectedItem.Equals(listItems[2]) || e.SelectedItem.Equals(listItems[3])) + { + // FlyoutPage Navigation - direct page open + var item = e.SelectedItem.ToString(); + var index = int.Parse(item.Substring(item.Length - 1)) - 1; + Application.Current.MainPage = FlyoutPageHost; + FlyoutPageHost.OpenPage(index); + } + + listView.SelectedItem = null; + }; + } + + static FlyoutPageNavigation s_FlyoutPageHost; + + static FlyoutPageNavigation FlyoutPageHost + { + get + { + if (s_FlyoutPageHost == null) + s_FlyoutPageHost = new FlyoutPageNavigation(); + return s_FlyoutPageHost; + } + } +} + +[Preserve(AllMembers = true)] +public class FlyoutPageNavigation : FlyoutPage +{ + List _pages; + + public FlyoutPageNavigation() + { + InitPages(); + + var menuList = new ListView + { + BackgroundColor = Colors.Transparent, + ItemsSource = _pages, + ItemTemplate = new DataTemplate(typeof(TextCell)) + }; + menuList.ItemTemplate.SetBinding(TextCell.TextProperty, "Title"); + + Flyout = new ContentPage + { + BackgroundColor = Color.FromArgb("363636"), + Title = "Menu", + Content = menuList + }; + + Detail = new NavigationPage(new ContentPage + { + Padding = new Thickness(20, 20), + Content = new StackLayout + { + Children = { + new Label { Text = "Select a menu item" }, + new Button {Command = new Command(() => this.IsPresented = true), AutomationId = "OpenMaster", Text = "Open Flyout"} + } + } + }); + + menuList.ItemSelected += (sender, e) => + { + var page = e.SelectedItem as NavigationPage; + if (page != null) + { + Detail = page; + IsPresented = false; + } + }; + } + + void InitPages() + { + _pages = new List(); + + for (int i = 1; i <= 10; i++) + { + var btnSubPage = new Button + { + Text = string.Format("Open sub-page"), + }; + btnSubPage.Clicked += delegate + { + OpenSubPage(string.Format("Sub for page: {0}", i)); + }; + var page = new ContentPage + { + Padding = new Thickness(20, 20), + Title = string.Format("Page {0}", i), + Content = new StackLayout + { + Children = { + new Label { AutomationId = "Page {0}", Text = string.Format ("Page {0}", i) }, + btnSubPage + } + } + }; + page.ToolbarItems.Add(new ToolbarItem("START", null, delegate + { + Application.Current.MainPage = new Issue2266(); + }) + { + AutomationId = "START" + }); + + _pages.Add(new NavigationPage(page) { Title = page.Title }); + } + } + + public void OpenPage(int index) + { + if (index >= _pages.Count) + { + // Index out of range + return; + } + Detail = _pages[index]; + } + + async void OpenSubPage(string text) + { + await Detail.Navigation.PushAsync(new ContentPage + { + Content = new Label { Text = text } + }); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2272.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2272.cs new file mode 100644 index 000000000000..0d2eec705302 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2272.cs @@ -0,0 +1,28 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2272, "Entry text updating set focus on the beginning of text not the end of it", PlatformAffected.Android)] +public class Issue2272 : TestContentPage +{ + protected override void Init() + { + var userNameEditor = new Entry() { AutomationId = "userNameEditorEmptyString", Text = "userNameEditorEmptyString" }; + userNameEditor.Focused += (sender, args) => + { + userNameEditor.Text = "focused"; + }; + + Content = new StackLayout + { + Spacing = 10, + VerticalOptions = LayoutOptions.Start, + Children = { userNameEditor } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2414.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2414.cs new file mode 100644 index 000000000000..6570262ff4cd --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2414.cs @@ -0,0 +1,52 @@ +using System; +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2414, "NullReferenceException when swiping over Context Actions", PlatformAffected.WinPhone)] +public class Issue2414 : TestContentPage +{ + protected override void Init() + { + var tableView = new TableView + { + Intent = TableIntent.Settings, + Root = new TableRoot("TableView Title") + { + new TableSection("Table Section 2") + { + new TextCell + { + Text = "Swipe ME", + Detail = "And I will crash!", + ContextActions = { + new MenuItem + { + Text = "Text0" + },new MenuItem + { + Text = "Text1" + }, + new MenuItem + { + Text = "Text2" + }, + new MenuItem + { + Text = "Text3" + }, + new MenuItem + { + Text = "Text4", + IsDestructive = true, + }} + }, + } + } + }; + Content = tableView; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2499.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2499.cs new file mode 100644 index 000000000000..c19374193188 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2499.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2499, "Binding Context set to Null in Picker", PlatformAffected.All)] +public class Issue2499 : TestContentPage +{ + protected override void Init() + { + var _picker = new Picker() + { + ItemsSource = new List { "cat", "mouse", "rabbit" }, + AutomationId = "picker", + }; + _picker.SelectedIndexChanged += (_, __) => _picker.ItemsSource = null; + + Content = new StackLayout() + { + Children = + { + _picker + } + }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2597.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2597.cs new file mode 100644 index 000000000000..12a21b8c6fd2 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2597.cs @@ -0,0 +1,69 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Devices; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2597, "Stepper control .IsEnabled doesn't work", PlatformAffected.Android)] +public class Issue2597 : TestContentPage +{ + Label _label; + + protected override void Init() + { + Label header = new Label + { + Text = "Stepper", + HorizontalOptions = LayoutOptions.Center + }; + +#pragma warning disable CS0618 // Type or member is obsolete + Stepper stepper = new Stepper + { + Minimum = 0, + Maximum = 10, + Increment = 0.1, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.CenterAndExpand, + IsEnabled = false + }; +#pragma warning restore CS0618 // Type or member is obsolete + stepper.ValueChanged += OnStepperValueChanged; + +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + _label = new Label + { + Text = "Stepper value is 0", + FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.CenterAndExpand + }; +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + + // Accomodate iPhone status bar. + Padding = DeviceInfo.Platform == DevicePlatform.iOS ? new Thickness(10, 20, 10, 5) : new Thickness(10, 0, 10, 5); + + // Build the page. + Content = new StackLayout + { + Children = + { + header, + stepper, + _label + } + }; + } + + void OnStepperValueChanged(object sender, ValueChangedEventArgs e) + { + _label.Text = string.Format("Stepper value is {0:F1}", e.NewValue); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue264.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue264.cs new file mode 100644 index 000000000000..2bc235af6767 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue264.cs @@ -0,0 +1,47 @@ +using System; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 264, "PopModal NRE", PlatformAffected.Android | PlatformAffected.iOS)] +public class Issue264 : TestContentPage +{ + protected override void Init() + { + var aboutBtn = new Button + { + Text = "About" + }; + + aboutBtn.Clicked += (s, e) => Navigation.PushModalAsync(new AboutPage()); + + var popButton = new Button + { + Text = "Pop me", + Command = new Command(async () => await Navigation.PopAsync()) + }; + + Content = new StackLayout + { + Children = { + new Label {Text = "Home"}, + aboutBtn, + popButton + } + }; + } +} + +public class AboutPage : ContentPage +{ + public AboutPage() + { + BackgroundColor = Colors.Bisque; + Content = new Button { Text = "Close", Command = new Command(() => Navigation.PopModalAsync()) }; + + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2681.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2681.cs new file mode 100644 index 000000000000..674b6283f08d --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2681.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2681, "[UWP] Label inside Listview gets stuck inside infinite loop", PlatformAffected.UWP)] +public class Issue2681 : TestNavigationPage +{ + const string NavigateToPage = "Click Me."; + protected override void Init() + { + PushAsync(new ContentPage() { Title = "Freeze Test", Content = new Button() { Text = NavigateToPage, Command = new Command(() => this.PushAsync(new FreezeMe())) } }); + } + + [Preserve(AllMembers = true)] + public partial class FreezeMe : ContentPage + { + public List Items { get; set; } + + public FreezeMe() + { + this.BindingContext = this; + var lv = new ListView() + { + Margin = new Thickness(20, 5, 5, 5) + }; + + lv.ItemTemplate = new DataTemplate(() => + { + var label = new Label() { Text = "sassifrass" }; + label.SetBinding(Label.TextProperty, "."); + return new ViewCell() { View = label }; + }); + + lv.SetBinding(ListView.ItemsSourceProperty, "Items"); + + this.Content = new ScrollView() + { + Content = new StackLayout() + { + Children = + { + new Label(){ Text = "If page is not frozen this test has passed" }, + new StackLayout() + { + Orientation = StackOrientation.Horizontal, + Children = {lv } + } + } + } + }; + + this.Appearing += (s, e) => + { + this.Items = new List { 1, 2, 3 }; + this.OnPropertyChanged("Items"); + }; + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2740.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2740.cs new file mode 100644 index 000000000000..343fe9b04c5b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2740.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2740, "System.NotSupportedException: Unable to activate instance of type Microsoft.Maui.Controls.Platform.Android.PageContainer from native handle", PlatformAffected.Android)] +public class Issue2740 : TestFlyoutPage +{ + protected override void Init() + { + var page = new AddressListView(); + + // Initialize ui here instead of ctor + Flyout = new ContentPage + { + Content = new Label + { + Text = "Click a item on the left then the toolbar item switch" + }, + Title = "2740" + }; + Detail = new NavigationPage(page); + } + + public partial class AddressListView : ContentPage + { + + public AddressListView() + { + var listview = new ListView(); + listview.ItemsSource = new List { "1", "2" }; + listview.ItemTapped += OnItemTapped; + Content = listview; + Title = "Unit List"; + } + + public async void OnItemTapped(object sender, ItemTappedEventArgs e) + { + var p = new UnitViolationView(); + await Navigation.PushAsync(p); + } + } + + public partial class UnitViolationView : ContentPage + { + public UnitViolationView() + { + ToolbarItems.Add(new ToolbarItem("Switch", null, MapAddressSwitch) { AutomationId = "Switch" }); + } + + async void MapAddressSwitch() + { + await Navigation.PopAsync(false); + (Application.Current.MainPage as FlyoutPage).Detail = new NavigationPage(new AddressListView()); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2767.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2767.cs new file mode 100644 index 000000000000..11e0ee3a352b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2767.cs @@ -0,0 +1,38 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2767, "ArgumentException: NaN not valid for height", PlatformAffected.All)] +public class Issue2767 : TestContentPage +{ + protected override void Init() + { + var grid = new Grid + { + RowDefinitions = + { + new RowDefinition { Height = new GridLength(0, GridUnitType.Star) }, + new RowDefinition { Height = new GridLength(60, GridUnitType.Star) }, + }, + ColumnDefinitions = + { + new ColumnDefinition { Width = new GridLength(0, GridUnitType.Star) }, + new ColumnDefinition { Width = new GridLength(10, GridUnitType.Star) }, + } + }; + grid.AddChild(new Label { Text = "Collapsed" }, 0, 0); + grid.AddChild(new Label { Text = "Collapsed" }, 0, 1); + grid.AddChild(new Label { Text = "Collapsed" }, 1, 0); + grid.AddChild(new Label { Text = "Label 1:1" }, 1, 1); + +#pragma warning disable CS0618 // Type or member is obsolete + Content = new Frame + { + HorizontalOptions = LayoutOptions.CenterAndExpand, + Content = grid + }; +#pragma warning restore CS0618 // Type or member is obsolete + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2794.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2794.cs new file mode 100644 index 000000000000..e25246fa2fad --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2794.cs @@ -0,0 +1,62 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2794, "TableView does not react on underlying collection change", PlatformAffected.Android)] +public class Issue2794 : TestContentPage +{ + TableSection _dataSection; + + protected override void Init() + { + var tableView = new TableView(); + _dataSection = new TableSection(); + var cell1 = new TextCell { Text = "Cell1" }; + cell1.ContextActions.Add(new MenuItem + { + Text = "Delete me after", + IsDestructive = true, + Command = new Command(Delete), + CommandParameter = 0 + }); + + var cell2 = new TextCell { Text = "Cell2" }; + cell2.ContextActions.Add(new MenuItem + { + Text = "Delete me first", + IsDestructive = true, + Command = new Command(Delete), + CommandParameter = 1 + }); + + _dataSection.Add(cell1); + _dataSection.Add(cell2); + tableView.Root.Add(_dataSection); + var step1Label = new Label { Text = "• Tap and hold 'Cell2'" }; + var step2Label = new Label { Text = "• Tap 'Delete me first'" }; + var step3Label = new Label { Text = "• Tap and hold 'Cell1'" }; + var step4Label = new Label { Text = "• Tap 'Delete me after'" }; + var expectedLabel = new Label { Text = "Expected: 'Cell1' and 'Cell2' was deleted" }; + Content = new StackLayout + { + Padding = new Thickness(15, 15, 0, 0), + Children = + { + step1Label, + step2Label, + step3Label, + step4Label, + expectedLabel, + tableView + } + }; + } + + protected void Delete(object parameters) + { + var rowId = (int)parameters; + _dataSection.RemoveAt(rowId); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2809.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2809.cs new file mode 100644 index 000000000000..c89a874aa568 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2809.cs @@ -0,0 +1,23 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2809, "Secondary ToolbarItems cause app to hang during PushAsync", PlatformAffected.iOS)] +public class Issue2809 : TestContentPage +{ + protected override void Init() + { + ToolbarItems.Add(new ToolbarItem("Item 1", string.Empty, + DummyAction, ToolbarItemOrder.Secondary)); + + ToolbarItems.Add(new ToolbarItem("Item 2", string.Empty, + DummyAction, ToolbarItemOrder.Secondary)); + } + + public void DummyAction() + { + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2818.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2818.cs new file mode 100644 index 000000000000..a1f9e3fbaca8 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2818.cs @@ -0,0 +1,75 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Devices; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2818, "Right-to-Left FlyoutPage in Xamarin.Forms Hamburger icon issue", PlatformAffected.Android)] +public class Issue2818 : TestFlyoutPage +{ + + protected override void Init() + { + FlowDirection = FlowDirection.RightToLeft; + Flyout = new ContentPage + { + Title = "Flyout", + BackgroundColor = Colors.SkyBlue, + IconImageSource = "menuIcon", + Content = new StackLayout() + { + Children = + { + new Button() + { + Text = "If you can see me the test has passed", + AutomationId = "CloseRootView", + Command = new Command(() => IsPresented = false) + } + }, + AutomationId = "RootLayout" + }, + Padding = new Thickness(0, 42, 0, 0) + }; + + Detail = new NavigationPage(new ContentPage + { + Title = "Detail", + Content = new StackLayout + { + Children = { + new Label + { + Text = "The page must be with RightToLeft FlowDirection. Hamburger icon in main page must be going to right side. There should be visible text inside the Flyout View" + }, + new Button + { + Text = "Set RightToLeft", + Command = new Command(() => FlowDirection = FlowDirection.RightToLeft), + AutomationId = "ShowRightToLeft" + }, + new Button + { + Text = "Set LeftToRight", + Command = new Command(() => FlowDirection = FlowDirection.LeftToRight), + AutomationId = "ShowLeftToRight" + }, + new Button + { + Text = "Open Flyout View", + Command = new Command(() => IsPresented = true), + AutomationId = "OpenRootView" + }, + new Label() + { + Text = DeviceInfo.Idiom.ToString(), + AutomationId = "Idiom" + } + } + } + }); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2883.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2883.cs new file mode 100644 index 000000000000..b7affec6678b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2883.cs @@ -0,0 +1,104 @@ +using System; +using System.Collections.Generic; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2883, "ViewCell IsEnabled set to false does not disable a cell in a TableView")] +public class Issue2883 : TestContentPage +{ + protected override void Init() + { + var btnCustom1 = new Button() + { + AutomationId = "btnCustomCellTable", + Text = "Custom Table Cell", + HorizontalOptions = LayoutOptions.Start + }; + var btnCustom1Enabled = new Button() + { + AutomationId = "btnCustomCellTableEnabled", + Text = "Custom Table Cell Enabled", + HorizontalOptions = LayoutOptions.Start + }; + + var btnCustom = new Button() + { + AutomationId = "btnCustomCellListView", + Text = "Custom Cell", + HorizontalOptions = LayoutOptions.Start + }; + + var btnCustomEnabled = new Button() + { + AutomationId = "btnCustomCellListViewEnabled", + Text = "Custom Cell Enabled", + HorizontalOptions = LayoutOptions.Start + }; + + btnCustom.Clicked += (object sender, EventArgs e) => + { + DisplayAlert("Clicked", "I was clicked even disabled", "ok"); + }; + btnCustom1.Clicked += (object sender, EventArgs e) => + { + DisplayAlert("Clicked", "I was clicked even disabled", "ok"); + }; + + btnCustom1Enabled.Clicked += (object sender, EventArgs e) => + { + DisplayAlert("Clicked", "I was clicked", "ok"); + }; + btnCustomEnabled.Clicked += (object sender, EventArgs e) => + { + DisplayAlert("Clicked", "I was clicked", "ok"); + }; + + var customCell = new ViewCell() + { + IsEnabled = false, + View = new StackLayout { Children = { btnCustom } } + }; + + var customCellEnabled = new ViewCell() + { + View = new StackLayout { Children = { btnCustomEnabled } } + }; + + var customTableCell = new ViewCell() + { + IsEnabled = false, + View = new StackLayout { Children = { btnCustom1 } } + }; + + var customTableCellEnabled = new ViewCell() + { + View = new StackLayout { Children = { btnCustom1Enabled } } + }; + + var tableview = new TableView() + { + Intent = TableIntent.Form, + Root = new TableRoot(), + VerticalOptions = LayoutOptions.Start + }; + + tableview.Root.Add(new TableSection() { customTableCell, customTableCellEnabled }); + + var listview = new ListView { VerticalOptions = LayoutOptions.Start }; + var listview2 = new ListView { VerticalOptions = LayoutOptions.Start }; + + listview.ItemTemplate = new DataTemplate(() => customCell); + listview2.ItemTemplate = new DataTemplate(() => customCellEnabled); + listview2.ItemsSource = listview.ItemsSource = new List() { "1" }; + + Content = new StackLayout + { + Orientation = StackOrientation.Vertical, + VerticalOptions = LayoutOptions.Start, + Children = { tableview, listview, listview2 } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2894.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2894.cs new file mode 100644 index 000000000000..f598947adb2b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2894.cs @@ -0,0 +1,210 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2894, "Gesture Recognizers added to Span after it's been set to FormattedText don't work and can cause an NRE")] +public class Issue2894 : TestContentPage +{ + Label label = null; + Label gestureLabel1 = null; + Label gestureLabel2 = null; + int i1 = 0; + int i2 = 0; + const string kGesture1 = "Sentence 1: "; + const string kGesture2 = "Sentence 2: "; + + const string kClickSentence1 = "I will fire when clicked. "; + const string kClickSentence2 = "I should also fire when clicked."; + + const string kClickSentenceAutomationId1 = "Spanning1"; + const string kClickSentenceAutomationId2 = "Spanning2"; + + const string kLabelAutomationId = "kLabelAutomationId"; + + GestureRecognizer CreateRecognizer1() => new TapGestureRecognizer() + { + Command = new Command(() => + { + i1++; + gestureLabel1.Text = $"{kGesture1}{i1}"; + }) + }; + + GestureRecognizer CreateRecognizer2() => new TapGestureRecognizer() + { + Command = new Command(() => + { + i2++; + gestureLabel2.Text = $"{kGesture2}{i2}"; + }) + }; + + void AddRemoveSpan(bool includeRecognizers = true) + { + if (label.FormattedText != null) + { + label.FormattedText = null; + return; + } + + FormattedString s = new FormattedString(); + + var span = new Span + { + Text = kClickSentence1, + FontAttributes = FontAttributes.Bold, + AutomationId = kClickSentenceAutomationId1 + }; + + var span2 = new Span + { + Text = kClickSentence2, + FontAttributes = FontAttributes.Bold, + AutomationId = kClickSentenceAutomationId2 + }; + + if (includeRecognizers) + span.GestureRecognizers.Add(CreateRecognizer1()); + + s.Spans.Add(span); + s.Spans.Add(span2); + + label.FormattedText = s; + + if (includeRecognizers) + span2.GestureRecognizers.Add(CreateRecognizer2()); + } + + + Label GetLabel() => + new Label() + { + HorizontalOptions = LayoutOptions.Center, + AutomationId = kLabelAutomationId + }; + + protected override void Init() + { + BindingContext = this; + + label = GetLabel(); + gestureLabel1 = new Label() { HorizontalOptions = LayoutOptions.Center }; + gestureLabel2 = new Label() { HorizontalOptions = LayoutOptions.Center }; + + gestureLabel1.Text = $"{kGesture1}{i1}"; + gestureLabel2.Text = $"{kGesture2}{i2}"; + + AddRemoveSpan(); + StackLayout stackLayout = null; + stackLayout = new StackLayout() + { + Children = + { + label, + gestureLabel1, + gestureLabel2, + new Label(){Text = "Each sentence above has a separate Gesture Recognizer. Click each button below once then test that each Gesture Recognizer fires separately. If the sentence wraps make sure to click on the wrapped text as well."}, + // test removing then adding span back + new Button() + { + Text = "Add and Remove Spans", + AutomationId = "TestSpan1", + Command = new Command(async () => + { + if(label.FormattedText != null) + AddRemoveSpan(); + + await Task.Delay(100); + AddRemoveSpan(); + }) + }, + // test removing and adding same span back + new Button() + { + Text = "Null FormattedText then set again", + AutomationId = "TestSpan2", + Command = new Command(async () => + { + if(label.FormattedText == null) + AddRemoveSpan(); + + var span = label.FormattedText; + await Task.Delay(100); + label.FormattedText = null; + await Task.Delay(100); + label.FormattedText = span; + }) + }, + new Button() + { + Text = "Remove Gestures then add again", + AutomationId = "TestSpan3", + Command = new Command(async () => + { + if(label.FormattedText == null) + AddRemoveSpan(); + + if(label.FormattedText.Spans[0].GestureRecognizers.Count > 0) + { + label.FormattedText.Spans[0].GestureRecognizers.Clear(); + label.FormattedText.Spans[1].GestureRecognizers.Clear(); + } + + await Task.Delay(100); + + label.FormattedText.Spans[0].GestureRecognizers.Add(CreateRecognizer1()); + label.FormattedText.Spans[1].GestureRecognizers.Add(CreateRecognizer2()); + }) + }, + new Button() + { + Text = "Add Gestures after rendering", + AutomationId = "TestSpan4", + Command = new Command(async () => + { + stackLayout.Children.Remove(label); + await Task.Delay(50); + label = GetLabel(); + stackLayout.Children.Insert(0, label); + await Task.Delay(50); + AddRemoveSpan(false); + await Task.Delay(50); + label.FormattedText.Spans[0].GestureRecognizers.Add(CreateRecognizer1()); + label.FormattedText.Spans[1].GestureRecognizers.Add(CreateRecognizer2()); + }) + }, + new Label() + { + Text = "This Button should remove all gestures" + }, + new Button() + { + Text = "Remove All Gestures", + AutomationId = "TestSpan5", + Command = new Command(() => + { + if(label.FormattedText == null) + return; + + label.FormattedText.Spans[0].GestureRecognizers.Clear(); + label.FormattedText.Spans[1].GestureRecognizers.Clear(); + }) + } + }, + Padding = 40 + }; + + Content = new ContentView() + { + Content = stackLayout + }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2923.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2923.cs new file mode 100644 index 000000000000..f0ee4da83208 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2923.cs @@ -0,0 +1,69 @@ +using System.Collections.ObjectModel; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2923, "First tab does not load until navigating", PlatformAffected.WinRT)] +public class Issue2923 : TestTabbedPage +{ + protected override void Init() + { + var tabOne = new ContentPage + { + Title = "Page One", + BackgroundColor = Colors.Blue, + }; + + var tabTwo = new ContentPage + { + Title = "Page Two", + BackgroundColor = Colors.Red, + Content = new Label + { + AutomationId = "SecondPageLabel", + Text = "Second Page" + } + }; + + var buttonResetTabbedPage = new Button + { + Text = "Reset", + AutomationId = "ResetButton", + Command = new Command(() => + { + + Children.Remove(tabOne); + Children.Remove(tabTwo); + + Children.Add(new ContentPage + { + Title = "Reset page", + BackgroundColor = Colors.Green, + Content = new Label + { + AutomationId = "ResetPageLabel", + Text = "I was reset" + } + }); + + }) + }; + + tabOne.Content = new StackLayout + { + Children = { + new Label { + AutomationId = "FirstPageLabel", + Text = "First Page" + }, + buttonResetTabbedPage + } + }; + + Children.Add(tabOne); + Children.Add(tabTwo); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2927.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2927.cs new file mode 100644 index 000000000000..d473280a1765 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2927.cs @@ -0,0 +1,61 @@ +using System; +using System.ComponentModel; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2927, "ListView item tapped not firing multiple times")] +public class Issue2927 : TestContentPage // or TestFlyoutPage, etc . +{ + [Preserve(AllMembers = true)] + public class Issue2927Cell : TextCell, INotifyPropertyChanged + { + int _numberOfTimesTapped; + string _cellId; + + public Issue2927Cell(string id) + { + _cellId = id; + NumberOfTimesTapped = 0; + } + + public int NumberOfTimesTapped + { + get { return _numberOfTimesTapped; } + set + { + _numberOfTimesTapped = value; + Text = _cellId + " " + _numberOfTimesTapped.ToString(); + } + } + } + + protected override void Init() + { + var cells = new[] { + new Issue2927Cell ("Cell1"), + new Issue2927Cell ("Cell2"), + new Issue2927Cell ("Cell3"), + }; + + BindingContext = cells; + var template = new DataTemplate(typeof(TextCell)); + template.SetBinding(TextCell.TextProperty, "Text"); + + var listView = new ListView + { + ItemTemplate = template, + ItemsSource = cells + }; + + listView.ItemTapped += (s, e) => + { + var obj = (Issue2927Cell)e.Item; + obj.NumberOfTimesTapped += 1; + }; + + Content = listView; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2948.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2948.cs new file mode 100644 index 000000000000..aee91218c8b1 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2948.cs @@ -0,0 +1,210 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2948, "FlyoutPage Detail is interactive even when Flyout is open when in Landscape")] +public class Issue2948 : TestFlyoutPage +{ + static FlyoutPage s_mdp; + + protected override void Init() + { + s_mdp = this; + var menuPage = new MenuPage(); + + menuPage.Menu.ItemSelected += (sender, e) => NavigateTo(e.SelectedItem as MenuItem); + + Flyout = menuPage; + Detail = new NavigationPage(new ContractsPage()); + } + + [Preserve(AllMembers = true)] + public class MenuListData : List + { + public MenuListData() + { + Add(new MenuItem() + { + Title = "Contracts", + IconSource = "bank.png", + TargetType = typeof(ContractsPage) + }); + + Add(new MenuItem() + { + Title = "Leads", + IconSource = "bank.png", + TargetType = typeof(ContractsPage) + }); + + Add(new MenuItem() + { + Title = "Accounts", + IconSource = "bank.png", + TargetType = typeof(ContractsPage) + }); + + Add(new MenuItem() + { + Title = "Opportunities", + IconSource = "bank.png", + TargetType = typeof(ContractsPage) + }); + } + } + + [Preserve(AllMembers = true)] + public class ContractsPage : ContentPage + { + public ContractsPage() + { + Title = "Contracts"; + IconImageSource = "bank.png"; + + var grid = new Grid(); + grid.ColumnDefinitions.Add(new ColumnDefinition()); + grid.ColumnDefinitions.Add(new ColumnDefinition()); + + var btn = new Button + { + HeightRequest = 300, + HorizontalOptions = LayoutOptions.End, + BackgroundColor = Colors.Pink, + AutomationId = "btnOnDetail" + }; + + btn.Clicked += (object sender, EventArgs e) => + { + DisplayAlert("Clicked", "I was clicked", "Ok"); + }; + + Grid.SetColumn(btn, 1); + + grid.Children.Add(btn); + + var showMasterButton = new Button + { + AutomationId = "ShowFlyoutBtn", + Text = "Show Flyout" + }; + showMasterButton.Clicked += (sender, e) => + { + s_mdp.IsPresented = true; + }; + + Content = new ScrollView + { + + Content = new StackLayout + { + Children = { + showMasterButton, + grid, + new BoxView { + HeightRequest = 100, + Color = Colors.Red, + }, + new BoxView { + HeightRequest = 200, + Color = Colors.Green, + }, + new BoxView { + HeightRequest = 300, + Color = Colors.Red, + }, + new BoxView { + HeightRequest = 400, + Color = Colors.Green, + }, + new BoxView { + HeightRequest = 500, + Color = Colors.Red, + } + } + }, + + }; + } + } + + [Preserve(AllMembers = true)] + public class MenuListView : ListView + { + public MenuListView() + { + List data = new MenuListData(); + + ItemsSource = data; +#pragma warning disable CS0618 // Type or member is obsolete + VerticalOptions = LayoutOptions.FillAndExpand; +#pragma warning restore CS0618 // Type or member is obsolete + BackgroundColor = Colors.Transparent; + + var cell = new DataTemplate(typeof(ImageCell)); + cell.SetBinding(TextCell.TextProperty, "Title"); + cell.SetBinding(ImageCell.ImageSourceProperty, "IconSource"); + + ItemTemplate = cell; + SelectedItem = data[0]; + } + } + + public class MenuPage : ContentPage + { + public ListView Menu { get; set; } + + public MenuPage() + { + Title = "Menu"; + BackgroundColor = Color.FromArgb("333333"); + + Menu = new MenuListView(); + + var menuLabel = new ContentView + { + Padding = new Thickness(10, 36, 0, 5), + Content = new Label + { + TextColor = Color.FromArgb("AAAAAA"), + Text = "MENU", + } + }; + +#pragma warning disable CS0618 // Type or member is obsolete + var layout = new StackLayout + { + Spacing = 0, + VerticalOptions = LayoutOptions.FillAndExpand + }; +#pragma warning restore CS0618 // Type or member is obsolete + layout.Children.Add(menuLabel); + layout.Children.Add(Menu); + + Content = layout; + } + } + + void NavigateTo(MenuItem menu) + { + var displayPage = (Page)Activator.CreateInstance(menu.TargetType); + + Detail = new NavigationPage(displayPage); + + } + + [Preserve(AllMembers = true)] + public class MenuItem + { + public string Title { get; set; } + + public string IconSource { get; set; } + + public Type TargetType { get; set; } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2953.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2953.cs new file mode 100644 index 000000000000..0b853df5b720 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2953.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.ObjectModel; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2953, "GroupHeaderCells disappear when item is removed from a group in ListView (iOS only) ")] +public class Issue2953 : TestContentPage +{ + protected override void Init() + { + var items = new ObservableCollection() { + new GroupedItems ("Header 1") { "1.1", "1.2", "1.3" }, + new GroupedItems ("Header 2") { "2.1", "2.2", "2.3" }, + new GroupedItems ("Header 3") { "3.1", "3.2", "3.3" }, + new GroupedItems ("Header 4") { "4.1", "4.2", "4.3" }, + }; + + var listview = new ListView + { + HasUnevenRows = true, + IsGroupingEnabled = true + }; + + listview.GroupHeaderTemplate = new DataTemplate + (typeof(HeaderCell)); + listview.ItemTemplate = new DataTemplate(typeof(ItemCell)); + listview.ItemsSource = items; + + var btnRemove = new Button() { Text = "Remove", AutomationId = "btnRemove" }; + btnRemove.Clicked += delegate + { + if (items[1].Count > 0) + { + items[1].RemoveAt(0); + } + }; + + Content = new StackLayout + { + Orientation = StackOrientation.Vertical, + Children = { listview, btnRemove } + }; + } + + [Preserve(AllMembers = true)] + internal class GroupedItems : ObservableCollection + { + public GroupedItems(string groupName) { GroupName = groupName; } + public string GroupName { get; private set; } + } + + [Preserve(AllMembers = true)] + internal class HeaderCell : ViewCell + { + public HeaderCell() + { + Height = 44; + var label = new Label { BackgroundColor = Colors.Pink }; + label.SetBinding(Label.TextProperty, "GroupName"); + View = label; + } + } + + [Preserve(AllMembers = true)] + internal class ItemCell : ViewCell + { + public ItemCell() + { + var label = new Label { BackgroundColor = Colors.Aqua }; + label.SetBinding(Label.TextProperty, "."); + View = label; + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2954.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2954.cs new file mode 100644 index 000000000000..8b881e3f2392 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2954.cs @@ -0,0 +1,43 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2954, "Cell becomes empty after adding a new one with context actions (TableView) ")] +public class Issue2954 : TestContentPage // or TestFlyoutPage, etc ... +{ + TableSection _dataSection; + TableView _tableView; + int _count = 0; + protected override void Init() + { + _dataSection = new TableSection { + new TextCell{ Text = "Cell1" }, + new TextCell{ Text = "Cell2", ContextActions = { new MenuItem{ Text = "Delete" } } }, + new TextCell{ Text = "Add new", Command = new Command (AddNew) } + }; + + _tableView = new TableView + { + Root = new TableRoot { + _dataSection + } + }; + + Content = _tableView; + } + + void AddNew(object parameters) + { + _count++; + _dataSection.Insert(0, new TextCell + { + Text = "Fresh cell " + _count + , + ContextActions = { new MenuItem { Text = "Delete" } } + }); + _tableView.Root = _tableView.Root; //HACK - force table reload + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2964.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2964.cs new file mode 100644 index 000000000000..05a9f428c201 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2964.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2964, "TabbedPage toolbar item crash")] +public class Issue2964 : TestFlyoutPage +{ + public class ModalPage : ContentPage + { + public ModalPage() + { + Content = new Button + { + AutomationId = "ModalPagePopButton", + Text = "Pop Me", + Command = new Command(async () => + { +#pragma warning disable CS0618 // Type or member is obsolete + MessagingCenter.Send(this, "update"); +#pragma warning restore CS0618 // Type or member is obsolete + await Navigation.PopModalAsync(); + }) + }; + } + } + + public class Page1 : ContentPage + { + public Page1() + { + Title = "Testpage 1"; + +#pragma warning disable CS0618 // Type or member is obsolete + MessagingCenter.Subscribe(this, "update", sender => + { + BlowUp(); + }); +#pragma warning restore CS0618 // Type or member is obsolete + + Content = new Button + { + AutomationId = "Page1PushModalButton", + Text = "press me", + Command = new Command(async () => await Navigation.PushModalAsync(new ModalPage())) + }; + } + + void BlowUp() + { + Content = new Label + { + AutomationId = "Page1Label", + Text = "Page1" + }; + } + } + + protected override void Init() + { + Title = "Test"; + + Flyout = new ContentPage + { + Title = "Flyout", + Content = new Button + { + AutomationId = "FlyoutButton", + Text = "Make a new page", + Command = new Command(() => + { + Detail = new Page1(); + IsPresented = false; + }) + } + }; + + Detail = new Page1(); + + IsPresented = true; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2976.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2976.cs new file mode 100644 index 000000000000..68f781438877 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2976.cs @@ -0,0 +1,451 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Devices; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2976, "Sample 'WorkingWithListviewNative' throw Exception on Xam.Android project.", PlatformAffected.Android)] +public class Issue2976 : TestTabbedPage +{ + protected override void Init() + { + + // built-in Xamarin.Forms controls + Children.Add(new XamarinFormsPage { Title = "DEMOA", IconImageSource = "bank.png" }); + + // custom renderer for the list, using a native built-in cell type + Children.Add(new NativeListPage { Title = "DEMOB", IconImageSource = "bank.png" }); + + // built in Xamarin.Forms list, but with a native cell custom-renderer + Children.Add(new XamarinFormsNativeCellPage { Title = "DEMOC", IconImageSource = "bank.png" }); + + // custom renderer for the list, using a native cell that has been custom-defined in native code + Children.Add(new NativeListViewPage2 { Title = "DEMOD", IconImageSource = "bank.png" }); + } +} + +/// +/// This page uses a custom renderer that wraps native list controls: +/// iOS : UITableView +/// Android : ListView (do not confuse with Xamarin.Forms ListView) +/// Windows Phone : ? +/// +/// It uses a built-in row/cell class provided by the native platform +/// and is therefore faster than building a custom ViewCell in Microsoft.Maui.Controls. +/// +[Preserve(AllMembers = true)] +public class NativeListPage : ContentPage +{ + public NativeListPage() + { + var tableItems = new List(); + for (var i = 0; i < 100; i++) + { + tableItems.Add(i + " row "); + } + + + var fasterListView = new NativeListView(); // CUSTOM RENDERER using a native control +#pragma warning disable CS0618 // Type or member is obsolete + fasterListView.VerticalOptions = LayoutOptions.FillAndExpand; // REQUIRED: To share a scrollable view with other views in a StackLayout, it should have a VerticalOptions of FillAndExpand. +#pragma warning restore CS0618 // Type or member is obsolete + fasterListView.Items = tableItems; + fasterListView.ItemSelected += async (sender, e) => + { + await Navigation.PushModalAsync(new DetailPage(e.SelectedItem)); + }; + + // The root page of your application + Content = new StackLayout + { + Padding = DeviceInfo.Platform == DevicePlatform.iOS ? new Thickness(0, 20, 0, 0) : new Thickness(0), + Children = { + new Label { + HorizontalTextAlignment = TextAlignment.Center, + Text = DeviceInfo.Platform == DevicePlatform.iOS ? "Custom renderer UITableView" : DeviceInfo.Platform == DevicePlatform.Android ? "Custom renderer ListView" : "Custom renderer todo" + }, + fasterListView + } + }; + } +} + +/// +/// Xamarin.Forms representation for a custom-renderer that uses +/// the native list control on each platform. +/// +public class NativeListView : View +{ + public static readonly BindableProperty ItemsProperty = + BindableProperty.Create("Items", typeof(IEnumerable), typeof(NativeListView), new List()); + + public IEnumerable Items + { + get { return (IEnumerable)GetValue(ItemsProperty); } + set { SetValue(ItemsProperty, value); } + } + + public event EventHandler ItemSelected; + + public void NotifyItemSelected(object item) + { + + if (ItemSelected != null) + ItemSelected(this, new SelectedItemChangedEventArgs(item, Items?.ToList().IndexOf($"{item}") ?? -1)); + } + + public NativeListView() + { + } +} + +/// +/// This page uses built-in Xamarin.Forms controls to display a fast-scrolling list. +/// +/// It uses the built-in TextCell class which does not require special 'layout' +/// and is therefore faster than building a custom ViewCell in Microsoft.Maui.Controls. +/// +[Preserve(AllMembers = true)] +public class XamarinFormsPage : ContentPage +{ + public XamarinFormsPage() + { + var tableItems = new List(); + for (var i = 0; i < 100; i++) + { + tableItems.Add(i + " row "); + } + + var listView = new ListView(); + listView.ItemsSource = tableItems; + listView.ItemTemplate = new DataTemplate(typeof(TextCell)); + listView.ItemTemplate.SetBinding(TextCell.TextProperty, "."); + + listView.ItemSelected += async (sender, e) => + { + if (e.SelectedItem == null) + return; + listView.SelectedItem = null; // deselect row + await Navigation.PushModalAsync(new DetailPage(e.SelectedItem)); + }; + + Content = new StackLayout + { + Padding = DeviceInfo.Platform == DevicePlatform.iOS ? new Thickness(5, 20, 5, 0) : new Thickness(5, 0), + Children = { + new Label { + HorizontalTextAlignment = TextAlignment.Center, + Text = "Xamarin.Forms built-in ListView" + }, + listView + } + }; + } +} + +/// +/// This page uses built-in Xamarin.Forms controls to display a fast-scrolling list. +/// +/// It uses the built-in TextCell class which does not require special 'layout' +/// and is therefore faster than building a custom ViewCell in Microsoft.Maui.Controls. +/// +[Preserve(AllMembers = true)] +public class XamarinFormsNativeCellPage : ContentPage +{ + public XamarinFormsNativeCellPage() + { + var listView = new ListView(); + listView.ItemsSource = DataSource.GetList(); + listView.ItemTemplate = new DataTemplate(typeof(NativeCell)); + + listView.ItemTemplate.SetBinding(NativeCell.NameProperty, "Name"); + listView.ItemTemplate.SetBinding(NativeCell.CategoryProperty, "Category"); + listView.ItemTemplate.SetBinding(NativeCell.ImageFilenameProperty, "ImageFilename"); + + listView.ItemSelected += async (sender, e) => + { + if (e.SelectedItem == null) + return; + listView.SelectedItem = null; // deselect row + + await Navigation.PushModalAsync(new DetailPage(e.SelectedItem)); + }; + + Content = new StackLayout + { + Padding = DeviceInfo.Platform == DevicePlatform.iOS ? new Thickness(0, 20, 0, 0) : new Thickness(0), + Children = { + new Label { + HorizontalTextAlignment = TextAlignment.Center, + Text = "Xamarin.Forms native Cell" + }, + listView + } + }; + } +} + +[Preserve(AllMembers = true)] +public class NativeCell : ViewCell +{ + public NativeCell() + { + //View = new ContentView (); + } + + public static readonly BindableProperty NameProperty = + BindableProperty.Create("Name", typeof(string), typeof(NativeCell), ""); + public string Name + { + get { return (string)GetValue(NameProperty); } + set { SetValue(NameProperty, value); } + } + + + public static readonly BindableProperty CategoryProperty = + BindableProperty.Create("Category", typeof(string), typeof(NativeCell), ""); + public string Category + { + get { return (string)GetValue(CategoryProperty); } + set { SetValue(CategoryProperty, value); } + } + + + public static readonly BindableProperty ImageFilenameProperty = + BindableProperty.Create("ImageFilename", typeof(string), typeof(NativeCell), ""); + public string ImageFilename + { + get { return (string)GetValue(ImageFilenameProperty); } + set { SetValue(ImageFilenameProperty, value); } + } + +} + +public class DetailPage : ContentPage +{ + public DetailPage(object detail) + { + var l = new Label { Text = "Xamarin.Forms Detail Page" }; + + var t = new Label(); + + if (detail is string) + { + t.Text = (string)detail; + } + else if (detail is DataSource) + { + t.Text = ((DataSource)detail).Name; + } + + var b = new Button { Text = "Dismiss" }; + b.Clicked += (sender, e) => Navigation.PopModalAsync(); + + Content = new StackLayout + { + Padding = DeviceInfo.Platform == DevicePlatform.iOS ? new Thickness(0, 20, 0, 0) : new Thickness(0), + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + Children = { + l, + t, + b + } + }; + } +} + +/// +/// This page uses a custom renderer that wraps native list controls: +/// iOS : UITableView +/// Android : ListView (do not confuse with Xamarin.Forms ListView) +/// Windows Phone : ? +/// +/// It uses a CUSTOM row/cell class that is defined natively which +/// is still faster than a Xamarin.Forms-defined ViewCell subclass. +/// +[Preserve(AllMembers = true)] +public class NativeListViewPage2 : ContentPage +{ + public NativeListViewPage2() + { + var nativeListView2 = new NativeListView2(); // CUSTOM RENDERER using a native control + +#pragma warning disable CS0618 // Type or member is obsolete + nativeListView2.VerticalOptions = LayoutOptions.FillAndExpand; // REQUIRED: To share a scrollable view with other views in a StackLayout, it should have a VerticalOptions of FillAndExpand. +#pragma warning restore CS0618 // Type or member is obsolete + + nativeListView2.Items = DataSource.GetList(); + + nativeListView2.ItemSelected += async (sender, e) => + { + //await Navigation.PushModalAsync (new DetailPage(e.SelectedItem)); + await DisplayAlert("clicked", "one of the rows was clicked", "ok"); + }; + + // The root page of your application + Content = new StackLayout + { + Padding = DeviceInfo.Platform == DevicePlatform.iOS ? new Thickness(0, 20, 0, 0) : new Thickness(0), + Children = { + new Label { + HorizontalTextAlignment = TextAlignment.Center, + Text = DeviceInfo.Platform == DevicePlatform.iOS ? "Custom UITableView+UICell" : DeviceInfo.Platform == DevicePlatform.Android ? "Custom ListView+Cell" : "Custom renderer todo" + }, + nativeListView2 + } + }; + } +} + +/// +/// Xamarin.Forms representation for a custom-renderer that uses +/// the native list control on each platform. +/// +public class NativeListView2 : View +{ + public static readonly BindableProperty ItemsProperty = + BindableProperty.Create("Items", typeof(IEnumerable), typeof(NativeListView2), new List()); + + public IEnumerable Items + { + get { return (IEnumerable)GetValue(ItemsProperty); } + set { SetValue(ItemsProperty, value); } + } + + public event EventHandler ItemSelected; + + public void NotifyItemSelected(object item) + { + + if (ItemSelected != null) + ItemSelected(this, new SelectedItemChangedEventArgs(item, Items?.ToList().IndexOf((DataSource)item) ?? -1)); + } + + public NativeListView2() + { + } +} + +[Preserve(AllMembers = true)] +public class DataSource +{ + public string Name { get; set; } + public string Category { get; set; } + public string ImageFilename { get; set; } + + public DataSource() + { + } + + public DataSource(string name, string category, string imageFilename) + { + Name = name; + Category = category; + ImageFilename = imageFilename; + } + + public static List GetList() + { + var l = new List(); + + + l.Add(new DataSource("Asparagus", "Vegetables", "Vegetables")); + l.Add(new DataSource("Avocados", "Vegetables", "Vegetables")); + l.Add(new DataSource("Beetroots", "Vegetables", "Vegetables")); + l.Add(new DataSource("Capsicum", "Vegetables", "Vegetables")); + l.Add(new DataSource("Broccoli", "Vegetables", "Vegetables")); + l.Add(new DataSource("Brussel sprouts", "Vegetables", "Vegetables")); + l.Add(new DataSource("Cabbage", "Vegetables", "Vegetables")); + l.Add(new DataSource("Carrots", "Vegetables", "Vegetables")); + l.Add(new DataSource("Cauliflower", "Vegetables", "Vegetables")); + l.Add(new DataSource("Celery", "Vegetables", "Vegetables")); + l.Add(new DataSource("Corn", "Vegetables", "Vegetables")); + l.Add(new DataSource("Cucumbers", "Vegetables", "Vegetables")); + l.Add(new DataSource("Eggplant", "Vegetables", "Vegetables")); + l.Add(new DataSource("Fennel", "Vegetables", "Vegetables")); + l.Add(new DataSource("Garlic", "Vegetables", "Vegetables")); + l.Add(new DataSource("Beans", "Vegetables", "Vegetables")); + l.Add(new DataSource("Peas", "Vegetables", "Vegetables")); + l.Add(new DataSource("Kale", "Vegetables", "Vegetables")); + l.Add(new DataSource("Leeks", "Vegetables", "Vegetables")); + l.Add(new DataSource("Mushrooms", "Vegetables", "Vegetables")); + l.Add(new DataSource("Olives", "Vegetables", "Vegetables")); + l.Add(new DataSource("Onions", "Vegetables", "Vegetables")); + l.Add(new DataSource("Potatoes", "Vegetables", "Vegetables")); + l.Add(new DataSource("Lettuce", "Vegetables", "Vegetables")); + l.Add(new DataSource("Spinach", "Vegetables", "Vegetables")); + l.Add(new DataSource("Squash", "Vegetables", "Vegetables")); + l.Add(new DataSource("Sweet potatoes", "Vegetables", "Vegetables")); + l.Add(new DataSource("Tomatoes", "Vegetables", "Vegetables")); + l.Add(new DataSource("Turnips", "Vegetables", "Vegetables")); + l.Add(new DataSource("Apples", "Fruits", "Fruits")); + l.Add(new DataSource("Apricots", "Fruits", "Fruits")); + l.Add(new DataSource("Bananas", "Fruits", "Fruits")); + l.Add(new DataSource("Blueberries", "Fruits", "Fruits")); + l.Add(new DataSource("Rockmelon", "Fruits", "Fruits")); + l.Add(new DataSource("Figs", "Fruits", "Fruits")); + l.Add(new DataSource("Grapefruit", "Fruits", "Fruits")); + l.Add(new DataSource("Grapes", "Fruits", "Fruits")); + l.Add(new DataSource("Honeydew Melon", "Fruits", "Fruits")); + l.Add(new DataSource("Kiwifruit", "Fruits", "Fruits")); + l.Add(new DataSource("Lemons", "Fruits", "Fruits")); + l.Add(new DataSource("Oranges", "Fruits", "Fruits")); + l.Add(new DataSource("Pears", "Fruits", "Fruits")); + l.Add(new DataSource("Pineapple", "Fruits", "Fruits")); + l.Add(new DataSource("Plums", "Fruits", "Fruits")); + l.Add(new DataSource("Raspberries", "Fruits", "Fruits")); + l.Add(new DataSource("Strawberries", "Fruits", "Fruits")); + l.Add(new DataSource("Watermelon", "Fruits", "Fruits")); + l.Add(new DataSource("Balmain Bugs", "Seafood", "")); + l.Add(new DataSource("Calamari", "Seafood", "")); + l.Add(new DataSource("Cod", "Seafood", "")); + l.Add(new DataSource("Prawns", "Seafood", "")); + l.Add(new DataSource("Lobster", "Seafood", "")); + l.Add(new DataSource("Salmon", "Seafood", "")); + l.Add(new DataSource("Scallops", "Seafood", "")); + l.Add(new DataSource("Shrimp", "Seafood", "")); + l.Add(new DataSource("Tuna", "Seafood", "")); + l.Add(new DataSource("Almonds", "Nuts", "")); + l.Add(new DataSource("Cashews", "Nuts", "")); + l.Add(new DataSource("Peanuts", "Nuts", "")); + l.Add(new DataSource("Walnuts", "Nuts", "")); + l.Add(new DataSource("Black beans", "Beans & Legumes", "Legumes")); + l.Add(new DataSource("Dried peas", "Beans & Legumes", "Legumes")); + l.Add(new DataSource("Kidney beans", "Beans & Legumes", "Legumes")); + l.Add(new DataSource("Lentils", "Beans & Legumes", "Legumes")); + l.Add(new DataSource("Lima beans", "Beans & Legumes", "Legumes")); + l.Add(new DataSource("Miso", "Beans & Legumes", "Legumes")); + l.Add(new DataSource("Soybeans", "Beans & Legumes", "Legumes")); + l.Add(new DataSource("Beef", "Meat", "")); + l.Add(new DataSource("Buffalo", "Meat", "")); + l.Add(new DataSource("Chicken", "Meat", "")); + l.Add(new DataSource("Lamb", "Meat", "")); + l.Add(new DataSource("Cheese", "Dairy", "")); + l.Add(new DataSource("Milk", "Dairy", "")); + l.Add(new DataSource("Eggs", "Dairy", "")); + l.Add(new DataSource("Basil", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Black pepper", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Chili pepper, dried", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Cinnamon", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Cloves", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Cumin", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Dill", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Ginger", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Mustard", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Oregano", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Parsley", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Peppermint", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Rosemary", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Sage", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Thyme", "Herbs & Spices", "FlowerBuds")); + l.Add(new DataSource("Turmeric", "Herbs & Spices", "FlowerBuds")); + + + return l; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2981.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2981.cs new file mode 100644 index 000000000000..487c32e5cfbc --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2981.cs @@ -0,0 +1,18 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2981, "Long Press on ListView causes crash")] +public class Issue2981 : TestContentPage +{ + protected override void Init() + { + var listView = new ListView(); + + listView.ItemsSource = new[] { "Cell1", "Cell2" }; + Content = listView; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue2993.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue2993.cs new file mode 100644 index 000000000000..8b26ca7e5dc7 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue2993.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Controls.PlatformConfiguration; +using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific; +using Microsoft.Maui.Graphics; +using Button = Microsoft.Maui.Controls.Button; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 2993, "[Android] Bottom Tab Bar with a navigation page is hiding content", PlatformAffected.Android)] +public class Issue2993 : TestTabbedPage +{ + protected override void Init() + { + On().SetToolbarPlacement(Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific.ToolbarPlacement.Bottom); + BarBackgroundColor = Colors.Transparent; + + Func createPage = () => + { + Grid grid = new Grid(); + grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Star }); + grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); + grid.Children.Add(new Label() { Text = "Top Text", BackgroundColor = Colors.Purple }); + var bottomLabel = new Label() { Text = "Bottom Text" }; + Grid.SetRow(bottomLabel, 1); + grid.Children.Add(bottomLabel); + + var contentPage = new ContentPage() + { + Content = grid, + IconImageSource = "coffee.png" + }; + + return contentPage; + }; + + Children.Add(new NavigationPage(createPage())); + Children.Add((createPage())); + Children.Add(new ContentPage() + { + IconImageSource = "calculator.png", + Content = new Button() + { + Text = "Click Me", + Command = new Command(() => + { + Children.Add(new NavigationPage(createPage())); + Children.RemoveAt(0); + }) + } + }); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3008.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3008.cs new file mode 100644 index 000000000000..dbe7fd2668fb --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3008.cs @@ -0,0 +1,172 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3008, "Setting ListView.ItemSource to null doesn't cause it clear out its contents", PlatformAffected.UWP)] + +public class Issue3008 : TestContentPage +{ + ListView _listView; + ListView _listViewIsGrouped; + const string success1 = "InitialLoad: you should see a grouped and not grouped list view"; + const string successEmpty1 = "Source is set to null: you should see nothing"; + const string success2 = "Reload1: you should see a grouped and not grouped list view"; + const string successEmpty2 = "If you see nothing now test has passed"; + const string successEmpty3 = "List loaded and ItemSource not set: you should see nothing"; + + + [Preserve(AllMembers = true)] + class MyHeaderViewCell : ViewCell + { + public MyHeaderViewCell() + { + Height = 25; + var label = new Label { VerticalOptions = LayoutOptions.Center }; + label.SetBinding(Label.TextProperty, nameof(GroupedItem.Name)); + View = label; + } + } + + [Preserve(AllMembers = true)] + class GroupedItem : List + { + public GroupedItem() + { + AddRange(Enumerable.Range(0, 3).Select(i => new Item())); + } + public string Name { get; set; } + } + + + [Preserve(AllMembers = true)] + class Item + { + + } + + void LoadData() + { + _listViewIsGrouped.ItemsSource = new ObservableCollection(Enumerable.Range(0, 3).Select(x => new GroupedItem() { Name = $"Group {x}" })); + _listView.ItemsSource = new ObservableCollection(Enumerable.Range(0, 13).Select(x => new Item())); + + } + + void ReloadListViews() + { + StackLayout content = Content as StackLayout; + + if (_listView != null) + { + content.Children.Remove(_listView); + content.Children.Remove(_listViewIsGrouped); + } + _listView = new ListView + { + ItemTemplate = new DataTemplate(() => + { + Label nameLabel = new Label() { Text = "Not Grouped Item" }; + var cell = new ViewCell + { + View = nameLabel, + }; + return cell; + }), + }; + _listViewIsGrouped = new ListView + { + IsGroupingEnabled = true, + GroupHeaderTemplate = new DataTemplate(typeof(MyHeaderViewCell)), + ItemTemplate = new DataTemplate(() => + { + Label nameLabel = new Label() { Text = "Grouped Item" }; + var cell = new ViewCell + { + View = nameLabel, + }; + return cell; + }), + }; + + content.Children.Add(_listView); + content.Children.Add(_listViewIsGrouped); + } + + protected override void Init() + { + Label label = new Label(); + + int clickCount = 0; + Content = new StackLayout + { + Children = + { + label, + new Button() + { + Text = "Click Until Success", + Command = new Command(() => + { + if(clickCount == 0) + { + LoadData(); + label.Text = success1; + } + else if(clickCount == 1) + { + ReloadListViews(); + LoadData(); + label.Text = success1; + } + else if(clickCount <= 3) + { + if(_listViewIsGrouped.ItemsSource != null) + { + _listViewIsGrouped.ItemsSource = null; + _listView.ItemsSource = null; + label.Text = successEmpty1; + } + else + { + LoadData(); + label.Text = success2; + } + } + else if(clickCount <= 5) + { + if(_listViewIsGrouped.ItemsSource != null) + { + ReloadListViews(); + label.Text = successEmpty3; + } + else + { + LoadData(); + label.Text = success2; + } + } + else + { + if(_listViewIsGrouped.ItemsSource != null) + { + _listViewIsGrouped.ItemsSource = new List(); + _listView.ItemsSource = new List(); + label.Text = successEmpty2; + } + } + + clickCount++; + }) + } + }, + }; + + ReloadListViews(); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3012.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3012.cs new file mode 100644 index 000000000000..b159e3c3f58e --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3012.cs @@ -0,0 +1,80 @@ +using System; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3012, "[macOS] Entry focus / unfocus behavior", PlatformAffected.macOS)] +public class Issue3012 : TestContentPage +{ + Label _focusedCountLabel = new Label + { + Text = "Focused count: 0", + AutomationId = "FocusedCountLabel" + }; + int _focusedCount; + int FocusedCount + { + get { return _focusedCount; } + set + { + _focusedCount = value; + _focusedCountLabel.Text = $"Focused count: {value}"; + } + } + + Label _unfocusedCountLabel = new Label + { + Text = "Unfocused count: 0", + AutomationId = "UnfocusedCountLabel" + }; + int _unfocusedCount; + int UnfocusedCount + { + get { return _unfocusedCount; } + set + { + _unfocusedCount = value; + _unfocusedCountLabel.Text = $"Unfocused count: {value}"; + } + } + + protected override void Init() + { + var entry = new Entry + { + AutomationId = "FocusTargetEntry" + }; + entry.Focused += (sender, e) => + { + FocusedCount++; + }; + entry.Unfocused += (sender, e) => + { + UnfocusedCount++; + }; + + var dumbyEntry = new Entry() + { + Placeholder = "I'm just here as another focus target", + AutomationId = "DumbyEntry" + }; + + var divider = new BoxView + { + HeightRequest = 1, + BackgroundColor = Colors.Black + }; + + StackLayout stackLayout = new StackLayout(); + stackLayout.Children.Add(dumbyEntry); + stackLayout.Children.Add(divider); + stackLayout.Children.Add(entry); + stackLayout.Children.Add(_focusedCountLabel); + stackLayout.Children.Add(_unfocusedCountLabel); + + Content = stackLayout; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3019.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3019.cs new file mode 100644 index 000000000000..c5cee1ea6acd --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3019.cs @@ -0,0 +1,135 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3019, "Grouped ListView Header empty for adding items", PlatformAffected.UWP)] + +public class Issue3019 : TestContentPage +{ + ListView _listViewIsGrouped; + + + [Preserve(AllMembers = true)] + class MyHeaderViewCell : ViewCell + { + public MyHeaderViewCell() + { + Height = 25; + var label = new Label { VerticalOptions = LayoutOptions.Center }; + label.SetBinding(Label.TextProperty, nameof(GroupedItem.Name)); + View = new StackLayout() + { + Children = + { + label + } + }; + } + } + + [Preserve(AllMembers = true)] + class Item + { + static int counter = 0; + public Item() + { + Text = $"Grouped Item: {counter++}"; + } + + public string Text { get; } + + } + + [Preserve(AllMembers = true)] + class GroupedItem : List + { + public GroupedItem() + { + AddRange(Enumerable.Range(0, 1).Select(i => new Item())); + } + + public string Name { get; set; } + } + + void LoadData() + { + _listViewIsGrouped.ItemsSource = new ObservableCollection(Enumerable.Range(0, 1).Select(x => new GroupedItem() { Name = $"Group {x}" })); + } + + void AddData() + { + var list = _listViewIsGrouped.ItemsSource as IList; + list.Add(new GroupedItem() { Name = $"Group {list.Count}" }); + } + + void ReloadListViews() + { + StackLayout content = Content as StackLayout; + + if (_listViewIsGrouped != null) + { + content.Children.Remove(_listViewIsGrouped); + } + + _listViewIsGrouped = new ListView + { + IsGroupingEnabled = true, + GroupHeaderTemplate = new DataTemplate(typeof(MyHeaderViewCell)), + ItemTemplate = new DataTemplate(() => + { + Label nameLabel = new Label(); + nameLabel.SetBinding(Label.TextProperty, "Text"); + var cell = new ViewCell + { + View = nameLabel, + }; + return cell; + }), + ItemsSource = new ObservableCollection() + }; + + content.Children.Add(_listViewIsGrouped); + } + + protected override void OnAppearing() + { + base.OnAppearing(); + AddData(); + } + + protected override void Init() + { + Label label = new Label() { Text = "If you see two group headers and can click on each row without crashing test has passed" }; + + Content = new StackLayout + { + Children = + { + label, + new Button() + { + Text = "Click to add more rows", + Command = new Command(() => + { + AddData(); + }) + } + }, + }; + + ReloadListViews(); + LoadData(); + + _listViewIsGrouped.ItemSelected += (sender, args) => + { + label.Text = (args.SelectedItem as Item).Text + " Clicked"; + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3053.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3053.cs new file mode 100644 index 000000000000..e9fd2f1304ae --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3053.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3053, "Moving items around on an Observable Collection causes the last item to disappear", PlatformAffected.UWP)] + +public class Issue3053 : TestContentPage +{ + const string _instructions = "Click me once. Item 2 should remain on bottom"; + + [Preserve(AllMembers = true)] + public class Item + { + public string Name { get; set; } + } + + protected override void Init() + { + var listView = new ListView + { + ItemsSource = new ObservableCollection(Enumerable.Range(0, 3).Select(x => new Item() { Name = $"Item {x}" })), + ItemTemplate = new DataTemplate(() => + { + Label nameLabel = new Label(); + nameLabel.SetBinding(Label.TextProperty, new Binding("Name")); + var cell = new ViewCell + { + View = new Frame() + { + Content = nameLabel + }, + }; + return cell; + }) + }; + Content = new StackLayout + { + Children = + { + new Button() + { + Text = _instructions, + Command = new Command(() => + { + var collection = listView.ItemsSource as ObservableCollection; + collection.Add(new Item(){ Name = Guid.NewGuid().ToString() }); + collection.Move(3,1); + }) + }, + listView + } + }; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3139.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3139.cs new file mode 100644 index 000000000000..7baf866b9482 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3139.cs @@ -0,0 +1,39 @@ +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3139, "DisplayActionSheet is hiding behind Dialogs", PlatformAffected.UWP)] +public class Issue3139 : TestContentPage +{ + protected override async void Init() + { + var statusLabel = new Label() + { + FontSize = 40, + TextColor = Colors.White + }; + Content = new StackLayout() + { + Children = { + statusLabel, + new Label { + Text = "Pop-ups should appear on top of the dialog. And it's got any button pressed.", + TextColor = Colors.Yellow + } + } + }; + + var alertTask = DisplayAlert("AlertDialog", "Close me", "Close"); + await Task.Delay(200); + var result1 = await DisplayActionSheet("ActionSheet", "Also Yes", "Click Yes", "Yes", "Yes Yes") ?? string.Empty; + var result2 = await Application.Current.MainPage.DisplayActionSheet("Main page ActionSheet", "Again Yes", "Click Yes", "Yes", "Yes Yes") ?? string.Empty; + var testPassed = result1.Contains("Yes", StringComparison.OrdinalIgnoreCase) && result2.Contains("Yes", StringComparison.OrdinalIgnoreCase) && !alertTask.IsCompleted; + statusLabel.Text = "Test " + (testPassed ? "passed" : "failed"); + BackgroundColor = !testPassed ? Colors.DarkRed : Colors.DarkGreen; + await alertTask; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3276.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3276.cs new file mode 100644 index 000000000000..7dad35a9d60f --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3276.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3276, "Crashing Unknown cell parent type on ContextAction Bindings")] +public class Issue3276 : TestTabbedPage +{ + protected override void Init() + { + var listview = new ListView(); + listview.ItemTemplate = new DataTemplate(typeof(CaCell)); + + listview.SetBinding(ListView.ItemsSourceProperty, new Binding("SearchResults")); + + var page = new ContentPage { Title = "First", Content = listview, BindingContext = new VM() }; + + page.Appearing += (object sender, EventArgs e) => (page.BindingContext as VM).Load(); + + Children.Add(page); + Children.Add(new ContentPage { Title = "Second" }); + } + + [Preserve(AllMembers = true)] + public class VM : ViewModel + { + public void Load() + { + var list = new List(); + for (int i = 0; i < 20; i++) + { + list.Add("second " + i.ToString()); + } + SearchResults = new ObservableCollection(list); + } + + ObservableCollection _list = null; + + public ObservableCollection SearchResults + { + get { return _list; } + + set + { + _list = value; + OnPropertyChanged(); + } + } + + } + + [Preserve(AllMembers = true)] + public class CaCell : ViewCell + { + public CaCell() + { + var label = new Label(); + label.SetBinding(Label.TextProperty, new Binding(".")); + var menu = new MenuItem { Text = "Delete", IsDestructive = true }; + menu.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); + var menu1 = new MenuItem { Text = "Settings" }; + menu1.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); + ContextActions.Add(menu); + ContextActions.Add(menu1); + + var stack = new StackLayout(); + stack.Children.Add(label); + View = stack; + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3292.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3292.cs new file mode 100644 index 000000000000..bfa6e070e8b1 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3292.cs @@ -0,0 +1,75 @@ +using System; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3292, "TableSection.Title property binding fails in XAML")] +public class Issue3292 : TestContentPage +{ + protected override void Init() + { + var vm = new SomePageViewModel(); + BindingContext = vm; + + var tableview = new TableView(); + var section = new TableSection(); + section.SetBinding(TableSectionBase.TitleProperty, new Binding("SectionTitle")); + var root = new TableRoot(); + root.Add(section); + tableview.Root = root; + + Content = tableview; + + vm.Init(); + } + + [Preserve(AllMembers = true)] + public class SomePageViewModel : INotifyPropertyChanged + { + string _sectionTitle; + + public SomePageViewModel() + { + SectionTitle = "Hello World"; + } + + public void Init() + { + Task.Delay(1000).ContinueWith(t => + { +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0612 // Type or member is obsolete + Device.BeginInvokeOnMainThread(() => + { + SectionTitle = "Hello World Changed"; + }); +#pragma warning restore CS0612 // Type or member is obsolete +#pragma warning restore CS0618 // Type or member is obsolete + }); + } + + public string SectionTitle + { + get { return _sectionTitle; } + set + { + _sectionTitle = value; + OnPropertyChanged(); + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + var handler = PropertyChanged; + if (handler != null) + handler(this, new PropertyChangedEventArgs(propertyName)); + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3318.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3318.cs new file mode 100644 index 000000000000..aed3d25940d7 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3318.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3318, "[MAC] ScrollTo method is not working in Xamarin.Forms for mac platform", PlatformAffected.macOS)] + +public class Issue3318 : TestContentPage +{ + protected override void Init() + { + var stackLayout = new StackLayout(); + + var list = Enumerable.Range(0, 40).Select(c => $"Item {c}").ToArray(); + var listview = new ListView { ItemsSource = list }; + + var swShouldAnimate = new Switch(); + var lblShouldAnimate = new Label { Text = "Should Animate?" }; + + var btnMakeVisible = new Button { Text = "Make Visible" }; + btnMakeVisible.Clicked += (s, e) => + { + listview.ScrollTo(list[19], ScrollToPosition.MakeVisible, swShouldAnimate.IsToggled); + }; + + var btnCenter = new Button { Text = "Center" }; + btnCenter.Clicked += (s, e) => + { + listview.ScrollTo(list[19], ScrollToPosition.Center, swShouldAnimate.IsToggled); + }; + + var btnStart = new Button { Text = "Start" }; + btnStart.Clicked += (s, e) => + { + listview.ScrollTo(list[19], ScrollToPosition.Start, swShouldAnimate.IsToggled); + }; + + var btnEnd = new Button { Text = "End" }; + btnEnd.Clicked += (s, e) => + { + listview.ScrollTo(list[19], ScrollToPosition.End, swShouldAnimate.IsToggled); + }; + + stackLayout.Children.Add(btnMakeVisible); + stackLayout.Children.Add(btnCenter); + stackLayout.Children.Add(btnStart); + stackLayout.Children.Add(btnEnd); + + var shouldAnimateContainer = new StackLayout { Orientation = StackOrientation.Horizontal }; + shouldAnimateContainer.Children.Add(swShouldAnimate); + shouldAnimateContainer.Children.Add(lblShouldAnimate); + + stackLayout.Children.Add(shouldAnimateContainer); + stackLayout.Children.Add(listview); + + Content = stackLayout; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3475.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3475.cs new file mode 100644 index 000000000000..9324a82138e3 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3475.cs @@ -0,0 +1,115 @@ +using System; +using System.Diagnostics; +using System.Linq; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3475, "[iOS] LayoutCompression Performance Issues", PlatformAffected.iOS)] +public class Issue3475 : TestContentPage +{ + string _withoutCompressionBtnId = "button1"; + string _withCompressionBtnId = "button2"; + string _titleLabelId = "Label1"; + + public static string BackButtonId = "back"; + public static int ItemsCount = 150; + public static string ElapsedLabelId = "elapsed"; + public static string DoneLabelId = "done"; + + protected override void Init() + { + var withoutCompressionBtn = new Button + { + Text = "Without Layout Compression", + Command = new Command(async () => await Navigation.PushAsync(new CompressionPage())), + AutomationId = _withoutCompressionBtnId + + }; + + var withCompressionBtn = new Button + { + Text = "With Layout Compression", + Command = new Command(async () => await Navigation.PushAsync(new CompressionPage(true))), + AutomationId = _withCompressionBtnId + }; + + Content = new StackLayout + { + Padding = 10, + Children = + { + new Label + { + Text = "Tap buttons to test LayoutCompression Performance in iOS. It should be faster (or at least equal) with LayoutCompression enabled", + AutomationId = _titleLabelId + }, + withoutCompressionBtn, + withCompressionBtn + } + }; + } + + public int GetMs(string text) + { + text = text.Replace($"Showing {ItemsCount} items took: ", "", StringComparison.OrdinalIgnoreCase).Replace(" ms", "", StringComparison.OrdinalIgnoreCase); + return int.TryParse(text, out int elapsed) ? elapsed : 0; + } +} + +public class CompressionPage : ContentPage +{ + readonly Stopwatch _sw = new Stopwatch(); + readonly Label _summaryLabel; + readonly StackLayout _scrollStack; + + public CompressionPage(bool shouldUseLayoutCompression = false) + { + _summaryLabel = new Label { HorizontalOptions = LayoutOptions.Center, BackgroundColor = Colors.Silver, AutomationId = Issue3475.ElapsedLabelId }; + var backButton = new Button { AutomationId = Issue3475.BackButtonId, Text = "Back", Command = new Command(() => Navigation.PopAsync()) }; + _scrollStack = new StackLayout(); + + var scrollView = new ScrollView + { + Content = _scrollStack + }; + + var mainStack = new StackLayout + { + Children = + { + _summaryLabel, + scrollView, + backButton + } + }; + + for (int i = 0; i < Issue3475.ItemsCount; i++) + { + var childLayout = new StackLayout(); + + if (shouldUseLayoutCompression) + { + Microsoft.Maui.Controls.CompressedLayout.SetIsHeadless(childLayout, true); + } + + var label = new Label { Text = $"Item {i}" }; + childLayout.Children.Add(label); + _scrollStack.Children.Add(childLayout); + } + + _sw.Start(); + Content = mainStack; + } + + protected override void OnAppearing() + { + base.OnAppearing(); + _sw.Stop(); + _summaryLabel.Text = $"Showing {Issue3475.ItemsCount} items took: {_sw.ElapsedMilliseconds} ms"; + _scrollStack.Children.Insert(0, new Label { Text = "Done", HorizontalOptions = LayoutOptions.Center, AutomationId = Issue3475.DoneLabelId }); + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3509.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3509.cs new file mode 100644 index 000000000000..78916fae4857 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3509.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3509, "[iOS] NavigationPage.Popped called twice when Navigation.PopAsync is called", PlatformAffected.iOS)] + +public class Issue3509 : TestNavigationPage +{ + const string _popPage = "Pop Page"; + protected override void Init() + { + int popCount = 0; + Label label = new Label(); + + PushAsync(new ContentPage() + { + Content = new StackLayout() + { + Children = + { + new Label(){ Text = "If the number below is not a one test has failed"}, + label, + new Button() + { + Text = "Push a Page", + Command = new Command(() => + { + PushAsync(new TestPage()); + }) + } + } + } + }); + + PushAsync(new TestPage()); + Popped += (s, e) => + { + popCount++; + label.Text = $"{popCount}"; + }; + } + + [Preserve(AllMembers = true)] + public class TestPage : ContentPage + { + bool _popped = false; + + public TestPage() + { + Title = "Test page"; + var content = new StackLayout(); + content.Children.Add(new Button + { + Text = _popPage, + Command = new Command(() => + { + Navigation.PopAsync(false); + }), + }); + + Content = content; + } + + internal void Popped() + { + if (_popped) + throw new Exception("Already popped"); + + _popped = true; + } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3524.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3524.cs new file mode 100644 index 000000000000..cabd90c85bee --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3524.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3524, "ICommand binding from a TapGestureRecognizer on a Span doesn't work")] + +public class Issue3524 : TestContentPage +{ + const string kText = "Click Me To Increment"; + + public Command TapCommand { get; set; } + public String Text { get; set; } = kText; + + protected override void Init() + { + int i = 0; + + FormattedString formattedString = new FormattedString(); + var span = new Span() { AutomationId = kText }; + span.Text = kText; + var tapGesture = new TapGestureRecognizer(); + tapGesture.SetBinding(TapGestureRecognizer.CommandProperty, "TapCommand"); + span.GestureRecognizers.Add(tapGesture); + formattedString.Spans.Add(span); + BindingContext = this; + var label = new Label() + { + AutomationId = kText, + HorizontalOptions = LayoutOptions.Center + }; + + label.FormattedText = formattedString; + TapCommand = new Command(() => + { + i++; + span.Text = $"{kText}: {i}"; + }); + + Content = new ContentView() + { + Content = new StackLayout() + { + Children = + { + label + } + } + }; + } +} diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3652.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3652.cs new file mode 100644 index 000000000000..bebe47e10f8b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3652.cs @@ -0,0 +1,110 @@ +using System.Collections.ObjectModel; +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3652, "Loses the correct reference to the cell after adding and removing items to a ListView", PlatformAffected.UWP)] +public class Issue3652 : TestContentPage +{ + MainPageViewModel model = new MainPageViewModel(); + + protected override void Init() + { + BindingContext = model; + + Content = new StackLayout + { + Children = + { + new Label + { + Text = "Remove the items using the context menu. Then add 3 more items and try to delete them as well. " + + "If all items are deleted successfully, then the test is passed.", + BackgroundColor = Colors.Aqua + }, + new Button { + Command = model.AddListItemCommand, + Text = "Add an item" + }, + new StackLayout + { + Children = { + new ListView + { + ItemsSource = model.ItemCollection, + ItemTemplate = new DataTemplate (typeof(ICell)) + } + } + } + } + }; + } + + [Preserve(AllMembers = true)] + public class ICell : ViewCell + { + public ICell() + { + var label = new Label(); + label.SetBinding(Label.TextProperty, "Description"); + label.AutomationId = "pandabear"; + var menu = new MenuItem { Text = "Remove" }; + menu.Command = new Command(() => ((ListItemViewModel)BindingContext).Remove.Execute((this, BindingContext))); + ContextActions.Add(menu); + var stack = new StackLayout + { + Children = + { + label + } + }; + View = stack; + } + } + + [Preserve(AllMembers = true)] + public class MainPageViewModel + { + int newItemNumber = 1; + + public MainPageViewModel() + { +#pragma warning disable CS0618 // Type or member is obsolete + MessagingCenter.Subscribe(this, "Remove", (sender, arg) => RemoveAnItem(arg)); +#pragma warning restore CS0618 // Type or member is obsolete + AddListItemCommand = new Command(AddListItem); + for (int i = 0; i < 3; i++) + AddListItem(); + } + + public ObservableCollection ItemCollection { get; set; } = new ObservableCollection(); + + public Command AddListItemCommand { get; set; } + + void RemoveAnItem(ListItemViewModel item) => ItemCollection.Remove(item); + + void AddListItem() + { + ItemCollection.Add(new ListItemViewModel() + { + Number = newItemNumber++ + }); + } + } + + [Preserve(AllMembers = true)] + public class ListItemViewModel + { + public int Number { get; set; } + + public string Description => $"Remove me using the context menu. #{Number}"; + +#pragma warning disable CS0618 // Type or member is obsolete + public Command Remove => + new Command(() => MessagingCenter.Send(this, "Remove", this)); +#pragma warning restore CS0618 // Type or member is obsolete + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue3667.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue3667.cs new file mode 100644 index 000000000000..57323cc907a8 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue3667.cs @@ -0,0 +1,72 @@ +using Microsoft.Maui.Controls.CustomAttributes; +using Microsoft.Maui.Controls.Internals; +using Microsoft.Maui.Graphics; + +namespace Maui.Controls.Sample.Issues; + +[Preserve(AllMembers = true)] +[Issue(IssueTracker.Github, 3667, "[Enhancement] Add text-transforms to Label", PlatformAffected.All)] +public class Issue3667 : TestContentPage +{ + string text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."; + + protected override void Init() + { + var text2 = "Malesuada fames ac turpis egestas maecenas pharetra convallis. Dictum varius duis at consectetur lorem donec massa. Augue interdum velit euismod in pellentesque."; + var transform = TextTransform.None; + + var list = new ITextElement[] { + new Label { Text = text }, + new Entry { Text = "Entry text" }, + new Editor { Text = "Editor text" }, + new SearchBar { Text = "SearchBar text" }, + new Button { Text = "Button text" }, + }; + + var statusLabel = new Label + { + Text = "Current TextTransform is None", + BackgroundColor = Colors.Aqua, + TextTransform = transform + }; + var but = new Button + { + Text = "Change TextTransform", + Command = new Command(() => + { + if (++transform > TextTransform.Uppercase) + transform = TextTransform.None; + foreach (var item in list) + item.TextTransform = transform; + statusLabel.Text = $"Current TextTransform is {transform}"; + }) + }; + + var layout = new StackLayout + { + Children = { + statusLabel, + but + } + }; + + foreach (var item in list) + { + item.TextTransform = transform; + layout.Children.Add(item as View); + } + + layout.Children.Add(new Label + { + Text = "[Lowercase] " + text2, + TextTransform = TextTransform.Lowercase + }); + layout.Children.Add(new Label + { + Text = "[Uppercase] " + text2, + TextTransform = TextTransform.Uppercase + }); + + Content = layout; + } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/AddingMultipleItemsListView.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/AddingMultipleItemsListView.cs new file mode 100644 index 000000000000..3332f83f477c --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/AddingMultipleItemsListView.cs @@ -0,0 +1,55 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.ListView)] +public class AddingMultipleItemsListView : _IssuesUITest +{ + public AddingMultipleItemsListView(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Adding Multiple Items to a ListView"; + + // [Test] + // [FailsOnIOS] + // public void AddingMultipleListViewTests1AllElementsPresent() + // { + // App.WaitForElement("Big Job"); + // App.WaitForElement("Smaller Job"); + // App.WaitForElement("Add On Job"); + // App.WaitForElement("Add One"); + // App.WaitForElement("Add Two"); + // App.WaitForElement("3672"); + // App.WaitForElement("6289"); + // App.WaitForElement("3672-41"); + // App.WaitForElement("2"); + // App.WaitForElement("2"); + // App.WaitForElement("23"); + // App.Screenshot("All elements are present"); + // } + + // [Test] + // [FailsOnIOS] + // public void AddingMultipleListViewTests2AddOneElementToList() + // { + // App.Tap("Add One"); + + // App.WaitForElement("1234", timeout: TimeSpan.FromSeconds(2)); + // App.Screenshot("One more element exists"); + // } + + // [Test] + // [FailsOnIOS] + // public void AddingMultipleListViewTests3AddTwoElementToList() + // { + // App.Screenshot("Click 'Add Two'"); + // App.Tap("Add Two"); + + // App.WaitForElement("9999", timeout: TimeSpan.FromSeconds(2)); + // App.WaitForElement("8888", timeout: TimeSpan.FromSeconds(2)); + // App.Screenshot("Two more element exist"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla21177.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla21177.cs index 419a4febd941..cd65de3979ee 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla21177.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla21177.cs @@ -1,27 +1,27 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla21177 : _IssuesUITest -// { -// public Bugzilla21177(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla21177 : _IssuesUITest +{ + public Bugzilla21177(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Using a UICollectionView in a ViewRenderer results in issues with selection"; + public override string Issue => "Using a UICollectionView in a ViewRenderer results in issues with selection"; -// // TODO: From Xamarin.UITest migration -// // This test seems wrong? There is no element #1? -// [Test] -// [Category(UITestCategories.CollectionView)] -// [FailsOnIOS] -// public void Bugzilla21177Test() -// { -// App.WaitForElement("#1"); -// App.Tap("#1"); -// App.WaitForElement("Success"); -// App.Tap("Cancel"); -// } -// } \ No newline at end of file + // TODO: From Xamarin.UITest migration + // This test seems wrong? There is no element #1? + // [Test] + // [Category(UITestCategories.CollectionView)] + // [FailsOnIOS] + // public void Bugzilla21177Test() + // { + // App.WaitForElement("#1"); + // App.Tap("#1"); + // App.WaitForElement("Success"); + // App.Tap("Cancel"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25662.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25662.cs index acb7501c9b38..6dd063b465ec 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25662.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25662.cs @@ -1,25 +1,25 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla25662 : _IssuesUITest -// { -// public Bugzilla25662(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla25662 : _IssuesUITest +{ + public Bugzilla25662(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Setting IsEnabled does not disable SwitchCell"; + public override string Issue => "Setting IsEnabled does not disable SwitchCell"; -// [Test] -// [Category(UITestCategories.Cells)] -// [FailsOnIOS] -// [FailsOnWindows] -// public void Bugzilla25662Test() -// { -// App.WaitForElement("One"); -// App.Tap("One"); -// App.WaitForNoElement("FAIL"); -// } -// } \ No newline at end of file + // [Test] + // [Category(UITestCategories.Cells)] + // [FailsOnIOS] + // [FailsOnWindows] + // public void Bugzilla25662Test() + // { + // App.WaitForElement("One"); + // App.Tap("One"); + // App.WaitForNoElement("FAIL"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25979.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25979.cs index 52e99d2806bf..dd431df555a1 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25979.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla25979.cs @@ -1,16 +1,16 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla25979 : _IssuesUITest -// { -// public Bugzilla25979(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla25979 : _IssuesUITest +{ + public Bugzilla25979(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "https://bugzilla.xamarin.com/show_bug.cgi?id=25979"; + public override string Issue => "https://bugzilla.xamarin.com/show_bug.cgi?id=25979"; // [Test] // [Category(UITestCategories.Navigation)] @@ -38,4 +38,4 @@ // App.Tap("PopButton"); // App.WaitForElement("PopAttempted"); // } -// } \ No newline at end of file +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26171.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26171.cs index 09c6901b6451..b2d9e0d64360 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26171.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26171.cs @@ -1,21 +1,21 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla26171 : _IssuesUITest -// { -// public Bugzilla26171(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla26171 : _IssuesUITest +{ + public Bugzilla26171(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Microsoft.Maui.Controls.Maps is not updating VisibleRegion property when layout is changed"; + public override string Issue => "Microsoft.Maui.Controls.Maps is not updating VisibleRegion property when layout is changed"; -// [Test] -// [Category(UITestCategories.Maps)] -// public void Bugzilla26171Test() -// { -// App.WaitForElement("lblValue"); -// } -// } \ No newline at end of file + // [Test] + // [Category(UITestCategories.Maps)] + // public void Bugzilla26171Test() + // { + // App.WaitForElement("lblValue"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26233.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26233.cs index fb249faca8c5..8553e97352b7 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26233.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26233.cs @@ -1,26 +1,26 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla26233 : _IssuesUITest -// { -// public Bugzilla26233(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla26233 : _IssuesUITest +{ + public Bugzilla26233(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Windows phone crashing when going back to page containing listview with Frame inside ViewCell"; + public override string Issue => "Windows phone crashing when going back to page containing listview with Frame inside ViewCell"; -// [Test] -// [Category(UITestCategories.ListView)] -// public void DoesntCrashOnNavigatingBackToThePage() -// { -// App.WaitForElement("btnPush"); -// App.Tap("btnPush"); -// App.WaitForElement("back"); -// App.Screenshot("I see the back button"); -// App.Tap("back"); -// App.WaitForElement("btnPush"); -// } -// } \ No newline at end of file + // [Test] + // [Category(UITestCategories.ListView)] + // public void DoesntCrashOnNavigatingBackToThePage() + // { + // App.WaitForElement("btnPush"); + // App.Tap("btnPush"); + // App.WaitForElement("back"); + // App.Screenshot("I see the back button"); + // App.Tap("back"); + // App.WaitForElement("btnPush"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26501.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26501.cs index 490e47e8bf8b..c69051767a40 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26501.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla26501.cs @@ -1,23 +1,23 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla26501 : _IssuesUITest -// { -// public Bugzilla26501(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla26501 : _IssuesUITest +{ + public Bugzilla26501(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "BindingSource / Context action issue"; + public override string Issue => "BindingSource / Context action issue"; -// [Test] -// [Category(UITestCategories.InputTransparent)] -// public void TestCellsShowAfterRefresh() -// { -// App.Tap("Refresh"); + // [Test] + // [Category(UITestCategories.InputTransparent)] + // public void TestCellsShowAfterRefresh() + // { + // App.Tap("Refresh"); -// App.WaitForElement("ZOOMER robothund 2"); -// } -// } \ No newline at end of file + // App.WaitForElement("ZOOMER robothund 2"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla27731.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla27731.cs index 48d38a8f47ee..fc1d04e31ca9 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla27731.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla27731.cs @@ -1,22 +1,22 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla27731 : _IssuesUITest -// { -// public Bugzilla27731(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla27731 : _IssuesUITest +{ + public Bugzilla27731(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "[Android] Action Bar can not be controlled reliably on FlyoutPage"; + public override string Issue => "[Android] Action Bar can not be controlled reliably on FlyoutPage"; -// [Test] -// [Category(UITestCategories.InputTransparent)] -// public void Bugzilla27731Test() -// { -// App.WaitForElement("Click"); -// App.WaitForNoElement("PageTitle"); -// } -// } \ No newline at end of file + // [Test] + // [Category(UITestCategories.InputTransparent)] + // public void Bugzilla27731Test() + // { + // App.WaitForElement("Click"); + // App.WaitForNoElement("PageTitle"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla28001.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla28001.cs index 3162e9a85614..98c4486d5d64 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla28001.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla28001.cs @@ -1,32 +1,32 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla28001 : _IssuesUITest -// { -// public Bugzilla28001(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla28001 : _IssuesUITest +{ + public Bugzilla28001(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "[Android] TabbedPage: invisible tabs are not Disposed"; + public override string Issue => "[Android] TabbedPage: invisible tabs are not Disposed"; -// [FailsOnIOS] -// [FailsOnAndroid] -// [Test] -// [Category(UITestCategories.TabbedPage)] -// public void Bugzilla28001Test() -// { -// App.WaitForElement("Push"); + // [FailsOnIOS] + // [FailsOnAndroid] + // [Test] + // [Category(UITestCategories.TabbedPage)] + // public void Bugzilla28001Test() + // { + // App.WaitForElement("Push"); -// App.Screenshot("I am at Bugzilla 28001"); -// App.Tap("Push"); -// App.Tap("Tab2"); -// App.Tap("Tab1"); -// App.Tap("Pop"); + // App.Screenshot("I am at Bugzilla 28001"); + // App.Tap("Push"); + // App.Tap("Tab2"); + // App.Tap("Tab1"); + // App.Tap("Pop"); -// Assert.That(App.FindElement("lblDisposedCount").GetText(), -// Is.EqualTo("Dispose 2 pages")); -// } -// } \ No newline at end of file + // Assert.That(App.FindElement("lblDisposedCount").GetText(), + // Is.EqualTo("Dispose 2 pages")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30317.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30317.cs index bf1c88b523fb..1626e67d38d3 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30317.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30317.cs @@ -1,87 +1,87 @@ -// #if ANDROID -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; - -// namespace Microsoft.Maui.TestCases.Tests.Issues; - -// [Category(UITestCategories.TabbedPage)] -// public class Bugzilla30317 : _IssuesUITest -// { -// public Bugzilla30317(TestDevice testDevice) : base(testDevice) -// { -// } - -// public override string Issue => "https://bugzilla.xamarin.com/show_bug.cgi?id=30137"; - -// [Test] -// public void Bugzilla30317ItemSourceOnAppearingContentPage () -// { -// App.Screenshot ("I am at Bugzilla30317"); -// App.WaitForElement ("GoToPageTwoButton"); -// App.Screenshot ("I see Page 1"); - -// App.WaitForElement ("PageOneItem1"); -// App.TouchAndHold ("PageOneItem1"); - -// App.WaitForElement ("PageOneItem5"); -// App.TouchAndHold ("PageOneItem5"); - -// App.Screenshot ("I did not crash"); -// } - -// [Test] -// public void Bugzilla30317ItemSourceCtorContentPage () -// { -// App.WaitForElement ("GoToPageTwoButton"); -// App.Tap ("GoToPageTwoButton"); - -// App.WaitForElement ("PageTwo"); -// App.Screenshot ("I see Page 2"); +#if ANDROID +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.TabbedPage)] +public class Bugzilla30317 : _IssuesUITest +{ + public Bugzilla30317(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "https://bugzilla.xamarin.com/show_bug.cgi?id=30137"; + + // [Test] + // public void Bugzilla30317ItemSourceOnAppearingContentPage () + // { + // App.Screenshot ("I am at Bugzilla30317"); + // App.WaitForElement ("GoToPageTwoButton"); + // App.Screenshot ("I see Page 1"); + + // App.WaitForElement ("PageOneItem1"); + // App.TouchAndHold ("PageOneItem1"); + + // App.WaitForElement ("PageOneItem5"); + // App.TouchAndHold ("PageOneItem5"); + + // App.Screenshot ("I did not crash"); + // } + + // [Test] + // public void Bugzilla30317ItemSourceCtorContentPage () + // { + // App.WaitForElement ("GoToPageTwoButton"); + // App.Tap ("GoToPageTwoButton"); + + // App.WaitForElement ("PageTwo"); + // App.Screenshot ("I see Page 2"); -// App.WaitForElement ("PageTwoItem1"); -// App.TouchAndHold ("PageTwoItem1"); + // App.WaitForElement ("PageTwoItem1"); + // App.TouchAndHold ("PageTwoItem1"); -// App.WaitForElement ("PageTwoItem5"); -// App.TouchAndHold ("PageTwoItem5"); + // App.WaitForElement ("PageTwoItem5"); + // App.TouchAndHold ("PageTwoItem5"); -// App.Screenshot ("I did not crash"); -// } - -// [Test] -// public void Bugzilla30317ItemSourceTabbedPage () -// { -// App.WaitForElement ("GoToPageTwoButton"); -// App.Tap ("GoToPageTwoButton"); - -// App.Screenshot ("I see Page 2"); -// App.WaitForElement ("PageTwo"); - -// App.WaitForElement ("GoToPageThreeButton"); -// App.Tap ("GoToPageThreeButton"); - -// App.Screenshot ("I see TabbedPage One"); -// App.WaitForElement ("TabOneCtor"); - -// App.WaitForElement ("PageThreeTabOneItem1"); -// App.TouchAndHold ("PageThreeTabOneItem1"); -// App.WaitForElement ("PageThreeTabOneItem1"); - -// App.WaitForElement ("PageThreeTabOneItem5"); -// App.TouchAndHold ("PageThreeTabOneItem5"); -// App.WaitForElement ("PageThreeTabOneItem5"); - -// App.Screenshot ("I see TabbedPage Two"); -// App.WaitForElement ("TabTwoOnAppearing"); -// App.Tap ("TabTwoOnAppearing"); - -// App.WaitForElement ("PageThreeTabTwoItem1"); -// App.TouchAndHold ("PageThreeTabTwoItem1"); -// App.WaitForElement ("PageThreeTabTwoItem1"); - -// App.WaitForElement ("PageThreeTabTwoItem5"); -// App.TouchAndHold ("PageThreeTabTwoItem5"); -// App.WaitForElement ("PageThreeTabTwoItem5"); -// } -// } -// #endif \ No newline at end of file + // App.Screenshot ("I did not crash"); + // } + + // [Test] + // public void Bugzilla30317ItemSourceTabbedPage () + // { + // App.WaitForElement ("GoToPageTwoButton"); + // App.Tap ("GoToPageTwoButton"); + + // App.Screenshot ("I see Page 2"); + // App.WaitForElement ("PageTwo"); + + // App.WaitForElement ("GoToPageThreeButton"); + // App.Tap ("GoToPageThreeButton"); + + // App.Screenshot ("I see TabbedPage One"); + // App.WaitForElement ("TabOneCtor"); + + // App.WaitForElement ("PageThreeTabOneItem1"); + // App.TouchAndHold ("PageThreeTabOneItem1"); + // App.WaitForElement ("PageThreeTabOneItem1"); + + // App.WaitForElement ("PageThreeTabOneItem5"); + // App.TouchAndHold ("PageThreeTabOneItem5"); + // App.WaitForElement ("PageThreeTabOneItem5"); + + // App.Screenshot ("I see TabbedPage Two"); + // App.WaitForElement ("TabTwoOnAppearing"); + // App.Tap ("TabTwoOnAppearing"); + + // App.WaitForElement ("PageThreeTabTwoItem1"); + // App.TouchAndHold ("PageThreeTabTwoItem1"); + // App.WaitForElement ("PageThreeTabTwoItem1"); + + // App.WaitForElement ("PageThreeTabTwoItem5"); + // App.TouchAndHold ("PageThreeTabTwoItem5"); + // App.WaitForElement ("PageThreeTabTwoItem5"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30324.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30324.cs index 4d9cfcecfe50..d1b8665fd073 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30324.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30324.cs @@ -1,28 +1,28 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla30324 : _IssuesUITest -// { -// public Bugzilla30324(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla30324 : _IssuesUITest +{ + public Bugzilla30324(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Detail view of FlyoutPage does not get appearance events on Android when whole FlyoutPage disappears/reappears"; + public override string Issue => "Detail view of FlyoutPage does not get appearance events on Android when whole FlyoutPage disappears/reappears"; -// [Test] -// [Category(UITestCategories.FlyoutPage)] -// public void Bugzilla30324Test () -// { -// App.WaitForElement("navigate"); + // [Test] + // [Category(UITestCategories.FlyoutPage)] + // public void Bugzilla30324Test () + // { + // App.WaitForElement("navigate"); -// App.Tap("navigate"); -// App.Tap("navigateback"); -// App.WaitForElement("Disappeardetail"); -// App.Tap("navigate"); -// App.Tap("navigateback"); -// App.WaitForElement("Appeardetail"); -// } -// } \ No newline at end of file + // App.Tap("navigate"); + // App.Tap("navigateback"); + // App.WaitForElement("Disappeardetail"); + // App.Tap("navigate"); + // App.Tap("navigateback"); + // App.WaitForElement("Appeardetail"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30353.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30353.cs index 8e4c7bdd79b6..6cd298288678 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30353.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla30353.cs @@ -1,56 +1,56 @@ -// #if !WINDOWS // Setting orientation is not supported on Windows -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +#if !WINDOWS // Setting orientation is not supported on Windows +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla30353 : _IssuesUITest -// { -// public Bugzilla30353(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla30353 : _IssuesUITest +{ + public Bugzilla30353(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "FlyoutPage.IsPresentedChanged is not raised"; + public override string Issue => "FlyoutPage.IsPresentedChanged is not raised"; -// // There is 2 "Toggle" in the UI, which is which? They also need AutomationIds -// [Test] -// [FailsOnMac] -// [FailsOnIOS] -// [Category(UITestCategories.FlyoutPage)] -// public void FlyoutPageIsPresentedChangedRaised() -// { -// App.SetOrientationPortrait(); -// App.Screenshot("Portrait"); -// App.Tap("Toggle"); -// App.Screenshot("Portrait Visible"); -// App.WaitForElement("The Flyout is now visible"); -// App.Back(); -// App.Screenshot("Portrait Invisible"); -// App.WaitForElement("The Flyout is now invisible"); -// App.SetOrientationLandscape(); -// App.Screenshot("Landscape Invisible"); -// App.WaitForElement("The Flyout is now invisible"); -// App.Tap("Toggle"); -// App.Screenshot("Landscape Visible"); -// App.WaitForElement("The Flyout is now visible"); -// App.Back(); -// App.Screenshot("Landscape InVisible"); -// App.WaitForElement("The Flyout is now invisible"); -// App.SetOrientationPortrait(); -// App.Tap("Toggle"); -// App.Screenshot("Portrait Visible"); -// App.WaitForElement("The Flyout is now visible"); -// App.Back(); -// App.Screenshot("Portrait Invisible"); -// App.WaitForElement("The Flyout is now invisible"); -// App.SetOrientationLandscape(); -// } + // There is 2 "Toggle" in the UI, which is which? They also need AutomationIds + // [Test] + // [FailsOnMac] + // [FailsOnIOS] + // [Category(UITestCategories.FlyoutPage)] + // public void FlyoutPageIsPresentedChangedRaised() + // { + // App.SetOrientationPortrait(); + // App.Screenshot("Portrait"); + // App.Tap("Toggle"); + // App.Screenshot("Portrait Visible"); + // App.WaitForElement("The Flyout is now visible"); + // App.Back(); + // App.Screenshot("Portrait Invisible"); + // App.WaitForElement("The Flyout is now invisible"); + // App.SetOrientationLandscape(); + // App.Screenshot("Landscape Invisible"); + // App.WaitForElement("The Flyout is now invisible"); + // App.Tap("Toggle"); + // App.Screenshot("Landscape Visible"); + // App.WaitForElement("The Flyout is now visible"); + // App.Back(); + // App.Screenshot("Landscape InVisible"); + // App.WaitForElement("The Flyout is now invisible"); + // App.SetOrientationPortrait(); + // App.Tap("Toggle"); + // App.Screenshot("Portrait Visible"); + // App.WaitForElement("The Flyout is now visible"); + // App.Back(); + // App.Screenshot("Portrait Invisible"); + // App.WaitForElement("The Flyout is now invisible"); + // App.SetOrientationLandscape(); + // } -// [TearDown] -// public void TearDown() -// { -// App.SetOrientationPortrait(); -// } -// } -// #endif \ No newline at end of file + [TearDown] + public void TearDown() + { + App.SetOrientationPortrait(); + } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31114.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31114.cs index 1df571380d89..29683d104b28 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31114.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31114.cs @@ -1,37 +1,37 @@ -// #if IOS -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +#if IOS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla31114 : _IssuesUITest -// { -// public Bugzilla31114(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla31114 : _IssuesUITest +{ + public Bugzilla31114(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "iOS ContextAction leaves blank line after swiping in ListView"; + public override string Issue => "iOS ContextAction leaves blank line after swiping in ListView"; -// [Test] -// [Category(UITestCategories.ListView)] -// [FailsOnIOS("Fails sometimes - needs a better test")] -// public void Bugzilla31114Test() -// { -// for (int i = 0; i < 5; i++) -// { -// App.DragCoordinates(10, 300, 10, 10); -// } -// App.Tap("btnLoad"); -// App.DragCoordinates(10, 300, 10, 10); -// App.WaitForElement("PIPE #1007"); -// App.WaitForElement("PIPE #1008"); -// App.WaitForElement("PIPE #1009"); -// App.DragCoordinates(10, 300, 10, 10); -// App.WaitForElement("PIPE #1010"); -// App.WaitForElement("PIPE #1011"); -// App.WaitForElement("PIPE #1012"); -// App.WaitForElement("PIPE #1013"); -// } -// } -// #endif \ No newline at end of file + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS("Fails sometimes - needs a better test")] + // public void Bugzilla31114Test() + // { + // for (int i = 0; i < 5; i++) + // { + // App.DragCoordinates(10, 300, 10, 10); + // } + // App.Tap("btnLoad"); + // App.DragCoordinates(10, 300, 10, 10); + // App.WaitForElement("PIPE #1007"); + // App.WaitForElement("PIPE #1008"); + // App.WaitForElement("PIPE #1009"); + // App.DragCoordinates(10, 300, 10, 10); + // App.WaitForElement("PIPE #1010"); + // App.WaitForElement("PIPE #1011"); + // App.WaitForElement("PIPE #1012"); + // App.WaitForElement("PIPE #1013"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31330.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31330.cs index 909c6cce6b99..b2b2946c633f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31330.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31330.cs @@ -1,34 +1,34 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla31330 : _IssuesUITest -// { -// public Bugzilla31330(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla31330 : _IssuesUITest +{ + public Bugzilla31330(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Disabled context actions appear enabled"; + public override string Issue => "Disabled context actions appear enabled"; -// // TODO: porting over from Xamarin.UITest -// // We don't seem to have "ActivateContextMenu" (yet)? -// [FailsOnAndroid] -// [FailsOnIOS] -// [Test] -// [Category(UITestCategories.ListView)] -// public void Bugzilla31330Test() -// { -// App.WaitForElement("Something 2"); -// App.ActivateContextMenu("Something 1"); -// App.WaitForElement("Delete"); -// App.Tap("Delete"); -// App.DismissContextMenu(); -// App.Tap("Something 2"); -// App.ActivateContextMenu("Something 2"); -// App.WaitForElement("Delete"); -// App.Tap("Delete"); -// App.WaitForNoElement("Something 2"); -// } -// } \ No newline at end of file + // TODO: porting over from Xamarin.UITest + // We don't seem to have "ActivateContextMenu" (yet)? + // [FailsOnAndroid] + // [FailsOnIOS] + // [Test] + //[Category(UITestCategories.ListView)] + // public void Bugzilla31330Test() + // { + // App.WaitForElement("Something 2"); + // App.ActivateContextMenu("Something 1"); + // App.WaitForElement("Delete"); + // App.Tap("Delete"); + // App.DismissContextMenu(); + // App.Tap("Something 2"); + // App.ActivateContextMenu("Something 2"); + // App.WaitForElement("Delete"); + // App.Tap("Delete"); + // App.WaitForNoElement("Something 2"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31333.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31333.cs index 36a72758fc7f..07e76fa466f7 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31333.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31333.cs @@ -1,21 +1,21 @@ -// using System.Diagnostics; -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using System.Diagnostics; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// [Category(UITestCategories.TableView)] -// public class Bugzilla31333 : _IssuesUITest -// { -// public Bugzilla31333(TestDevice testDevice) : base(testDevice) -// { -// } +[Category(UITestCategories.TableView)] +public class Bugzilla31333 : _IssuesUITest +{ + public Bugzilla31333(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Focus() on Entry in ViewCell brings up keyboard, but doesn't have cursor in EditText"; + public override string Issue => "Focus() on Entry in ViewCell brings up keyboard, but doesn't have cursor in EditText"; -// // TODO: Migrating from Xamarin.UITest, some method calls in here -// // do not translate to Appium (yet) need to look into that later. +// TODO: Migrating from Xamarin.UITest, some method calls in here +// do not translate to Appium (yet) need to look into that later. // [FailsOnAndroid] // [FailsOnIOS] // [Test] @@ -111,4 +111,4 @@ // Assert.Fail($"Timed out waiting for text '{text}'"); // } -// } \ No newline at end of file +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31602.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31602.cs index 298a69ca0f74..864033f16180 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31602.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla31602.cs @@ -1,40 +1,40 @@ -// #if !WINDOWS || MACCATALYST // Setting orientation is not supported on Windows and Mac -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +#if !WINDOWS || MACCATALYST // Setting orientation is not supported on Windows and Mac +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla31602 : _IssuesUITest -// { -// public Bugzilla31602(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla31602 : _IssuesUITest +{ + public Bugzilla31602(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "not possible to programmatically open master page after iPad landscape -> portrait rotation, also tests 31664"; + public override string Issue => "not possible to programmatically open master page after iPad landscape -> portrait rotation, also tests 31664"; -// [Test] -// [FailsOnIOS] -// [Category(UITestCategories.FlyoutPage)] -// public void Bugzilla31602Test() -// { -// if (Devices.DeviceInfo.Idiom == Devices.DeviceIdiom.Tablet) -// { -// App.Tap("Sidemenu Opener"); -// App.WaitForElement("SideMenu"); -// App.SetOrientationLandscape(); -// App.WaitForElement("SideMenu"); -// App.SetOrientationPortrait(); -// App.WaitForNoElement("SideMenu"); -// App.Tap("Sidemenu Opener"); -// App.WaitForElement("SideMenu"); -// } -// } + // [Test] + // [FailsOnIOS] + // [Category(UITestCategories.FlyoutPage)] + // public void Bugzilla31602Test() + // { + // if (Devices.DeviceInfo.Idiom == Devices.DeviceIdiom.Tablet) + // { + // App.Tap("Sidemenu Opener"); + // App.WaitForElement("SideMenu"); + // App.SetOrientationLandscape(); + // App.WaitForElement("SideMenu"); + // App.SetOrientationPortrait(); + // App.WaitForNoElement("SideMenu"); + // App.Tap("Sidemenu Opener"); + // App.WaitForElement("SideMenu"); + // } + // } -// [TearDown] -// public void TearDown() -// { -// App.SetOrientationPortrait(); -// } -// } -// #endif \ No newline at end of file + // [TearDown] + // public void TearDown() + // { + // App.SetOrientationPortrait(); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32040.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32040.cs index f33e1a9d3895..d3cf530193aa 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32040.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32040.cs @@ -1,28 +1,28 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla32040 : _IssuesUITest -// { -// public Bugzilla32040(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla32040 : _IssuesUITest +{ + public Bugzilla32040(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "EntryCell.Tapped or SwitchCell.Tapped does not fire when within a TableView "; + public override string Issue => "EntryCell.Tapped or SwitchCell.Tapped does not fire when within a TableView "; -// [Test] -// [Category(UITestCategories.Cells)] -// [FailsOnIOS] -// [FailsOnWindows] -// public void TappedWorksForEntryAndSwithCellTest() -// { -// App.WaitForElement("blahblah"); -// App.Tap("blahblah"); -// App.Tap("yaddayadda"); + // [Test] + // [Category(UITestCategories.Cells)] + // [FailsOnIOS] + // [FailsOnWindows] + // public void TappedWorksForEntryAndSwithCellTest() + // { + // App.WaitForElement("blahblah"); + // App.Tap("blahblah"); + // App.Tap("yaddayadda"); -// Assert.That(App.FindElements("Tapped").Count, -// Is.GreaterThanOrEqualTo(2)); -// } -// } + // Assert.That(App.FindElements("Tapped").Count, + // Is.GreaterThanOrEqualTo(2)); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32148.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32148.cs index e53c51a567cf..d89eae100c05 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32148.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32148.cs @@ -1,25 +1,25 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla32148 : _IssuesUITest -// { -// public Bugzilla32148(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla32148 : _IssuesUITest +{ + public Bugzilla32148(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => " Pull to refresh hides the first item on a list view"; + public override string Issue => " Pull to refresh hides the first item on a list view"; -// [Test] -// [Category(UITestCategories.ListView)] -// [FailsOnIOS] -// public void Bugzilla32148Test() -// { -// App.WaitForElement("Contact0 LastName"); -// App.Tap("Search"); -// App.WaitForElement("Contact0 LastName"); -// App.Screenshot("For manual review, is the first cell visible?"); -// } -// } + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Bugzilla32148Test() + // { + // App.WaitForElement("Contact0 LastName"); + // App.Tap("Search"); + // App.WaitForElement("Contact0 LastName"); + // App.Screenshot("For manual review, is the first cell visible?"); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32462.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32462.cs index 01c9c76eebd2..d6bcfe555d9a 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32462.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32462.cs @@ -1,26 +1,26 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla32462 : _IssuesUITest -// { -// public Bugzilla32462(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla32462 : _IssuesUITest +{ + public Bugzilla32462(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Crash after a page disappeared if a ScrollView is in the HeaderTemplate property of a ListView"; + public override string Issue => "Crash after a page disappeared if a ScrollView is in the HeaderTemplate property of a ListView"; -// [Test] -// [Category(UITestCategories.ListView)] -// [FailsOnIOS] -// public void Bugzilla36729Test() -// { -// App.WaitForElement("Click!"); -// App.Tap("Click!"); -// App.WaitForElement("listview"); -// App.WaitForElement("some text 35"); -// App.Back(); -// } -// } + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Bugzilla36729Test() + // { + // App.WaitForElement("Click!"); + // App.Tap("Click!"); + // App.WaitForElement("listview"); + // App.WaitForElement("some text 35"); + // App.Back(); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32801.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32801.cs index 54292f3a9b08..fc4965eb5d8b 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32801.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32801.cs @@ -1,36 +1,36 @@ -// #if IOS -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +#if IOS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla32801 : _IssuesUITest -// { -// public Bugzilla32801(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla32801 : _IssuesUITest +{ + public Bugzilla32801(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Memory Leak in TabbedPage + NavigationPage"; + public override string Issue => "Memory Leak in TabbedPage + NavigationPage"; -// [Test] -// [Category(UITestCategories.TabbedPage)] -// [FailsOnIOS] -// public void Bugzilla32801Test() -// { -// App.Tap("btnAdd"); -// App.Tap("btnAdd"); -// App.Tap("btnStack"); -// App.WaitForElement("Stack 3"); -// App.Tap("Tab"); -// App.Tap("btnStack"); -// App.WaitForElement("Stack 1"); -// } + // [Test] + // [Category(UITestCategories.TabbedPage)] + // [FailsOnIOS] + // public void Bugzilla32801Test() + // { + // App.Tap("btnAdd"); + // App.Tap("btnAdd"); + // App.Tap("btnStack"); + // App.WaitForElement("Stack 3"); + // App.Tap("Tab"); + // App.Tap("btnStack"); + // App.WaitForElement("Stack 1"); + // } -// [TearDown] -// public void TearDown() -// { -// App.SetOrientationPortrait(); -// } -// } -// #endif \ No newline at end of file + // [TearDown] + // public void TearDown() + // { + // App.SetOrientationPortrait(); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32902.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32902.cs index 88603b3a445e..62803bb00d12 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32902.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla32902.cs @@ -1,27 +1,27 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla32902 : _IssuesUITest -// { -// public Bugzilla32902(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla32902 : _IssuesUITest +{ + public Bugzilla32902(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "[iOS | iPad] App Crashes (without debug log) when Flyout Detail isPresented and navigation being popped"; + public override string Issue => "[iOS | iPad] App Crashes (without debug log) when Flyout Detail isPresented and navigation being popped"; -// [Test] -// [Category(UITestCategories.FlyoutPage)] -// public void Bugzilla32902Test() -// { -// if (Devices.DeviceInfo.Idiom == Devices.DeviceIdiom.Tablet) -// { -// App.Tap("btnNext"); -// App.Tap("btnPushModal"); -// App.Tap("Flyout"); -// App.Tap("btnPop"); -// } -// } -// } + // [Test] + // [Category(UITestCategories.FlyoutPage)] + // public void Bugzilla32902Test() + // { + // if (Devices.DeviceInfo.Idiom == Devices.DeviceIdiom.Tablet) + // { + // App.Tap("btnNext"); + // App.Tap("btnPushModal"); + // App.Tap("Flyout"); + // App.Tap("btnPop"); + // } + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33578.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33578.cs index ea5bc1e5de0a..4646f029b7e5 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33578.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33578.cs @@ -1,38 +1,38 @@ -// #if IOS -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +#if IOS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla33578 : _IssuesUITest -// { -// public Bugzilla33578(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla33578 : _IssuesUITest +{ + public Bugzilla33578(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "TableView EntryCell shows DefaultKeyboard, but after scrolling down and back a NumericKeyboard ("; + public override string Issue => "TableView EntryCell shows DefaultKeyboard, but after scrolling down and back a NumericKeyboard ("; -// // TODO: Migration from Xamarin.UITest -// // Find out how to do this advanced stuff with Appium -// [Test] -// [Category(UITestCategories.TableView)] -// [FailsOnIOS] -// public void TableViewEntryCellShowsDefaultKeyboardThenNumericKeyboardAfterScrolling() -// { -// App.ScrollDown("table"); -// App.ScrollDown("table"); -// App.Tap("entryNumeric"); -// var e = App.Query(c => c.Marked("0").Parent("UITextField").Index(0).Invoke("keyboardType"))[0]; -// //8 DecimalPad -// Assert.AreEqual(8, e); -// App.DismissKeyboard(); -// App.Tap(x => x.Marked("Enter text here").Index(0).Parent()); -// App.ScrollUp(); -// App.Tap(x => x.Marked("Enter text here 1")); -// App.Tap(x => x.Marked("Enter text here 2").Index(0).Parent()); -// var e1 = App.Query(c => c.Marked("Enter text here 2").Parent("UITextField").Index(0).Invoke("keyboardType"))[0]; -// Assert.AreEqual(0, e1); -// } -// } -// #endif \ No newline at end of file + // TODO: Migration from Xamarin.UITest + // Find out how to do this advanced stuff with Appium + // [Test] + // [Category(UITestCategories.TableView)] + // [FailsOnIOS] + // public void TableViewEntryCellShowsDefaultKeyboardThenNumericKeyboardAfterScrolling() + // { + // App.ScrollDown("table"); + // App.ScrollDown("table"); + // App.Tap("entryNumeric"); + // var e = App.Query(c => c.Marked("0").Parent("UITextField").Index(0).Invoke("keyboardType"))[0]; + // //8 DecimalPad + // Assert.AreEqual(8, e); + // App.DismissKeyboard(); + // App.Tap(x => x.Marked("Enter text here").Index(0).Parent()); + // App.ScrollUp(); + // App.Tap(x => x.Marked("Enter text here 1")); + // App.Tap(x => x.Marked("Enter text here 2").Index(0).Parent()); + // var e1 = App.Query(c => c.Marked("Enter text here 2").Parent("UITextField").Index(0).Invoke("keyboardType"))[0]; + // Assert.AreEqual(0, e1); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33612.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33612.cs index 65b43627fa33..204a43caa9b8 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33612.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33612.cs @@ -1,35 +1,36 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla33612 : _IssuesUITest -// { -// public Bugzilla33612(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla33612 : _IssuesUITest +{ + public Bugzilla33612(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "(A) Removing a page from the navigation stack causes an 'Object reference' exception in Android only"; + public override string Issue => "(A) Removing a page from the navigation stack causes an 'Object reference' exception in Android only"; -// [Test] -// [Category(UITestCategories.Navigation)] -// public void Issue33612RemovePagesWithoutRenderers() -// { -// App.WaitForElement("Go To Page 2"); -// App.Tap("Go To Page 2"); + // [Test] + // [Category(UITestCategories.Navigation)] + // //[UiTest(typeof(NavigationPage))] + // public void Issue33612RemovePagesWithoutRenderers() + // { + // App.WaitForElement("Go To Page 2"); + // App.Tap("Go To Page 2"); -// App.WaitForElement("This is Page 2"); -// App.Screenshot("At Page 2"); -// App.Tap("Go to Page 3"); + // App.WaitForElement("This is Page 2"); + // App.Screenshot("At Page 2"); + // App.Tap("Go to Page 3"); -// App.WaitForElement("This is Page 3"); -// App.WaitForElement("Return To Page 2", -// timeout: TimeSpan.FromSeconds(15)); -// App.Screenshot("At Page 3"); -// App.Tap("Return To Page 2"); + // App.WaitForElement("This is Page 3"); + // App.WaitForElement("Return To Page 2", + // timeout: TimeSpan.FromSeconds(15)); + // App.Screenshot("At Page 3"); + // App.Tap("Return To Page 2"); -// App.WaitForElement("If you're seeing this, nothing crashed. Yay!"); -// App.Screenshot("Success Page"); -// } -// } \ No newline at end of file + // App.WaitForElement("If you're seeing this, nothing crashed. Yay!"); + // App.Screenshot("Success Page"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33870.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33870.cs index 14143fd0d78a..6ac4c874d35c 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33870.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla33870.cs @@ -1,26 +1,26 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla33870 : _IssuesUITest -// { -// public Bugzilla33870(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla33870 : _IssuesUITest +{ + public Bugzilla33870(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "[W] Crash when the ListView Selection is set to null"; + public override string Issue => "[W] Crash when the ListView Selection is set to null"; -// [Test] -// [Category(UITestCategories.ListView)] -// [FailsOnIOS] -// public void Bugzilla33870Test() -// { -// App.WaitForElement("PageContentAutomatedId"); -// App.WaitForElement("ListViewAutomatedId"); -// App.Tap("CLEAR SELECTION"); + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Bugzilla33870Test() + // { + // App.WaitForElement("PageContentAutomatedId"); + // App.WaitForElement("ListViewAutomatedId"); + // App.Tap("CLEAR SELECTION"); -// App.WaitForElement("Cleared"); -// } -// } \ No newline at end of file + // App.WaitForElement("Cleared"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla34632.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla34632.cs index ae7f7228babe..1e2a5f563a06 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla34632.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla34632.cs @@ -1,47 +1,47 @@ -// #if !IOS && !WINDOWS // Setting orientation is not supported on Windows -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +#if !IOS && !WINDOWS // Setting orientation is not supported on Windows +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla34632 : _IssuesUITest -// { -// public Bugzilla34632(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla34632 : _IssuesUITest +{ + public Bugzilla34632(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Can't change IsPresented when setting SplitOnLandscape "; + public override string Issue => "Can't change IsPresented when setting SplitOnLandscape "; -// [Test] -// [Category(UITestCategories.FlyoutPage)] -// public void Bugzilla34632Test() -// { -// if (Devices.DeviceInfo.Idiom == Devices.DeviceIdiom.Tablet) -// { -// App.SetOrientationPortrait(); -// App.Tap("btnModal"); -// App.SetOrientationLandscape(); -// App.Tap("btnDismissModal"); -// App.Tap("btnModal"); -// App.SetOrientationPortrait(); -// App.Tap("btnDismissModal"); -// App.Tap("Main Page"); -// App.Tap("btnFlyout"); -// App.WaitForNoElement("btnFlyout"); -// } -// else -// { -// // Wait for the test to finish loading before exiting otherwise -// // the next UI test might start running while this is still loading -// App.WaitForElement("btnModal"); -// } -// } + // [Test] + // [Category(UITestCategories.FlyoutPage)] + // public void Bugzilla34632Test() + // { + // if (Devices.DeviceInfo.Idiom == Devices.DeviceIdiom.Tablet) + // { + // App.SetOrientationPortrait(); + // App.Tap("btnModal"); + // App.SetOrientationLandscape(); + // App.Tap("btnDismissModal"); + // App.Tap("btnModal"); + // App.SetOrientationPortrait(); + // App.Tap("btnDismissModal"); + // App.Tap("Main Page"); + // App.Tap("btnFlyout"); + // App.WaitForNoElement("btnFlyout"); + // } + // else + // { + // // Wait for the test to finish loading before exiting otherwise + // // the next UI test might start running while this is still loading + // App.WaitForElement("btnModal"); + // } + // } -// [TearDown] -// public void TearDown() -// { -// App.SetOrientationPortrait(); -// } -// } -// #endif \ No newline at end of file + // [TearDown] + // public void TearDown() + // { + // App.SetOrientationPortrait(); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla34912.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla34912.cs index 394391aca316..32bb5d8ba686 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla34912.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla34912.cs @@ -1,27 +1,27 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla34912 : _IssuesUITest -// { -// public Bugzilla34912(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla34912 : _IssuesUITest +{ + public Bugzilla34912(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Can't change IsPresented when setting SplitOnLandscape "; + public override string Issue => "Can't change IsPresented when setting SplitOnLandscape "; -// [Test] -// [Category(UITestCategories.ListView)] -// [FailsOnIOS] -// public void Bugzilla34912Test() -// { -// App.Tap("Allen"); -// App.WaitForElement("You tapped Allen"); -// App.Tap("OK"); -// App.Tap("btnDisable"); -// App.Tap("Allen"); -// App.WaitForNoElement("You tapped Allen"); -// } -// } \ No newline at end of file + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Bugzilla34912Test() + // { + // App.Tap("Allen"); + // App.WaitForElement("You tapped Allen"); + // App.Tap("OK"); + // App.Tap("btnDisable"); + // App.Tap("Allen"); + // App.WaitForNoElement("You tapped Allen"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla36955.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla36955.cs index cabe285c44cb..1fa868f533cf 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla36955.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla36955.cs @@ -1,28 +1,28 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla36955 : _IssuesUITest -// { -// public Bugzilla36955(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla36955 : _IssuesUITest +{ + public Bugzilla36955(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "[iOS] ViewCellRenderer.UpdateIsEnabled referencing null object"; + public override string Issue => "[iOS] ViewCellRenderer.UpdateIsEnabled referencing null object"; -// // TODO from Xamarin.UITest Migration, seems to be ignored already -// // Also uses some specific XamUITest APIs that we need to find counterparts for -// [Ignore("Test failing due to unrelated issue, disable for moment")] -// [Category(UITestCategories.TableView)] -// [Test] -// public void Bugzilla36955Test() -// { -// AppResult[] buttonFalse = RunningApp.Query(q => q.Button().Text("False")); -// Assert.AreEqual(buttonFalse.Length == 1, true); -// RunningApp.Tap(q => q.Class("Switch")); -// AppResult[] buttonTrue = RunningApp.Query(q => q.Button().Text("True")); -// Assert.AreEqual(buttonTrue.Length == 1, true); -// } -// } \ No newline at end of file + // TODO from Xamarin.UITest Migration, seems to be ignored already + // Also uses some specific XamUITest APIs that we need to find counterparts for + // [Ignore("Test failing due to unrelated issue, disable for moment")] + // [Category(UITestCategories.TableView)] + // [Test] + // public void Bugzilla36955Test() + // { + // AppResult[] buttonFalse = RunningApp.Query(q => q.Button().Text("False")); + // Assert.AreEqual(buttonFalse.Length == 1, true); + // RunningApp.Tap(q => q.Class("Switch")); + // AppResult[] buttonTrue = RunningApp.Query(q => q.Button().Text("True")); + // Assert.AreEqual(buttonTrue.Length == 1, true); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla37462.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla37462.cs index 6a8deea6d753..49fe781e372f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla37462.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla37462.cs @@ -1,38 +1,38 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; - -// namespace Microsoft.Maui.TestCases.Tests.Issues; - -// public class Bugzilla37462 : _IssuesUITest -// { -// public Bugzilla37462(TestDevice testDevice) : base(testDevice) -// { -// } - -// public override string Issue => "Using App Compat/App Compat theme breaks Navigation.RemovePage on Android "; - -// [Test] -// [Category(UITestCategories.Navigation)] -// public void CanRemoveIntermediatePagesAndPopToFirstPage () -// { -// // Start at page 1 -// App.WaitForElement ("Go To 2"); -// App.WaitForElement ("This is a label on page 1"); -// App.Tap ("Go To 2"); - -// App.WaitForElement ("Go To 3"); -// App.Tap ("Go To 3"); - -// App.WaitForElement ("Go To 4"); -// App.Tap ("Go To 4"); - -// App.WaitForElement ("Back to 1"); -// App.Tap ("Back to 1"); - -// // Clicking "Back to 1" should remove pages 2 and 3 from the stack -// // Then call PopAsync, which should return to page 1 -// App.WaitForElement ("Go To 2"); -// App.WaitForElement ("This is a label on page 1"); -// } -// } \ No newline at end of file +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla37462 : _IssuesUITest +{ + public Bugzilla37462(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Using App Compat/App Compat theme breaks Navigation.RemovePage on Android "; + + // [Test] + // [Category(UITestCategories.Navigation)] + // public void CanRemoveIntermediatePagesAndPopToFirstPage () + // { + // // Start at page 1 + // App.WaitForElement ("Go To 2"); + // App.WaitForElement ("This is a label on page 1"); + // App.Tap ("Go To 2"); + + // App.WaitForElement ("Go To 3"); + // App.Tap ("Go To 3"); + + // App.WaitForElement ("Go To 4"); + // App.Tap ("Go To 4"); + + // App.WaitForElement ("Back to 1"); + // App.Tap ("Back to 1"); + + // // Clicking "Back to 1" should remove pages 2 and 3 from the stack + // // Then call PopAsync, which should return to page 1 + // App.WaitForElement ("Go To 2"); + // App.WaitForElement ("This is a label on page 1"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla37841.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla37841.cs index 69053b3cbd42..d292f0df0b84 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla37841.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla37841.cs @@ -1,34 +1,34 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla37841 : _IssuesUITest -// { -// public Bugzilla37841(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla37841 : _IssuesUITest +{ + public Bugzilla37841(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "TableView EntryCells and TextCells cease to update after focus change"; + public override string Issue => "TableView EntryCells and TextCells cease to update after focus change"; -// [Test] -// [Category(UITestCategories.TableView)] -// [FailsOnIOS] -// public void TextAndEntryCellsDataBindInTableView() -// { -// App.WaitForElement("Generate"); -// App.Tap("Generate"); + // [Test] + // [Category(UITestCategories.TableView)] + // [FailsOnIOS] + // public void TextAndEntryCellsDataBindInTableView() + // { + // App.WaitForElement("Generate"); + // App.Tap("Generate"); -// App.Screenshot("First Generate Tap"); + // App.Screenshot("First Generate Tap"); -// App.WaitForTextToBePresentInElement("entrycell", "12345"); -// App.WaitForTextToBePresentInElement("textcell", "6789"); -// App.Tap("Generate"); + // App.WaitForTextToBePresentInElement("entrycell", "12345"); + // App.WaitForTextToBePresentInElement("textcell", "6789"); + // App.Tap("Generate"); -// App.Screenshot("Second Generate Tap"); + // App.Screenshot("Second Generate Tap"); -// App.WaitForTextToBePresentInElement("entrycell", "112358"); -// App.WaitForTextToBePresentInElement("textcell", "48151623"); -// } -// } \ No newline at end of file + // App.WaitForTextToBePresentInElement("entrycell", "112358"); + // App.WaitForTextToBePresentInElement("textcell", "48151623"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38112.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38112.cs index 9d6f1cf0eed0..39635378e0a3 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38112.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38112.cs @@ -1,38 +1,38 @@ -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// [Category(UITestCategories.TableView)] -// public class Bugzilla38112 : _IssuesUITest -// { -// public Bugzilla38112(TestDevice testDevice) : base(testDevice) -// { -// } +[Category(UITestCategories.TableView)] +public class Bugzilla38112 : _IssuesUITest +{ + public Bugzilla38112(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "Switch becomes reenabled when previous ViewCell is removed from TableView"; + public override string Issue => "Switch becomes reenabled when previous ViewCell is removed from TableView"; -// // TODO from Xamarin.UITest migration, test fails, look into it later -// [Test] -// [FailsOnIOS] -// public void Bugzilla38112_SwitchIsStillOnScreen () -// { -// App.WaitForElement("Click"); -// App.Tap("Click"); -// App.WaitForElement("switch3"); -// } + // TODO from Xamarin.UITest migration, test fails, look into it later + // [Test] + // [FailsOnIOS] + // public void Bugzilla38112_SwitchIsStillOnScreen () + // { + // App.WaitForElement("Click"); + // App.Tap("Click"); + // App.WaitForElement("switch3"); + // } -// [Test] -// [FailsOnIOS] -// public void Bugzilla38112_SwitchIsStillDisabled () -// { -// App.WaitForElement("Click"); -// App.Tap("Click"); -// App.WaitForElement("switch3"); -// App.Tap("switch3"); -// App.WaitForNoElement("FAIL"); -// Assert.That(App.FindElement("resultlabel").GetText()?.Equals("FAIL", -// StringComparison.OrdinalIgnoreCase), Is.False); -// } -// } \ No newline at end of file + // [Test] + // [FailsOnIOS] + // public void Bugzilla38112_SwitchIsStillDisabled () + // { + // App.WaitForElement("Click"); + // App.Tap("Click"); + // App.WaitForElement("switch3"); + // App.Tap("switch3"); + // App.WaitForNoElement("FAIL"); + // Assert.That(App.FindElement("resultlabel").GetText()?.Equals("FAIL", + // StringComparison.OrdinalIgnoreCase), Is.False); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38731.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38731.cs index 38f8b6fec9f1..6f4696522a56 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38731.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38731.cs @@ -1,36 +1,36 @@ -// #if IOS -// using NUnit.Framework; -// using UITest.Appium; -// using UITest.Core; +#if IOS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; -// namespace Microsoft.Maui.TestCases.Tests.Issues; +namespace Microsoft.Maui.TestCases.Tests.Issues; -// public class Bugzilla38731 : _IssuesUITest -// { -// public Bugzilla38731(TestDevice testDevice) : base(testDevice) -// { -// } +public class Bugzilla38731 : _IssuesUITest +{ + public Bugzilla38731(TestDevice testDevice) : base(testDevice) + { + } -// public override string Issue => "iOS.NavigationRenderer.GetAppearedOrDisappearedTask NullReferenceExceptionObject"; + public override string Issue => "iOS.NavigationRenderer.GetAppearedOrDisappearedTask NullReferenceExceptionObject"; -// [Test] -// [Category(UITestCategories.Navigation)] -// [FailsOnIOS] -// public void Bugzilla38731Test () -// { -// App.WaitForElement("btn1"); -// App.Tap("btn1"); + // [Test] + // [Category(UITestCategories.Navigation)] + // [FailsOnIOS] + // public void Bugzilla38731Test () + // { + // App.WaitForElement("btn1"); + // App.Tap("btn1"); -// App.WaitForElement("btn2"); -// App.Tap("btn2"); + // App.WaitForElement("btn2"); + // App.Tap("btn2"); -// App.WaitForElement("btn3"); -// App.Tap("btn3"); + // App.WaitForElement("btn3"); + // App.Tap("btn3"); -// App.Back(); -// App.Back(); -// App.Back(); -// App.Back(); -// } -// } -// #endif \ No newline at end of file + // App.Back(); + // App.Back(); + // App.Back(); + // App.Back(); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38978.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38978.cs new file mode 100644 index 000000000000..9fcde26a59cc --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla38978.cs @@ -0,0 +1,24 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla38978 : _IssuesUITest +{ + public Bugzilla38978(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Cell.ForceUpdateSize issues with row selection/deselection (ViewCell)"; + + // [Test] + // [FailsOnIOS] + // [Category(UITestCategories.ManualReview)] + // public void Bugzilla38978Test () + // { + // App.WaitForElement("2"); + // App.Tap("2"); + // App.Screenshot("If the tapped image is not larger, this test has failed."); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla39331.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla39331.cs new file mode 100644 index 000000000000..f3af77a96efe --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla39331.cs @@ -0,0 +1,32 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla39331 : _IssuesUITest +{ + public Bugzilla39331(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Android] BoxView Is InputTransparent Even When Set to False"; + + // [FailsOnAndroid] + // [FailsOnIOS] + // [Test] + // [Category(UITestCategories.InputTransparent)] + // public void Bugzilla39331Test() + // { + // App.WaitForElement("btnLogin"); + // App.Tap("btnLogin"); + + // App.WaitForTextToBePresentInElement("btnLogin", "Blocked?"); + + // App.Tap("btnLogin"); + + // Assert.That(App.FindElement("btnLogin").GetText()? + // .Equals("Guess Not", StringComparison.OrdinalIgnoreCase), + // Is.False); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla39530.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla39530.cs new file mode 100644 index 000000000000..4d278091d144 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla39530.cs @@ -0,0 +1,58 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.Gestures)] +public class Bugzilla39530 : _IssuesUITest +{ + public Bugzilla39530(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Frames do not handle pan or pinch gestures under AppCompat"; + +// TODO From Xamarin.UITest migration: does some advanced XamUITest operations +// Need to find Appium equivalents +// [Test] +// #if __MACOS__ +// [Ignore("UITest.Desktop doesn't return empty NSView yet so it can't find the frame")] +// #endif +// [FailsOnIOS] +// public void Bugzilla39530PanTest() +// { +// // Got to wait for the element to be visible to the UI test framework, otherwise we get occasional +// // index out of bounds exceptions if the query for the frame and its Rect run quickly enough +// App.WaitForElement(q => q.Marked("frame")); +// AppRect frameBounds = App.Query (q => q.Marked ("frame"))[0].Rect; +// App.Pan (new Drag (frameBounds, frameBounds.CenterX, frameBounds.Y + 10, frameBounds.X + 100, frameBounds.Y + 100, Drag.Direction.LeftToRight)); + +// App.WaitForElement (q => q.Marked ("Panning: Completed")); +// } + +// [Test] +// #if __MACOS__ +// [Ignore("UITest.Desktop doesn't return empty NSView yet so it can't find the frame")] +// #endif +// [FailsOnIOS] +// public void Bugzilla39530PinchTest() +// { +// App.PinchToZoomIn ("frame"); +// App.WaitForElement(q => q.Marked("Pinching: Completed")); +// } + +// [Test] +// #if __MACOS__ +// [Ignore("UITest.Desktop doesn't return empty NSView yet so it can't find the frame")] +// #endif +// [FailsOnIOS] +// public void Bugzilla39530TapTest() +// { +// App.WaitForElement (q => q.Marked ("frame")); +// App.Tap ("frame"); +// App.WaitForElement (q => q.Marked ("Taps: 1")); +// App.Tap ("frame"); +// App.WaitForElement (q => q.Marked ("Taps: 2")); +// } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40092.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40092.cs new file mode 100644 index 000000000000..35bfe3b34550 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40092.cs @@ -0,0 +1,31 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla40092 : _IssuesUITest +{ + public Bugzilla40092(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Ensure android devices with fractional scale factors (3.5) don't have a white line around the border"; + + // TODO: From Xamarin.UITest migration. + // Does some advanced commands to determine layouts, need to find the equivalent on Appium + // [Test] + // [Category(UITestCategories.BoxView)] + // public void AllScreenIsBlack() + // { + // App.WaitForElement(Ok); + // App.Tap(Ok); + // var box = App.WaitForElement(Black)[0]; + // var layout = App.WaitForElement(White)[0]; + + // var assert = box.Rect.Height == layout.Rect.Height && + // box.Rect.Width == layout.Rect.Width; + + // Assert.IsTrue(assert); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40161.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40161.cs new file mode 100644 index 000000000000..355502365778 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40161.cs @@ -0,0 +1,33 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla40161 : _IssuesUITest +{ + public Bugzilla40161(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Issue Bugzilla40161"; + + // [Test] + // [Category(UITestCategories.Layout)] + // [FailsOnIOS] + // public void Issue1Test() + // { + // App.Screenshot("I am at Issue 40161"); + // App.WaitForElement("REFRESH"); + // App.Screenshot("I see the first image"); + + // App.Tap("SWAP"); + // App.Tap("REFRESH"); + + // App.WaitForTextToBePresentInElement("counter", "step=0"); + + // App.Screenshot("I swap the image"); + + // App.WaitForTextToBePresentInElement("width", "w=50"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40173.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40173.cs new file mode 100644 index 000000000000..fe81bfdfb06a --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40173.cs @@ -0,0 +1,35 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla40173 : _IssuesUITest +{ + public Bugzilla40173(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Android BoxView/Frame not clickthrough in ListView"; + +// [FailsOnAndroid] +// [FailsOnIOS] +// [Test] +// [Category(UITestCategories.InputTransparent)] +// public void ButtonBlocked() +// { +// App.Tap("CantTouchButtonId"); + +// Assert.That(App.FindElement("outputlabel").GetText()? +// .Equals("Failed", StringComparison.OrdinalIgnoreCase), +// Is.False); + +// App.Tap("CanTouchButtonId"); + +// App.WaitForTextToBePresentInElement("outputlabel", "ButtonTapped"); +// #if !__MACOS__ +// App.Tap("ListTapTarget"); +// App.WaitForTextToBePresentInElement("outputlabel", "ItemTapped"); +// #endif +// } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40333.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40333.cs new file mode 100644 index 000000000000..5d1c2d96731a --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40333.cs @@ -0,0 +1,43 @@ +#if __ANDROID__ // These tests don't work in iOS for unrelated reasons (see https://bugzilla.xamarin.com/show_bug.cgi?id=41085) +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.FlyoutPage)] +public class Bugzilla40333 : _IssuesUITest +{ + public Bugzilla40333(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Android] IllegalStateException: Recursive entry to executePendingTransactions"; + + // [Test] + // public void ClickingOnMenuItemInRootDoesNotCrash_NavPageVersion() + // { + // App.Tap("StartNavPageTest"); + // App.WaitForElement("OpenRoot"); + + // App.Tap("OpenRoot"); + // App.WaitForElement("ClickThisId"); + + // App.Tap("ClickThisId"); + // App.WaitForElement("StillHereId"); // If the bug isn't fixed, the app will have crashed by now + // } + + // [Test] + // public void ClickingOnMenuItemInRootDoesNotCrash_TabPageVersion() + // { + // App.Tap("StartTabPageTest"); + // App.WaitForElement("OpenRoot"); + + // App.Tap("OpenRoot"); + // App.WaitForElement("ClickThisId"); + + // App.Tap("ClickThisId"); + // App.WaitForElement("StillHereId"); // If the bug isn't fixed, the app will have crashed by now + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40704.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40704.cs new file mode 100644 index 000000000000..29dc2100ec62 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40704.cs @@ -0,0 +1,43 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.ListView)] +public class Bugzilla40704 : _IssuesUITest +{ + public Bugzilla40704(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Strange duplication of listview headers when collapsing/expanding sections"; + + // [FailsOnIOS] + // [Test] + // public void Bugzilla40704HeaderPresentTest() + // { + // App.WaitForElement("Menu - 0"); + // } + + // [FailsOnAndroid] + // [FailsOnIOS] + // [Test] + // public void Bugzilla40704Test() + // { + // App.ScrollDown("btnCollapse", ScrollStrategy.Gesture, 0.9, 500); + // App.Tap("btnCollapse"); + // Task.Delay(1000).Wait(); // Let the layout settle down + + // App.ScrollDown("btnCollapse", ScrollStrategy.Gesture, 0.9, 500); + // App.Tap("btnCollapse"); + // Task.Delay(1000).Wait(); // Let the layout settle down + + // App.ScrollDown("btnCollapse", ScrollStrategy.Gesture, 0.9, 500); + // App.Tap("btnCollapse"); + + // App.WaitForElement("Menu - 2"); + // App.WaitForElement("Menu - 1"); + // App.WaitForElement("Menu - 0"); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40858.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40858.cs new file mode 100644 index 000000000000..9d89902730f7 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40858.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla40858 : _IssuesUITest +{ + public Bugzilla40858(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Long clicking a text entry in a ListView header/footer cause a crash"; + + // [Test] + // [Category(UITestCategories.ListView)] + // public void ListViewDoesNotCrashOnTextEntryHeaderOrFooterLongClick() + // { + // App.TouchAndHold("Header"); + // App.TouchAndHold("Footer"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40955.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40955.cs new file mode 100644 index 000000000000..eada927d0244 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla40955.cs @@ -0,0 +1,33 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla40955 : _IssuesUITest +{ + public Bugzilla40955(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Memory leak with FormsAppCompatActivity and NavigationPage"; + + // TODO from Xamarin.UITest migration + // Needs some refactoring to use AutomationIds + // [Test] + // [Category(UITestCategories.Performance)] + // public void MemoryLeakInFormsAppCompatActivity() + // { + // App.WaitForElement(Page1Title); + // App.Tap(LabelPage1); + // App.WaitForElement(Page1Title); + // App.Tap(Page2Title); + // App.WaitForElement(LabelPage2); + // App.Tap(LabelPage2); + // App.WaitForElement(Page2Title); + // App.Tap(Page3Title); + // App.WaitForElement(LabelPage3); + // App.Tap(LabelPage3); + // App.WaitForElement(Success); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41038.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41038.cs new file mode 100644 index 000000000000..e6841c108583 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41038.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla41038 : _IssuesUITest +{ + public Bugzilla41038(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "FlyoutPage loses menu icon on iOS after reusing NavigationPage as Detail"; + + // TODO Xamarin.UITest migration how do we open flyout menu?! + // [Test] + // [Category(UITestCategories.FlyoutPage)] + // public void Bugzilla41038Test() + // { + // App.WaitForElement("ViewA"); + // App.Tap("Flyout"); + // App.WaitForElement("ViewB"); + // App.Tap("ViewB"); + // App.WaitForElement("Flyout"); + // App.Screenshot("I see the flyout toggle"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41153.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41153.cs new file mode 100644 index 000000000000..88c4671900f0 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41153.cs @@ -0,0 +1,30 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla41153 : _IssuesUITest +{ + public Bugzilla41153(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "jobject must not be IntPtr.Zero with TabbedPage and ToolbarItems"; + + // [FailsOnAndroid("Times out on WaitForElement(On Tab 1)")] + // [Test] + // [Category(UITestCategories.TabbedPage)] + // public void Bugzilla41153Test() + // { + // App.WaitForElement("On Tab 1"); + // App.Tap("Tab 2"); + // App.Tap("Tab 3"); + // App.WaitForElement("On Tab 3"); + // App.Tap("Tab 1"); + // App.WaitForElement("On Tab 1"); + // App.Tap("Toolbar Item"); + + // App.WaitForTextToBePresentInElement("Toolbar Item", "Success"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41271.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41271.cs new file mode 100644 index 000000000000..5107f552cb51 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41271.cs @@ -0,0 +1,35 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla41271 : _IssuesUITest +{ + public Bugzilla41271(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[UWP] Memory Leak from ListView in TabbedPage"; + + string _cell = string.Empty; + + // [Test] + // [Category(UITestCategories.ListView)] + // public void MemoryLeakInListViewTabbedPageUWP() + // { + // _cell = "California #60"; + // for (int i = 1; i <= 10; i++) + // { + // ScrollListInPage($"List {i}"); + // } + // } + + void ScrollListInPage(string tabName) + { + App.WaitForElement(tabName); + App.Tap(tabName); + App.ScrollDown(_cell, ScrollStrategy.Programmatically, 0.7); + App.ScrollUp("California #1", ScrollStrategy.Programmatically, 0.7); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41424.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41424.cs new file mode 100644 index 000000000000..a01b604c0902 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla41424.cs @@ -0,0 +1,55 @@ +#if ANDROID +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla41424 : _IssuesUITest +{ + public Bugzilla41424(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Android] Clicking cancel on a DatePicker does not cause it to unfocus"; + + // TODO from Xamarin.UITest migration: replace DialogIsOpened calls with another way of detecting the dialog + // Maybe see Bugzilla42074 which seems to do the same? + // [FailsOnAndroid] + // [Test] + // [Category(UITestCategories.DatePicker)] + // public void DatePickerCancelShouldUnfocus() + // { + // App.Tap("DatePicker"); + // //Assert.IsTrue(DialogIsOpened(),"Tap Picker"); + + // App.WaitForElement("getfocusstate"); + // App.Tap("getfocusstate"); + // App.WaitForElement("focusstate", "unfocused"); + + // App.Tap("Click to focus DatePicker"); + // //Assert.IsTrue(DialogIsOpened(),"Call Focus Picker"); + + // App.WaitForElement("getfocusstate"); + // App.Tap("getfocusstate"); + // App.WaitForTextToBePresentInElement("focusstate", "unfocused"); + // } + + // bool DialogIsOpened() + // { + // Thread.Sleep(1500); + // var frameLayouts = App.Query(q => q.Class("FrameLayout"); + // foreach (var layout in frameLayouts) + // { + // if (layout.Rect.X > 0 && layout.Rect.Y > 0 && layout.Description.Contains(@"id/content")) + // { + // // close dialog + // App.Back(); + // Thread.Sleep(1500); + // return true; + // } + // } + // return false; + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla42074.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla42074.cs new file mode 100644 index 000000000000..e4bd2486edd6 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla42074.cs @@ -0,0 +1,30 @@ +#if ANDROID +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla42074 : _IssuesUITest +{ + public Bugzilla42074(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Android] Clicking cancel on a TimePicker does not cause it to unfocus"; + + // [FailsOnAndroid] + // [Test] + // [Category(UITestCategories.TimePicker)] + // public void TimePickerCancelShouldUnfocus() + // { + // App.Tap("TimePicker"); + + // App.Back(); + // App.WaitForElement("focusbtn"); + + // App.Tap("focusbtn"); + // App.Back(); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla42329.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla42329.cs new file mode 100644 index 000000000000..d4ade32f7d55 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla42329.cs @@ -0,0 +1,38 @@ +#if ANDROID +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla42329 : _IssuesUITest +{ + const string Page1Title = "Page1"; + const string Page2Title = "Page2"; + const string Page3Title = "Page3"; + const string LabelPage1 = "Open the drawer menu and select Page2"; + const string LabelPage2 = "Open the drawer menu and select Page3"; + + public Bugzilla42329(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ListView in Frame and FormsAppCompatActivity Memory Leak"; + + // TODO From Xamarin.UITest migration: test fails, so disabled for now + // [Test] + // [Category(UITestCategories.ListView)] + // public void MemoryLeakB42329() + // { + // App.WaitForElement(Page1Title); + // App.Tap(LabelPage1); + // App.WaitForElement(Page1Title); + // App.Tap(Page2Title); + // App.WaitForElement(LabelPage2); + // App.Tap(LabelPage2); + // App.WaitForElement(Page2Title); + // App.Tap(Page3Title); + // App.WaitForElement("Destructor called"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla42832.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla42832.cs new file mode 100644 index 000000000000..39207e13f1c9 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla42832.cs @@ -0,0 +1,35 @@ +#if ANDROID +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla42832 : _IssuesUITest +{ + public Bugzilla42832(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Scrolling a ListView with active ContextAction Items causes NRE"; + + // TODO From Xamarin.UITest migration: test failed + // [Test] + // [Category(UITestCategories.ListView)] + // public void ContextActionsScrollNRE() + // { + // App.TouchAndHold("Item #0"); + // App.WaitForElement("Test Item"); + + // int counter = 0; + // while(counter < 5) + // { + // App.ScrollDown("Item #15", ScrollStrategy.Gesture); + // App.ScrollUp("Item #0", ScrollStrategy.Gesture); + // counter++; + // } + + // App.Screenshot("If the app did not crash, then the test has passed."); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43161.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43161.cs new file mode 100644 index 000000000000..b81185085dc5 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43161.cs @@ -0,0 +1,27 @@ +#if IOS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla43161 : _IssuesUITest +{ + + public Bugzilla43161(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[iOS] Setting Accessory in ViewCellRenderer breaks layout"; + + // [Test] + // [Category(UITestCategories.Cells)] + // [FailsOnIOS] + // public void Bugzilla43161Test() + // { + // App.WaitForElement("0"); + // App.WaitForElement("10"); + // App.WaitForElement("20"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43469.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43469.cs new file mode 100644 index 000000000000..b92f2fd5691f --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43469.cs @@ -0,0 +1,40 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla43469 : _IssuesUITest +{ + + public Bugzilla43469(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Calling DisplayAlert twice in WinRT causes a crash"; + + // TODO From Xamarin.UITest Migration: test fails. Maybe we need to wait on the alert? + // [Test] + // [Category(UITestCategories.DisplayAlert)] + // [FailsOnIOS] + // public async Task Bugzilla43469Test() + // { + // App.WaitForElement("kButton"); + // App.Tap("kButton"); + // Assert.That(App.GetAlert()?.GetAlertText(), Is.EqualTo("First")); + // App.GetAlert()?.DismissAlert(); + // Assert.That(App.GetAlert()?.GetAlertText(), Is.EqualTo("Second")); + // App.GetAlert()?.DismissAlert(); + // Assert.That(App.GetAlert()?.GetAlertText(), Is.EqualTo("Three")); + // App.GetAlert()?.DismissAlert(); + + // await Task.Delay(100); + // App.GetAlert()?.DismissAlert(); + // await Task.Delay(100); + // App.GetAlert()?.DismissAlert(); + // await Task.Delay(100); + // App.GetAlert()?.DismissAlert(); + // await Task.Delay(100); + // App.WaitForElement("kButton"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43527.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43527.cs new file mode 100644 index 000000000000..97f13f071f60 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43527.cs @@ -0,0 +1,29 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla43527 : _IssuesUITest +{ + + public Bugzilla43527(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[UWP] Detail title does not update when wrapped in a NavigationPage"; + + // [Test] + // [Category(UITestCategories.FlyoutPage)] + // public void TestB43527UpdateTitle() + // { + // // TODO from Xamarin.UITest migration + // // I'm not sure if this actually verifies the functionality here + // // we might need to add a VerifyScreenshot for this + // // And test is failing so disabled for now + // App.WaitForElement("Change Title"); + // App.WaitForElement("Test Page"); + // App.Tap("Change Title"); + // App.WaitForNoElement("Test Page"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43663.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43663.cs new file mode 100644 index 000000000000..6014bba055ec --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43663.cs @@ -0,0 +1,43 @@ +#if WINDOWS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla43663 : _IssuesUITest +{ + const string PushModal = "Push Modal"; + + const string PopModal = "Pop Modal"; + + const string Modal = "Modal"; + + public Bugzilla43663(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ModalPushed and ModalPopped not working on WinRT"; + + // [Test] + // [Category(UITestCategories.Navigation)] + // public void ModalNavigation() + // { + // var i = 0; + // while(App.GetAlerts().Count == 0 && i < 3) + // { + // i++; + // Task.Delay(1000); + // } + + // App.GetAlert()?.DismissAlert(); + // App.WaitForElement(PushModal); + // App.Tap(PushModal); + // App.GetAlert()?.DismissAlert(); + // App.WaitForElement(Modal); + // App.Tap(PopModal); + // App.GetAlert()?.DismissAlert(); + // App.WaitForElement(PushModal); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43941.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43941.cs new file mode 100644 index 000000000000..b4895083dba8 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla43941.cs @@ -0,0 +1,43 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla43941 : _IssuesUITest +{ + public Bugzilla43941(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Memory leak with ListView's RecycleElement on iOS"; + + // [FailsOnAndroid] + // [Test] + // [Category(UITestCategories.ListView)] + // public void Bugzilla43941Test() + // { + // for (var n = 0; n < 10; n++) + // { + // App.WaitForElement("Push"); + // App.Tap("Push"); + + // App.WaitForElement("ListView"); + // App.Back(); + // } + + // // At this point, the counter can be any value, but it's most likely not zero. + // // Invoking GC once is enough to clean up all garbage data and set counter to zero + // App.WaitForElement("GC"); + + // var i = 0; + // while (!App.FindElement("counterlabel")?.GetText()?.Equals("Counter: 0", + // StringComparison.OrdinalIgnoreCase) ?? false && i < 10) + // { + // i++; + // Task.Delay(2000); + + // App.Tap("GC"); + // } + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44044.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44044.cs new file mode 100644 index 000000000000..4d2dc065283f --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44044.cs @@ -0,0 +1,39 @@ +#if ANDROID +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla44044 : _IssuesUITest +{ + //string _btnToggleSwipe = "btnToggleSwipe"; + //string _btnDisplayAlert = "btnDisplayAlert"; + + public Bugzilla44044(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "TabbedPage steals swipe gestures"; + + // [Test] + // [Category(UITestCategories.TabbedPage)] + // public void Bugzilla44044Test() + // { + // App.WaitForElement(_btnToggleSwipe); + + // App.SwipeRightToLeft(); + // App.WaitForNoElement(_btnToggleSwipe); + // App.WaitForElement(_btnDisplayAlert); + + // App.SwipeLeftToRight(); + // App.WaitForNoElement(_btnDisplayAlert); + // App.WaitForElement(_btnToggleSwipe); + + // App.Tap(_btnToggleSwipe); + // App.SwipeRightToLeft(); + // App.WaitForNoElement(_btnDisplayAlert); + // App.WaitForElement(_btnToggleSwipe); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44129.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44129.cs new file mode 100644 index 000000000000..f4fa108eafc9 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44129.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla44129 : _IssuesUITest +{ + + public Bugzilla44129(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Crash when adding tabbed page after removing all pages using DataTemplates"; + + // [Test] + // [Category(UITestCategories.TabbedPage)] + // public void Issue44129Test() + // { + // App.Screenshot("I am at Issue 1"); + // App.WaitForElement("First"); + // App.Screenshot("I see the Label"); + // App.WaitForElement("Second"); + // App.Tap("Second"); + // App.Tap("Crash Me"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44166.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44166.cs new file mode 100644 index 000000000000..117c9b3ce3ff --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44166.cs @@ -0,0 +1,64 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla44166 : _IssuesUITest +{ + + public Bugzilla44166(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "FlyoutPage instances do not get disposed upon GC"; + + // TODO From Xamarin.UITest Migration: this test references elements directly, needs to be rewritten + // [Test] + // [Category(UITestCategories.Performance)] + // [FailsOnIOS] + // public void Bugzilla44166Test() + // { + // App.WaitForElement("Go"); + // App.Tap("Go"); + + // App.WaitForElement("Previous"); + // App.Tap("Previous"); + + // App.WaitForElement("GC"); + + // for (var n = 0; n < 10; n++) + // { + // App.Tap("GC"); + + // if (App.FindElements(("Success")).Count > 0) + // { + // return; + // } + // } + + // string pageStats = string.Empty; + + // if (_44166MDP.Counter > 0) + // { + // pageStats += $"{_44166MDP.Counter} {nameof(_44166MDP)} allocated; "; + // } + + // if (_44166Master.Counter > 0) + // { + // pageStats += $"{_44166Master.Counter} {nameof(_44166Master)} allocated; "; + // } + + // if (_44166Detail.Counter > 0) + // { + // pageStats += $"{_44166Detail.Counter} {nameof(_44166Detail)} allocated; "; + // } + + // if (_44166NavContent.Counter > 0) + // { + // pageStats += $"{_44166NavContent.Counter} {nameof(_44166NavContent)} allocated; "; + // } + + // Assert.Fail($"At least one of the pages was not collected: {pageStats}"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44338.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44338.cs new file mode 100644 index 000000000000..407244cc06af --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44338.cs @@ -0,0 +1,35 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.Cells)] +public class Bugzilla44338 : _IssuesUITest +{ + + public Bugzilla44338(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Tapping off of a cell with an open context action causes a crash in iOS 10"; + +// #if IOS +// [Test] +// [FailsOnIOS] +// public void Bugzilla44338Test() +// { +// App.SwipeRightToLeft("A"); +// App.Tap("C"); +// } +// #endif + +// #if ANDROID +// [Test] +// public void Bugzilla44338Test() +// { +// App.TouchAndHold("A"); +// App.Tap("C"); +// } +// #endif +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44886.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44886.cs new file mode 100644 index 000000000000..80ee7253a486 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla44886.cs @@ -0,0 +1,29 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla44886 : _IssuesUITest +{ + const string CountId = "countId"; + + public Bugzilla44886(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "UWP Listview ItemSelected event triggered twice for each selection"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Bugzilla44886Test() + // { + // App.WaitForElement("Item 1"); + // App.Tap("Item 1"); + + // int count = int.Parse(App.FindElement(CountId)?.GetText() ?? "0"); + + // Assert.That(count, Is.EqualTo(1)); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45027.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45027.cs new file mode 100644 index 000000000000..3dc863e4b968 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45027.cs @@ -0,0 +1,52 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.ListView)] +public class Bugzilla45027 : _IssuesUITest +{ + const string BUTTON_ACTION_TEXT = "Action"; + const string BUTTON_DELETE_TEXT = "Delete"; + public Bugzilla45027(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "App crashes when double tapping on ToolbarItem or MenuItem very quickly"; + +// #if ANDROID +// [Test] +// public void Bugzilla45027Test() +// { +// var firstItemList = "0"; +// App.WaitForElement(firstItemList); + +// App.TouchAndHold(firstItemList); +// App.WaitForElement(BUTTON_ACTION_TEXT); +// App.DoubleTap(BUTTON_ACTION_TEXT); + +// App.TouchAndHold(firstItemList); +// App.WaitForElement(BUTTON_DELETE_TEXT); +// App.DoubleTap(BUTTON_DELETE_TEXT); +// } +// #endif + +// #if IOS +// [Test] +// [FailsOnIOS] +// public void Bugzilla45027Test() +// { +// var firstItemList = "0"; +// App.WaitForElement(firstItemList); + +// App.SwipeRightToLeft(firstItemList); +// App.WaitForElement(BUTTON_ACTION_TEXT); +// App.DoubleTap(BUTTON_ACTION_TEXT); + +// App.SwipeRightToLeft(firstItemList); +// App.WaitForElement(BUTTON_DELETE_TEXT); +// App.DoubleTap(BUTTON_DELETE_TEXT); +// } +// #endif +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45125.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45125.cs new file mode 100644 index 000000000000..831d76a6befc --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45125.cs @@ -0,0 +1,48 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; +public class Bugzilla45125 : _IssuesUITest +{ + const string AppearingLabelId = "appearing"; + const string DisappearingLabelId = "disappearing"; + const string TestButtonId = "TestButtonId"; + + public Bugzilla45125(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ListView lacks a way to get information about visible elements (such as FirstVisibleItem) to restore visual positions of elements"; + + // TODO From Xamarin.UITest migration: test references variable in UI, needs to be refactored + // [FailsOnAndroid] + // [FailsOnIOS] + // [Test] + // public void Bugzilla45125Test() + // { + // RunTest(); + + // App.Tap(TestButtonId); + // RunTest(); + + // App.Tap(TestButtonId); + // RunTest(); + + // App.Tap(TestButtonId); + // RunTest(); + // } + + // void RunTest() + // { + // App.WaitForElement(AppearingLabelId); + // App.WaitForElement(DisappearingLabelId); + + // App.Screenshot("There should be appearing and disappearing events for the Groups and Items."); + // var appearing = int.Parse(App.FindElement(AppearingLabelId)?.GetText() ?? "0"); + // var disappearing = int.Parse(App.FindElement(DisappearingLabelId)?.GetText() ?? "0"); + + // Assert.That(appearing, Is.GreaterThan(0), $"Test {_TestNumber}: No appearing events for groups found."); + // Assert.That(disappearing, Is.GreaterThan(0), $"Test {_TestNumber}: No disappearing events for groups found."); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45743.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45743.cs new file mode 100644 index 000000000000..7937099b83de --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45743.cs @@ -0,0 +1,29 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla45743 : _IssuesUITest +{ + public Bugzilla45743(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[iOS] Calling DisplayAlert via BeginInvokeOnMainThread blocking other calls on iOS"; + + // TODO From Xamarin.UITest Migration: needs better way to detect actionsheet + // [Test] + // [Category(UITestCategories.DisplayAlert)] + // [FailsOnIOS] + // public void Bugzilla45743Test() + // { + // App.WaitForElement("ActionSheet Title"); + // App.Tap("Close"); + // App.WaitForElement("Title 2"); + // App.Tap("Accept"); + // App.WaitForElement("Title"); + // App.Tap("Accept"); + // Assert.That(App.FindElements("Page 2").Count, Is.GreaterThan(0)); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45926.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45926.cs new file mode 100644 index 000000000000..f3e554441e65 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla45926.cs @@ -0,0 +1,35 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla45926 : _IssuesUITest +{ + public Bugzilla45926(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Effect not attaching to ScrollView"; + + // TODO Xamarin.UITest Migration + // [Test] + // [FailsOnAndroid] + // public void Issue45926Test() + // { + // RunningApp.WaitForElement(q => q.Marked("New Page")); + + // RunningApp.Tap(q => q.Marked("New Page")); + // RunningApp.WaitForElement(q => q.Marked("Second Page #1")); + // RunningApp.Back(); + // RunningApp.WaitForElement(q => q.Marked("Intermediate Page")); + // RunningApp.Back(); + // RunningApp.Tap(q => q.Marked("Do GC")); + // RunningApp.Tap(q => q.Marked("Do GC")); + // RunningApp.Tap(q => q.Marked("Send Message")); + // RunningApp.Tap(q => q.Marked("Do GC")); + + // RunningApp.WaitForElement(q => q.Marked("Instances: 0")); + // RunningApp.WaitForElement(q => q.Marked("Messages: 0")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla46363.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla46363.cs new file mode 100644 index 000000000000..59f9c0ba34f5 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla46363.cs @@ -0,0 +1,40 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla46363 : _IssuesUITest +{ + public Bugzilla46363(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "TapGestureRecognizer blocks List View Context Actions"; + + // [FailsOnAndroid] + // [FailsOnIOS] + // [Test] + // public void _46363_Tap_Succeeds() + // { + // RunningApp.WaitForElement(Testing); + // RunningApp.Tap(Target); + // RunningApp.WaitForElement(TapSuccess); + + // // First run at fixing this caused the context menu to open on a regular tap + // // So this check is to ensure that doesn't happen again + // RunningApp.WaitForNoElement(ContextAction); + // } + + // [FailsOnAndroid] + // [FailsOnIOS] + // [Test] + // public void _46363_ContextAction_Succeeds() + // { + // RunningApp.WaitForElement(Testing); + // RunningApp.ActivateContextMenu(Target); + // RunningApp.WaitForElement(ContextAction); + // RunningApp.Tap(ContextAction); + // RunningApp.WaitForElement(ContextSuccess); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla46363_2.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla46363_2.cs new file mode 100644 index 000000000000..5769460e19bf --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla46363_2.cs @@ -0,0 +1,39 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla46363_2 : _IssuesUITest +{ + public Bugzilla46363_2(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "TapGestureRecognizer blocks List View Context Actions1"; + + // [FailsOnAndroid] + // [FailsOnIOS] + // [Test] + // public void _46363_2_Tap_Succeeds() + // { + // RunningApp.WaitForElement(Testing); + // RunningApp.Tap(Target); + // RunningApp.WaitForElement(TapSuccess); + + // // Verify that we aren't also opening the context menu + // RunningApp.WaitForNoElement(ContextAction); + // } + + // [FailsOnAndroid] + // [FailsOnIOS] + // [Test] + // public void _46363_2_ContextAction_Succeeds() + // { + // RunningApp.WaitForElement(Testing); + // RunningApp.ActivateContextMenu(Target); + // RunningApp.WaitForElement(ContextAction); + // RunningApp.Tap(ContextAction); + // RunningApp.WaitForElement(ContextSuccess); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla47923.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla47923.cs new file mode 100644 index 000000000000..d7e7849452c5 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla47923.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla47923 : _IssuesUITest +{ + public Bugzilla47923(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "TapGestureRecognizer blocks List View Context Actions1"; + + // [FailsOnAndroid] + // [FailsOnIOS] + // [Test] + // public void Bugzilla47923Test() + // { + // foreach (var testString in new[] { "AspectFit", "AspectFill", "Fill", "Test cell views" }) + // { + // RunningApp.WaitForElement(q => q.Marked(testString)); + // RunningApp.Tap(q => q.Marked(testString)); + // RunningApp.Back(); + // } + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla51825.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla51825.cs new file mode 100644 index 000000000000..5e837445e8df --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla51825.cs @@ -0,0 +1,36 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla51825 : _IssuesUITest +{ + public Bugzilla51825(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[iOS] Korean input in SearchBar doesn't work"; + +// [Test] +// [FailsOnIOS] +// public void Bugzilla51825Test() +// { +// RunningApp.WaitForElement(q => q.Marked("Bugzilla51825SearchBar")); +// RunningApp.EnterText("Bugzilla51825SearchBar", "Hello"); +// var label = RunningApp.WaitForFirstElement("Bugzilla51825Label"); + +// Assert.IsNotEmpty(label.ReadText()); + +// // Windows App Driver and the Search Bar are a bit buggy +// // It randomly doesn't enter the first letter +// #if !WINDOWS +// Assert.AreEqual("Hello", label.ReadText()); +// #endif + +// RunningApp.Tap("Bugzilla51825Button"); + +// var labelChange2 = RunningApp.WaitForFirstElement("Bugzilla51825Label"); +// Assert.AreEqual("Test", labelChange2.ReadText()); +// } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla52419.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla52419.cs new file mode 100644 index 000000000000..5423f04abeb9 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla52419.cs @@ -0,0 +1,37 @@ +#if ANDROID +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla52419 : _IssuesUITest +{ + public Bugzilla52419(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[A] OnAppearing called for previous pages in a tab's navigation when switching active tabs"; + + // [Test] + // [Category(UITestCategories.TabbedPage)] + // [FailsOnAndroid] + // public void Bugzilla52419Test() + // { + // RunningApp.WaitForElement(q => q.Marked("Push new page")); + // RunningApp.Tap(q => q.Marked("Push new page")); + // RunningApp.WaitForElement(q => q.Marked("Push new page")); + // RunningApp.Tap(q => q.Marked("Push new page")); + // RunningApp.WaitForElement(q => q.Marked("Push new page")); + // RunningApp.Tap(q => q.Marked("Push new page")); + // RunningApp.Tap(q => q.Marked("Tab Page 2")); + // RunningApp.Tap(q => q.Marked("Tab Page 1")); + // RunningApp.Tap(q => q.Marked("Tab Page 2")); + // RunningApp.Tap(q => q.Marked("Tab Page 1")); + // RunningApp.Back(); + // RunningApp.WaitForElement(q => q.Marked("AppearanceLabel")); + // var label = RunningApp.Query(q => q.Marked("AppearanceLabel"))[0]; + // Assert.AreEqual("Times Appeared: 2", label.Text); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla53179_1.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla53179_1.cs new file mode 100644 index 000000000000..10349641e122 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla53179_1.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; +public class Bugzilla53179_1 : _IssuesUITest +{ + public Bugzilla53179_1(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "1PopAsync crashing after RemovePage when support packages are updated to 25.1.1"; + + // [Test] + // [Category(UITestCategories.Navigation)] + // public void PopAsyncAfterRemovePageDoesNotCrash() + // { + // RunningApp.WaitForElement(StartTest); + // RunningApp.Tap(StartTest); + // RunningApp.WaitForElement(RootLabel); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla53179_2.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla53179_2.cs new file mode 100644 index 000000000000..12cb2f1659d5 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla53179_2.cs @@ -0,0 +1,21 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; +public class Bugzilla53179_2 : _IssuesUITest +{ + public Bugzilla53179_2(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Removing page during OnAppearing throws exception"; + + // [Test] + // [Category(UITestCategories.Navigation)] + // [FailsOnAndroid] + // public void RemovePageOnAppearingDoesNotCrash() + // { + // RunningApp.WaitForElement(Success); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla56710.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla56710.cs new file mode 100644 index 000000000000..a366837bdf88 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla56710.cs @@ -0,0 +1,31 @@ +#if IOS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla56710 : _IssuesUITest +{ + const string Success = "Success"; + const string BtnAdd = "btnAdd"; + + public Bugzilla56710(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Multi-item add in INotifyCollectionChanged causes a NSInternalInconsistencyException in bindings on iOS"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [Category(UITestCategories.Compatibility)] + // [FailsOnIOS] + // [FailsOnMac] + // public void Bugzilla56771Test() + // { + // App.WaitForElement(BtnAdd); + // App.Tap(BtnAdd); + // App.WaitForNoElement(Success); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57317.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57317.cs new file mode 100644 index 000000000000..eb80392af5d3 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57317.cs @@ -0,0 +1,30 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla57317 : _IssuesUITest +{ + const string Success = "Success"; + const string BtnAdd = "btnAdd"; + + public Bugzilla57317(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Modifying Cell.ContextActions can crash on Android"; + + // [Test] + // [Category(UITestCategories.TableView)] + // [FailsOnIOS] + // public void Bugzilla57317Test() + // { + // RunningApp.WaitForFirstElement("Cell"); + + // RunningApp.ActivateContextMenu("Cell"); + + // RunningApp.WaitForFirstElement("Self-Deleting item"); + // RunningApp.Tap(c => c.Marked("Self-Deleting item")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57515.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57515.cs new file mode 100644 index 000000000000..e37d901da6ae --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57515.cs @@ -0,0 +1,25 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla57515 : _IssuesUITest +{ + public Bugzilla57515(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "PinchGestureRecognizer not getting called on Android "; + + // [Test] + // [Category(UITestCategories.Gestures)] + // [FailsOnIOS] + // public void Bugzilla57515Test() + // { + // RunningApp.WaitForElement(ZoomContainer); + // RunningApp.WaitForElement("1"); + // RunningApp.PinchToZoomIn(ZoomContainer); + // RunningApp.WaitForNoElement("1"); // The scale should have changed during the zoom + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57717.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57717.cs new file mode 100644 index 000000000000..74f1a0158adc --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57717.cs @@ -0,0 +1,25 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla57717 : _IssuesUITest +{ + const string ButtonText = "I am a button"; + + public Bugzilla57717(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Setting background color on Button in Android FormsApplicationActivity causes NRE"; + + // [Test] + // [Category(UITestCategories.Button)] + // [FailsOnIOS] + // public void ButtonBackgroundColorAutomatedTest() + // { + // // With the original bug in place, we'll crash before we get this far + // App.WaitForElement(ButtonText); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57749.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57749.cs new file mode 100644 index 000000000000..2d64a5d290a6 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla57749.cs @@ -0,0 +1,24 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla57749 : _IssuesUITest +{ + public Bugzilla57749(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "After enabling a disabled button it is not clickable"; + + // [Test] + // [FailsOnIOS] + // public async Task Bugzilla57749Test() + // { + // await Task.Delay(500); + // RunningApp.Tap(c => c.Marked("btnClick")); + // RunningApp.WaitForElement (q => q.Marked ("Button was clicked")); + // RunningApp.Tap("Ok"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla58779.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla58779.cs new file mode 100644 index 000000000000..9055ae4dee6b --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla58779.cs @@ -0,0 +1,25 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla58779 : _IssuesUITest +{ + public Bugzilla58779(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[MacOS] DisplayActionSheet on MacOS needs scroll bars if list is long"; + + // [Test] + // [FailsOnIOS] + // public void Bugzilla58779Test() + // { + // RunningApp.WaitForElement(q => q.Marked(ButtonId)); + // RunningApp.Tap(q => q.Marked(ButtonId)); + // RunningApp.Screenshot("Check list fits on screen"); + // RunningApp.WaitForElement(q => q.Marked(CancelId)); + // RunningApp.Tap(q => q.Marked(CancelId)); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla58833.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla58833.cs new file mode 100644 index 000000000000..601aba46c950 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla58833.cs @@ -0,0 +1,46 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla58833 : _IssuesUITest +{ + public Bugzilla58833(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ListView SelectedItem Binding does not fire"; + +// [Test] +// [Category(UITestCategories.ListView)] +// [Ignore("Failing without explanation on XTC, please run manually")] +// public void Bugzilla58833Test() +// { +// // Item #1 should not have a tap gesture, so it should be selectable +// RunningApp.WaitForElement(q => q.Marked("Item #1")); +// RunningApp.Tap(q => q.Marked("Item #1")); +// RunningApp.WaitForElement(q => q.Marked(ItemSelectedSuccess)); + +// // Item #2 should have a tap gesture +// RunningApp.WaitForElement(q => q.Marked("Item #2")); +// RunningApp.Tap(q => q.Marked("Item #2")); +// RunningApp.WaitForElement(q => q.Marked(TapGestureSucess)); + +// // Both items should allow access to the context menu +// RunningApp.ActivateContextMenu("Item #2"); +// RunningApp.WaitForElement("2 Action"); +// #if __ANDROID__ +// RunningApp.Back(); +// #else +// RunningApp.Tap(q => q.Marked("Item #3")); + + +// RunningApp.ActivateContextMenu("Item #1"); +// RunningApp.WaitForElement("1 Action"); +// #if __ANDROID__ +// RunningApp.Back(); +// #else +// RunningApp.Tap(q => q.Marked("Item #3")); +// } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla58875.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla58875.cs new file mode 100644 index 000000000000..173133daea89 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla58875.cs @@ -0,0 +1,36 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla58875 : _IssuesUITest +{ + public Bugzilla58875(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Back navigation disables Context Action in whole app, if Context Action left open"; + +// [Test] +// [Category(UITestCategories.ContextActions)] +// public void Bugzilla58875Test() +// { +// RunningApp.WaitForElement(q => q.Marked(Button1Id)); +// RunningApp.Tap(q => q.Marked(Button1Id)); +// RunningApp.WaitForElement(q => q.Marked(Target)); +// RunningApp.ActivateContextMenu(Target); +// RunningApp.WaitForElement(q => q.Marked(ContextAction)); +// RunningApp.Back(); + +// #if ANDROID +// RunningApp.Back(); // back button dismisses the ContextAction first, so we need to hit back one more time to get to previous page +// #endif + +// RunningApp.WaitForElement(q => q.Marked(Button1Id)); +// RunningApp.Tap(q => q.Marked(Button1Id)); +// RunningApp.WaitForElement(q => q.Marked(Target)); +// RunningApp.ActivateContextMenu(Target); +// RunningApp.WaitForElement(q => q.Marked(ContextAction)); +// } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59580.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59580.cs new file mode 100644 index 000000000000..fd40620b92c6 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59580.cs @@ -0,0 +1,28 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla59580 : _IssuesUITest +{ + public Bugzilla59580(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Raising Command.CanExecutChanged causes crash on Android"; + + // [Test] + // [Category(UITestCategories.TableView)] + // [FailsOnIOS] + // public void RaisingCommandCanExecuteChangedCausesCrashOnAndroid() + // { + // RunningApp.WaitForElement(c => c.Marked("Cell")); + + // RunningApp.ActivateContextMenu("Cell"); + + // RunningApp.WaitForElement(c => c.Marked("Fire CanExecuteChanged")); + // RunningApp.Tap(c => c.Marked("Fire CanExecuteChanged")); + // RunningApp.WaitForElement("Cell"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59718.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59718.cs new file mode 100644 index 000000000000..90fb0a21ea8f --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59718.cs @@ -0,0 +1,35 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla59718 : _IssuesUITest +{ + public Bugzilla59718(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Multiple issues with listview and navigation in UWP"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Bugzilla59718Test() + // { + // RunningApp.WaitForElement(q => q.Marked(Target1)); + // RunningApp.Tap(q => q.Marked(Target1)); + + // RunningApp.WaitForElement(q => q.Marked(Target1b)); + + // RunningApp.WaitForElement(q => q.Marked(Target2)); + // RunningApp.Tap(q => q.Marked(Target2)); + + // RunningApp.WaitForElement(q => q.Marked(Target3)); + + // RunningApp.WaitForElement(q => q.Marked(GoBackButtonId)); + // RunningApp.Tap(q => q.Marked(GoBackButtonId)); + + // RunningApp.WaitForElement(q => q.Marked(Target1)); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59863_0.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59863_0.cs new file mode 100644 index 000000000000..d10e8bcb5382 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59863_0.cs @@ -0,0 +1,45 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.Gestures)] +public class Bugzilla59863_0 : _IssuesUITest +{ + public Bugzilla59863_0(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "TapGestureRecognizer extremely finicky"; + + // [Test] + // [FailsOnIOS] + // public void TapsCountShouldMatch() + // { + // // Gonna add this test because we'd want to know if it _did_ start failing + // // But it doesn't really help much with this issue; UI test can't tap fast enough to demonstrate the + // // problem we're trying to solve + + // int tapsToTest = 5; + + // RunningApp.WaitForElement(SingleTapBoxId); + + // for (int n = 0; n < tapsToTest; n++) + // { + // RunningApp.Tap(SingleTapBoxId); + // } + + // RunningApp.WaitForElement($"{tapsToTest} {Singles} on {SingleTapBoxId}"); + // } + + // [Test] + // [FailsOnIOS] + // public void DoubleTapWithOnlySingleTapRecognizerShouldRegisterTwoTaps() + // { + // RunningApp.WaitForElement(SingleTapBoxId); + // RunningApp.DoubleTap(SingleTapBoxId); + + // RunningApp.WaitForElement($"2 {Singles} on {SingleTapBoxId}"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59863_1.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59863_1.cs new file mode 100644 index 000000000000..8e4768d159b6 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59863_1.cs @@ -0,0 +1,35 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.Gestures)] +public class Bugzilla59863_1 : _IssuesUITest +{ + public Bugzilla59863_1(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "TapGestureRecognizer extremely finicky1"; + + // [Test] + // [FailsOnIOS] + // public void SingleTapWithOnlyDoubleTapRecognizerShouldRegisterNothing() + // { + // RunningApp.WaitForElement(DoubleTapBoxId); + // RunningApp.Tap(DoubleTapBoxId); + + // RunningApp.WaitForElement($"0 {Doubles} on {DoubleTapBoxId}"); + // } + + // [Test] + // [FailsOnIOS] + // public void DoubleTapWithOnlyDoubleTapRecognizerShouldRegisterOneDoubleTap() + // { + // RunningApp.WaitForElement(DoubleTapBoxId); + // RunningApp.DoubleTap(DoubleTapBoxId); + + // RunningApp.WaitForElement($"1 {Doubles} on {DoubleTapBoxId}"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59863_2.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59863_2.cs new file mode 100644 index 000000000000..6179dcf2c2d8 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla59863_2.cs @@ -0,0 +1,35 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.Gestures)] +public class Bugzilla59863_2 : _IssuesUITest +{ + public Bugzilla59863_2(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "TapGestureRecognizer extremely finicky2"; + + // [Test] + // [FailsOnIOS] + // public void DoubleTapWithMixedRecognizersShouldRegisterDoubleTap() + // { + // RunningApp.WaitForElement(MixedTapBoxId); + // RunningApp.DoubleTap(MixedTapBoxId); + + // RunningApp.WaitForElement($"1 {Doubles} on {MixedTapBoxId}"); + // } + + // [Test] + // [FailsOnIOS] + // public void SingleTapWithMixedRecognizersShouldRegisterSingleTap() + // { + // RunningApp.WaitForElement(MixedTapBoxId); + // RunningApp.Tap(MixedTapBoxId); + + // RunningApp.WaitForElement($"1 {Singles} on {MixedTapBoxId}"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla60045.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla60045.cs new file mode 100644 index 000000000000..1738ac061593 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla60045.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; +public class Bugzilla60045 : _IssuesUITest +{ + public Bugzilla60045(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ListView with RecycleElement strategy doesn't handle CanExecute of TextCell Command properly"; + + // [Test] + // [FailsOnIOS] + // public void CommandDoesNotFire() + // { + // RunningApp.WaitForElement(ClickThis); + // RunningApp.Tap(ClickThis); + // RunningApp.WaitForNoElement(Fail); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla60122.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla60122.cs new file mode 100644 index 000000000000..3ec59c5884b7 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla60122.cs @@ -0,0 +1,30 @@ +#if !WINDOWS +// This test won't work on Windows right now because we can only test desktop, so touch events +// (like LongPress) don't really work. The test should work manually on a touch screen, though. +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla60122 : _IssuesUITest +{ + public Bugzilla60122(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "LongClick on image not working"; + + // [FailsOnAndroid] + // [FailsOnIOS] + // [Test] + // [Category(UITestCategories.Gestures)] + // public void LongClickFiresOnCustomImageRenderer() + // { + // RunningApp.WaitForElement(ImageId); + // RunningApp.TouchAndHold(ImageId); + // RunningApp.WaitForElement(Success); + // } +} + +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla60524.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla60524.cs new file mode 100644 index 000000000000..663d971f5237 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Bugzilla/Bugzilla60524.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Bugzilla60524 : _IssuesUITest +{ + public Bugzilla60524(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "NRE when rendering ListView with grouping enabled and HasUnevenRows set to true"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Bugzilla60524Test() + // { + // RunningApp.WaitForElement(q => q.Marked("Group 1")); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CarouselViewUITests.NoItemTemplate.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CarouselViewUITests.NoItemTemplate.cs index 145000c48d93..148b85799f7b 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CarouselViewUITests.NoItemTemplate.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CarouselViewUITests.NoItemTemplate.cs @@ -16,7 +16,7 @@ public CarouselViewNoItemTemplate(TestDevice device) // Issue12777 (src\ControlGallery\src\Issues.Shared\Issue12777.cs [Test] [Category(UITestCategories.CarouselView)] - [FailsOnWindows("This test is failing, likely due to product issue")] + [FailsOnAllPlatforms("This test is failing, likely due to product issue")] public void Issue12777Test() { App.WaitForElement("TestCarouselView"); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CollectionViewUITests.HiddenCollectionViewBind.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CollectionViewUITests.HiddenCollectionViewBind.cs index e228e6fd163a..45e227093373 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CollectionViewUITests.HiddenCollectionViewBind.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/CollectionViewUITests.HiddenCollectionViewBind.cs @@ -17,6 +17,7 @@ public HiddenCollectionViewBindUITests(TestDevice device) // CollectionShouldInvalidateOnVisibilityChange (src\Compatibility\ControlGallery\src\Issues.Shared\Issue13203.cs) [Test] + [FailsOnAllPlatforms("This test is failing, likely due to product issue")] [Category(UITestCategories.CollectionView)] public void CollectionShouldInvalidateOnVisibilityChange() { diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/FlyoutBehaviorShell.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/FlyoutBehaviorShell.cs new file mode 100644 index 000000000000..cae0bfd04290 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/FlyoutBehaviorShell.cs @@ -0,0 +1,81 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; +public class FlyoutBehaviorShell : _IssuesUITest +{ + public FlyoutBehaviorShell(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Shell Flyout Behavior"; + + // [FailsOnAndroid] + // [Test] + // [Category(UITestCategories.Shell)] + // public void FlyoutTests() + // { + // // Flyout is visible + // RunningApp.WaitForElement(EnableFlyoutBehavior); + + // // Starting shell out as disabled correctly disables flyout + // RunningApp.WaitForNoElement(FlyoutIconAutomationId, "Flyout Icon Visible on Startup"); + // ShowFlyout(usingSwipe: true, testForFlyoutIcon: false); + // RunningApp.WaitForNoElement(FlyoutItem, "Flyout Visible on Startup"); + + // // Enable Flyout Test + // RunningApp.Tap(EnableFlyoutBehavior); + // ShowFlyout(usingSwipe: true); + // RunningApp.WaitForElement(FlyoutItem, "Flyout Not Visible after Enabled"); + // RunningApp.Tap(FlyoutItem); + + // // Flyout Icon is not visible but you can still swipe open + // RunningApp.Tap(DisableFlyoutBehavior); + // RunningApp.WaitForNoElement(FlyoutIconAutomationId, "Flyout Icon Visible after being Disabled"); + // ShowFlyout(usingSwipe: true, testForFlyoutIcon: false); + // RunningApp.WaitForNoElement(FlyoutItem, "Flyout Visible after being Disabled"); + + + // // enable flyout and make sure disabling back button behavior doesn't hide icon + // RunningApp.Tap(EnableFlyoutBehavior); + // RunningApp.WaitForElement(FlyoutIconAutomationId); + // RunningApp.Tap(DisableBackButtonBehavior); + // ShowFlyout(usingSwipe: true); + // RunningApp.WaitForElement(FlyoutItem, "Flyout swipe not working after Disabling Back Button Behavior"); + // RunningApp.Tap(FlyoutItem); + + // // make sure you can still open flyout via code + // RunningApp.Tap(EnableFlyoutBehavior); + // RunningApp.Tap(EnableBackButtonBehavior); + // RunningApp.Tap(OpenFlyout); + // RunningApp.WaitForElement(FlyoutItem, "Flyout not opening via code"); + // RunningApp.Tap(FlyoutItem); + + // // make sure you can still open flyout via code if flyout behavior is disabled + // RunningApp.Tap(DisableFlyoutBehavior); + // RunningApp.Tap(EnableBackButtonBehavior); + // RunningApp.Tap(OpenFlyout); + // RunningApp.WaitForElement(FlyoutItem, "Flyout not opening via code when flyout behavior disabled"); + // RunningApp.Tap(FlyoutItem); + + // // make sure you can still open flyout via code if back button behavior is disabled + // RunningApp.Tap(EnableFlyoutBehavior); + // RunningApp.Tap(DisableBackButtonBehavior); + // RunningApp.Tap(OpenFlyout); + // RunningApp.WaitForElement(FlyoutItem, "Flyout not opening via code when back button behavior is disabled"); + // RunningApp.Tap(FlyoutItem); + + // } + + // [Test] + // public void WhenFlyoutIsLockedButtonsAreStillVisible() + // { + // // FlyoutLocked ensure that the flyout and buttons are still visible + // RunningApp.Tap(EnableBackButtonBehavior); + // RunningApp.Tap(LockFlyoutBehavior); + // RunningApp.WaitForElement(title, "Flyout Locked hiding content"); + // RunningApp.Tap(EnableFlyoutBehavior); + // RunningApp.WaitForNoElement(FlyoutItem); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/GitHub1331.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/GitHub1331.cs new file mode 100644 index 000000000000..908292030b50 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/GitHub1331.cs @@ -0,0 +1,34 @@ +#if ANDROID // This test only makes sense on platforms using Long Press to activate context menus +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class GitHub1331 : _IssuesUITest +{ + public GitHub1331(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Android] ViewCell shows ContextActions on tap instead of long press"; + + // [Test] + // [Category(UITestCategories.Gestures)] + // public void SingleTapOnCellDoesNotActivateContext() + // { + // RunningApp.WaitForElement(Action); + + // RunningApp.Tap(Action); + // RunningApp.WaitForElement(ActionItemTapped); + + // // Tapping the part of the cell without a tap gesture should *not* display the context action + // RunningApp.Tap(CellItem); + // RunningApp.WaitForNoElement("Context Action"); + + // // But a Long Press *should* still display the context action + // RunningApp.TouchAndHold(CellItem); + // RunningApp.WaitForElement("Context Action"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/GitHub1355_Forms.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/GitHub1355_Forms.cs new file mode 100644 index 000000000000..60f174df29e1 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/GitHub1355_Forms.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class GitHub1355_Forms : _IssuesUITest +{ + public GitHub1355_Forms(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Android] ViewCell shows ContextActions on tap instead of long press"; + + // [Test] + // [Category(UITestCategories.Navigation)] + // public void SwitchMainPageOnAppearing() + // { + // // Without the fix, this would crash. If we're here at all, the test passed. + // RunningApp.WaitForElement(Success); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Github1650.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Github1650.cs new file mode 100644 index 000000000000..c991d452224a --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Github1650.cs @@ -0,0 +1,31 @@ +#if MACCATALYST +using NUnit.Framework; +using NUnit.Framework.Legacy; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Github1650 : _IssuesUITest +{ + public Github1650(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[macOS] Completed event of Entry raised on Tab key"; + + // [Test] + // [Category(UITestCategories.Entry)] + // public void GitHub1650Test() + // { + // RunningApp.WaitForElement(q => q.Marked("CompletedTargetEntry")); + // RunningApp.Tap(q => q.Marked("CompletedTargetEntry")); + + // Assert.AreEqual(0, _completedCount, "Completed should not have been fired"); + + // RunningApp.PressEnter(); + + // Assert.AreEqual(1, _completedCount, "Completed should have been fired once"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Github1776.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Github1776.cs new file mode 100644 index 000000000000..ab51819f5ea6 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Github1776.cs @@ -0,0 +1,30 @@ +#if MACCATALYST +using NUnit.Framework; +using NUnit.Framework.Legacy; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Github1776 : _IssuesUITest +{ + public Github1776(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Button Released not being triggered"; + + // [Test] + // [Category(UITestCategories.Button)] + // public void GitHub1776Test() + // { + // RunningApp.WaitForElement(q => q.Marked("TheButton")); + // RunningApp.Tap(q => q.Marked("TheButton")); + + // Assert.AreEqual(1, _pressedCount, "Pressed should fire once per tap"); + // Assert.AreEqual(1, _releasedCount, "Released should fire once per tap"); + // Assert.AreEqual(1, _clickedCount, "Clicked should fire once per tap"); + // Assert.AreEqual(1, _commandCount, "Command should fire once per tap"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Github5623.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Github5623.cs index 47120baccc36..dff879013bc9 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Github5623.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Github5623.cs @@ -1,4 +1,4 @@ -#if !MACCATALYST && !IOS +#if !MACCATALYST && !IOS using NUnit.Framework; using NUnit.Framework.Legacy; using UITest.Appium; @@ -19,6 +19,7 @@ public Github5623(TestDevice device) [Test] [Category(UITestCategories.CollectionView)] + [FailsOnWindows] public void CollectionViewInfiniteScroll() { // The reproduction initially adds 10 elements to the CollectionView, and we need to scroll to the bottom @@ -28,4 +29,4 @@ public void CollectionViewInfiniteScroll() } } } -#endif \ No newline at end of file +#endif diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/HeaderFooterShellFlyout.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/HeaderFooterShellFlyout.cs new file mode 100644 index 000000000000..a54368206734 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/HeaderFooterShellFlyout.cs @@ -0,0 +1,78 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.Shell)] +public class HeaderFooterShellFlyout : _IssuesUITest +{ + public HeaderFooterShellFlyout(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Shell Flyout Header Footer"; + + // [Test] + // [Ignore("This test fails intermittently, especially on iOS 17; ignore until we can fix it")] + // public async Task FlyoutHeaderWithZeroMarginShouldHaveNoY() + // { + // RunningApp.WaitForElement("PageLoaded"); + // this.TapInFlyout("ZeroMarginHeader", makeSureFlyoutStaysOpen: true); + // // Adding this to just really make sure layout is finished + // // Once we move this to appium we can remove this + // await Task.Delay(1000); + // var layout = RunningApp.WaitForElement("ZeroMarginLayout")[0].Rect.Y; + // Assert.AreEqual(0, layout); + // } + + // [Test] + // [FailsOnIOS] + // public void FlyoutTests() + // { + // RunningApp.WaitForElement("PageLoaded"); + + // // Verify Header an Footer show up at all + // TapInFlyout("ToggleHeaderFooter", makeSureFlyoutStaysOpen: true); + // RunningApp.WaitForElement("Header View"); + // RunningApp.WaitForElement("Footer View"); + + // // Verify Template takes priority over header footer + // TapInFlyout("ToggleHeaderFooterTemplate", makeSureFlyoutStaysOpen: true); + // RunningApp.WaitForElement("Header Template"); + // RunningApp.WaitForElement("Footer Template"); + // RunningApp.WaitForNoElement("Header View"); + // RunningApp.WaitForNoElement("Footer View"); + + // // Verify turning off Template shows Views again + // TapInFlyout("ToggleHeaderFooterTemplate", makeSureFlyoutStaysOpen: true); + // RunningApp.WaitForElement("Header View"); + // RunningApp.WaitForElement("Footer View"); + // RunningApp.WaitForNoElement("Header Template"); + // RunningApp.WaitForNoElement("Footer Template"); + + // // Verify turning off header/footer clear out views correctly + // TapInFlyout("ToggleHeaderFooter", makeSureFlyoutStaysOpen: true); + // RunningApp.WaitForNoElement("Header Template"); + // RunningApp.WaitForNoElement("Footer Template"); + // RunningApp.WaitForNoElement("Header View"); + // RunningApp.WaitForNoElement("Footer View"); + + // // verify header and footer react to size changes + // TapInFlyout("ResizeHeaderFooter", makeSureFlyoutStaysOpen: true); + // var headerSizeSmall = RunningApp.WaitForElement("Header View")[0].Rect; + // var footerSizeSmall = RunningApp.WaitForElement("Footer View")[0].Rect; + // TapInFlyout("ResizeHeaderFooter", makeSureFlyoutStaysOpen: true); + // var headerSizeLarge = RunningApp.WaitForElement("Header View")[0].Rect; + // var footerSizeLarge = RunningApp.WaitForElement("Footer View")[0].Rect; + + // TapInFlyout("ResizeHeaderFooter", makeSureFlyoutStaysOpen: true); + // var headerSizeSmall2 = RunningApp.WaitForElement("Header View")[0].Rect; + // var footerSizeSmall2 = RunningApp.WaitForElement("Footer View")[0].Rect; + + // Assert.Greater(headerSizeLarge.Height, headerSizeSmall.Height); + // Assert.Greater(footerSizeLarge.Height, footerSizeSmall.Height); + // Assert.AreEqual(headerSizeSmall2.Height, headerSizeSmall.Height); + // Assert.AreEqual(footerSizeSmall2.Height, footerSizeSmall.Height); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10134.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10134.cs new file mode 100644 index 000000000000..e91fae1af621 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10134.cs @@ -0,0 +1,58 @@ +using NUnit.Framework; +using NUnit.Framework.Legacy; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Github10134 : _IssuesUITest +{ + public Github10134(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Shell Top Tabbar focus issue"; + + // [Test] + // [Category(UITestCategories.Shell)] + // [FailsOnIOS] + // public void TopTabsDontScrollBackToStartWhenSelected() + // { + // var element1 = RunningApp.WaitForElement("Tab 1", "Shell hasn't loaded")[0].Rect; + // RunningApp.WaitForNoElement("Tab 12", "Tab shouldn't be visible"); + + // Xamarin.UITest.Queries.AppRect element2 = element1; + + // for (int i = 2; i < 20; i++) + // { + // var results = RunningApp.Query($"Tab {i}"); + + // if (results.Length == 0) + // break; + + // element2 = results[0].Rect; + // } + + // RunningApp.DragCoordinates(element2.CenterX, element2.CenterY, element1.CenterX, element1.CenterY); + + // RunningApp.WaitForNoElement("Tab 1"); + // bool testPassed = false; + + // // figure out what tabs are visible + // for (int i = 20; i > 1; i--) + // { + // var results = RunningApp.Query($"Tab {i}"); + + // if (results.Length > 0) + // { + // RunningApp.Tap($"Tab {i}"); + // RunningApp.WaitForElement($"Tab {i}"); + // testPassed = true; + // break; + // } + // } + + // RunningApp.WaitForNoElement("Tab 1"); + // Assert.IsTrue(testPassed); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1023_Forms.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1023_Forms.cs new file mode 100644 index 000000000000..d7fce61b39af --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1023_Forms.cs @@ -0,0 +1,38 @@ +#if IOS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1023_Forms : _IssuesUITest +{ + public Issue1023_Forms(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Automate GC checks of picker disposals"; + + // [Test] + // [Category(UITestCategories.Picker)] + // [FailsOnIOS] + // public void Bugzilla1023Test() + // { + // for (var n = 0; n < 10; n++) + // { + // RunningApp.WaitForElement(q => q.Marked("Push")); + // RunningApp.Tap(q => q.Marked("Push")); + + // RunningApp.WaitForElement(q => q.Marked("ListView")); + // RunningApp.Back(); + // } + + // // At this point, the counter can be any value, but it's most likely not zero. + // // Invoking GC once is enough to clean up all garbage data and set counter to zero + // RunningApp.WaitForElement(q => q.Marked("GC")); + // RunningApp.Tap(q => q.Marked("GC")); + + // RunningApp.WaitForElement(q => q.Marked("Counter: 0")); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1024.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1024.cs new file mode 100644 index 000000000000..ceace3b2e4e5 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1024.cs @@ -0,0 +1,38 @@ +#if IOS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1024 : _IssuesUITest +{ + public Issue1024(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Entry and Editor are leaking when used in ViewCell"; + + // [Test] + // [Category(UITestCategories.Performance)] + // [FailsOnIOS] + // public void Bugzilla1024Test() + // { + // for (var n = 0; n < 10; n++) + // { + // RunningApp.WaitForElement(q => q.Marked("Push")); + // RunningApp.Tap(q => q.Marked("Push")); + + // RunningApp.WaitForElement(q => q.Marked("ListView")); + // RunningApp.Back(); + // } + + // // At this point, the counter can be any value, but it's most likely not zero. + // // Invoking GC once is enough to clean up all garbage data and set counter to zero + // RunningApp.WaitForElement(q => q.Marked("GC")); + // RunningApp.Tap(q => q.Marked("GC")); + + // RunningApp.WaitForElement(q => q.Marked("Counter: 0")); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1028.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1028.cs new file mode 100644 index 000000000000..6848e41eedfd --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1028.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1028 : _IssuesUITest +{ + public Issue1028(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ViewCell in TableView raises exception - root page is ContentPage, Content is TableView"; + + // [Test] + // [Category(UITestCategories.TableView)] + // public void ViewCellInTableViewDoesNotCrash() + // { + // // If we can see this element, then we didn't crash. + // App.WaitForElement("Custom Slider View:"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10454.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10454.cs index 9faa4c82c52d..43aae7865e8e 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10454.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10454.cs @@ -14,14 +14,14 @@ public Issue10454(TestDevice testDevice) : base(testDevice) public override string Issue => "CollectionView ChildAdded"; - [Test] - [Category(UITestCategories.CollectionView)] - [Category(UITestCategories.Compatibility)] - [FailsOnIOS] - [FailsOnMac] - public void ChildAddedShouldFire() - { - App.WaitForNoElement(Success); - } + // [Test] + // [Category(UITestCategories.CollectionView)] + // [Category(UITestCategories.Compatibility)] + // [FailsOnIOS] + // [FailsOnMac] + // public void ChildAddedShouldFire() + // { + // App.WaitForNoElement(Success); + // } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10608.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10608.cs new file mode 100644 index 000000000000..6933285ffb85 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10608.cs @@ -0,0 +1,46 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue10608 : _IssuesUITest +{ + const string OpenLeftId = "OpenLeftId"; + const string OpenRightId = "OpenRightId"; + const string OpenTopId = "OpenTopId"; + const string OpenBottomId = "OpenBottomId"; + const string CloseId = "CloseId"; + + public Issue10608(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug] [Shell] [iOS] Locked flyout causes application to freezes when quickly switching between tabs"; + + // [Test] + // [Category(UITestCategories.Shell)] + // public void ShellWithTopTabsFreezesWhenNavigatingFlyoutItems() + // { + // RunningApp.Tap("FlyoutItem6"); + // RunningApp.Tap("FlyoutItem0"); + // for (int i = 0; i < 5; i++) + // { + // RunningApp.WaitForElement("Tab1AutomationId"); + // RunningApp.WaitForElement("LearnMoreButton"); + // RunningApp.Tap("FlyoutItem0"); + // RunningApp.Tap("FlyoutItem1"); + // RunningApp.Tap("FlyoutItem0"); + // RunningApp.WaitForElement("LearnMoreButton"); + // } + + // RunningApp.WaitForElement("Tab1AutomationId"); + // RunningApp.WaitForElement("LearnMoreButton"); + // RunningApp.Tap("FlyoutItem1"); + // RunningApp.WaitForElement("Tab2AutomationId"); + // RunningApp.WaitForElement("LearnMoreButton"); + // RunningApp.Tap("FlyoutItem0"); + // RunningApp.WaitForElement("Tab1AutomationId"); + // RunningApp.WaitForElement("LearnMoreButton"); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs index 27a87a47f2d9..7f351352996b 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10947.cs @@ -15,26 +15,26 @@ public Issue10947(TestDevice device) string HeaderEntry => "HeaderEntry"; string FooterEntry => "FooterEntry"; - [Test] - [Category(UITestCategories.CollectionView)] - public void CollectionViewHeaderShouldNotScroll() - { - var headerEntry = App.WaitForElement(HeaderEntry); - var headerLocation = headerEntry.GetRect(); - var footerEntry = App.WaitForElement(FooterEntry); - var footerLocation = headerEntry.GetRect(); + // [Test] + // [Category(UITestCategories.CollectionView)] + // public void CollectionViewHeaderShouldNotScroll() + // { + // var headerEntry = App.WaitForElement(HeaderEntry); + // var headerLocation = headerEntry.GetRect(); + // var footerEntry = App.WaitForElement(FooterEntry); + // var footerLocation = headerEntry.GetRect(); - App.Tap(HeaderEntry); + // App.Tap(HeaderEntry); - var newHeaderEntry = App.WaitForElement(HeaderEntry); - var newHeaderLocation = headerEntry.GetRect(); - ClassicAssert.AreEqual(headerLocation, newHeaderLocation); + // var newHeaderEntry = App.WaitForElement(HeaderEntry); + // var newHeaderLocation = headerEntry.GetRect(); + // ClassicAssert.AreEqual(headerLocation, newHeaderLocation); - App.Tap(FooterEntry); + // App.Tap(FooterEntry); - var newFooterEntry = App.WaitForElement(FooterEntry); - var newFooterLocation = headerEntry.GetRect(); + // var newFooterEntry = App.WaitForElement(FooterEntry); + // var newFooterLocation = headerEntry.GetRect(); - ClassicAssert.AreEqual(footerLocation, newFooterLocation); - } + // ClassicAssert.AreEqual(footerLocation, newFooterLocation); + // } } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11107.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11107.cs new file mode 100644 index 000000000000..9db9f5ee9efb --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11107.cs @@ -0,0 +1,37 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue11107 : _IssuesUITest +{ + public Issue11107(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug][iOS] Shell Navigation implicitly adds Tabbar"; + + /* + [Test] + [Category(UITestCategories.Shell)] + [FailsOnIOS] + public void TabShouldntBeVisibleWhenThereIsOnlyOnePage() + { + RunTests(); + RunningApp.Tap("RunTestTabBarIsVisible"); + RunTests(); + RunningApp.Tap("RunTestTwoTabs"); + RunTests(); + + void RunTests() + { + RunningApp.WaitForElement("SecondPageLoaded"); + RunningApp.WaitForNoElement("Tab1AutomationId"); + TapBackArrow(); + RunningApp.WaitForElement("Page1Loaded"); + RunningApp.WaitForNoElement("Tab1AutomationId"); + } + } + */ +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11214.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11214.cs new file mode 100644 index 000000000000..d6fb345f39d1 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11214.cs @@ -0,0 +1,33 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue11214 : _IssuesUITest +{ + public Issue11214(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "When adding FlyoutItems during Navigating only first one is shown"; + + /* + [Test] + [Category(UITestCategories.Shell)] + [FailsOnIOS] + public void FlyoutItemChangesPropagateCorrectlyToPlatformForShellElementsNotCurrentlyActive() + { + RunningApp.WaitForElement("PageLoaded"); + TapInFlyout("ExpandMe", makeSureFlyoutStaysOpen: true); + + for (int i = 0; i < 2; i++) + RunningApp.WaitForElement($"Some Item: {i}"); + + TapInFlyout("ExpandMe", makeSureFlyoutStaysOpen: true); + + for (int i = 0; i < 2; i++) + RunningApp.WaitForNoElement($"Some Item: {i}"); + } + */ +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11244.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11244.cs new file mode 100644 index 000000000000..39de75529ec4 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11244.cs @@ -0,0 +1,25 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue11244 : _IssuesUITest +{ + public Issue11244(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug] BackButtonBehavior no longer displays on the first routed page in 4.7"; + + /* + [Test] + [Category(UITestCategories.Shell)] + [FailsOnAndroid] + [FailsOnIOS] + public void LeftToolbarItemTextDisplaysWhenFlyoutIsDisabled() + { + App.WaitForElement("Logout"); + } + */ +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11247.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11247.cs new file mode 100644 index 000000000000..909533ab4cee --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11247.cs @@ -0,0 +1,30 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue11247 : _IssuesUITest +{ + public Issue11247(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug] Shell FlyoutIsPresented not working if set in \"navigating\" handler"; + + /* + [Test] + [Category(UITestCategories.Shell)] + [FailsOnAndroid] + public void SettingFlyoutIsPresentedInNavigatingKeepsFlyoutOpen() + { + RunningApp.Tap("CloseFlyout"); + ShowFlyout(); + RunningApp.Tap("FlyoutItem 1"); + RunningApp.Tap("FlyoutItem 2"); + RunningApp.WaitForElement("FlyoutItem 1"); + RunningApp.WaitForElement("FlyoutItem 2"); + + } + */ +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11523.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11523.cs new file mode 100644 index 000000000000..93df84369363 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11523.cs @@ -0,0 +1,24 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue11523 : _IssuesUITest +{ + public Issue11523(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug] FlyoutBehavior.Disabled removes back-button from navbar"; + + // [Test] + // [Category(UITestCategories.Shell)] + // public void BackButtonStillVisibleWhenFlyoutBehaviorDisabled() + // { + // App.WaitForElement("PageLoaded"); + // App.WaitForElement(BackButtonAutomationId); + // App.Tap(BackButtonAutomationId); + // App.WaitForElement(FlyoutIconAutomationId); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11869.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11869.cs new file mode 100644 index 000000000000..4b4c51ae5006 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue11869.cs @@ -0,0 +1,41 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue11869 : _IssuesUITest +{ + public Issue11869(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug] ShellContent.IsVisible issue on Android"; + + // [Test] + // [Category(UITestCategories.Shell)] + // public void IsVisibleWorksForShowingHidingTabs() + // { + // App.WaitForElement("TopTab2"); + // App.Tap("HideTop2"); + // App.WaitForNoElement("TopTab2"); + + // App.WaitForElement("TopTab3"); + // App.Tap("HideTop3"); + // App.WaitForNoElement("TopTab3"); + + // App.WaitForElement("Tab 2"); + // App.Tap("HideBottom2"); + // App.WaitForNoElement("Tab 2"); + + // App.WaitForElement("Tab 3"); + // App.Tap("HideBottom3"); + // App.WaitForNoElement("Tab 3"); + + // App.Tap("ShowAllTabs"); + // App.WaitForElement("TopTab2"); + // App.WaitForElement("TopTab3"); + // App.WaitForElement("Tab 2"); + // App.WaitForElement("Tab 3"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12126.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12126.cs new file mode 100644 index 000000000000..27d8fe3ce502 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12126.cs @@ -0,0 +1,24 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue12126 : _IssuesUITest +{ + public Issue12126(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[iOS] TabBarIsVisible = True/False breaking for multiple nested pages"; + + // Where does TapBackArrow() come from? + // [Test] + // [Category(UITestCategories.Shell)] + // public void NavigatingBackFromMultiplePushPagesChangesTabVisibilityCorrectly() + // { + // App.WaitForElement("TestReady"); + // TapBackArrow(); + // App.WaitForElement("Tab 1"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12246.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12246.cs new file mode 100644 index 000000000000..63549c453f33 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12246.cs @@ -0,0 +1,30 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue12246 : _IssuesUITest +{ + public Issue12246(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug] iOS 14 App freezes when password is entered after email"; + + // [Test] + // [Category(UITestCategories.Entry)] + // public void UnfocusingPasswordDoesNotHang() + // { + // RunningApp.WaitForElement(Entry); + // RunningApp.WaitForElement(Password); + + // RunningApp.EnterText(Entry, "test"); + // RunningApp.DismissKeyboard(); + // RunningApp.EnterText(Password, "test"); + + // RunningApp.Tap(Entry); + // RunningApp.DismissKeyboard(); + // RunningApp.WaitForElement(Success); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12320.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12320.cs new file mode 100644 index 000000000000..ba131bd640af --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12320.cs @@ -0,0 +1,24 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue12320 : _IssuesUITest +{ + public Issue12320(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[iOS] TabBarIsVisible = True/False doesn't work on Back Navigation When using BackButtonBehavior"; + + // Where does TapBackArrow come from? + // [Test] + // [Category(UITestCategories.Shell)] + // public void PopLogicExecutesWhenUsingBackButtonBehavior() + // { + // RunningApp.WaitForElement("TestReady"); + // base.TapBackArrow(); + // RunningApp.WaitForElement("Tab 1"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12652.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12652.cs new file mode 100644 index 000000000000..8075a5910018 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12652.cs @@ -0,0 +1,34 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue12652 : _IssuesUITest +{ + public Issue12652(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug] NullReferenceException in the Shell on UWP when navigating back to Shell Section with multiple content items"; + + // [Test] + // [Category(UITestCategories.Shell)] + // public void NavigatingBackToAlreadySelectedTopTabDoesntCrash() + // { + // var location = RunningApp.WaitForElement("Top 3")[0]; + // RunningApp.TapCoordinates(location.Rect.CenterX, location.Rect.CenterY); + // RunningApp.WaitForElement("TopTabPage3"); + // RunningApp.Tap("Main 2"); + // RunningApp.WaitForElement("TopTabPage2"); + // RunningApp.Tap("Main 1"); + + // RunningApp.TapCoordinates(location.Rect.CenterX, location.Rect.CenterY); + // RunningApp.WaitForElement("TopTabPage3"); + // RunningApp.Tap("Main 2"); + // RunningApp.WaitForElement("TopTabPage2"); + // RunningApp.Tap("Main 1"); + // RunningApp.TapCoordinates(location.Rect.CenterX, location.Rect.CenterY); + // RunningApp.WaitForElement("TopTabPage3"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12685.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12685.cs new file mode 100644 index 000000000000..db6d0e46fa94 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12685.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue12685 : _IssuesUITest +{ + public Issue12685(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[iOs][Bug] TapGestureRecognizer in Path does not work on iOS"; + + // [Test] + // [Category(UITestCategories.Shape)] + // [FailsOnIOS] + // public void ShapesPathReceiveGestureRecognizers() + // { + // var testLabel = RunningApp.WaitForFirstElement(StatusLabelId); + // Assert.AreEqual(ResetStatus, testLabel.ReadText()); + // var testPath = RunningApp.WaitForFirstElement(PathId); + // var pathRect = testPath.Rect; + // RunningApp.TapCoordinates(pathRect.X + 1, pathRect.Y + 1); + // Assert.AreEqual(ClickedStatus, RunningApp.WaitForFirstElement(StatusLabelId).ReadText()); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12777.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12777.cs new file mode 100644 index 000000000000..1aea8b135fdc --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue12777.cs @@ -0,0 +1,23 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue12777 : _IssuesUITest +{ + public Issue12777(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug] CarouselView NRE if item template is not specified"; + + // [Test] + // [Category(UITestCategories.CarouselView)] + // [FailsOnIOS] + // public void Issue12777Test() + // { + // RunningApp.WaitForElement("TestCarouselView"); + // RunningApp.Screenshot("Test passed"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13203.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13203.cs new file mode 100644 index 000000000000..f0d074a2ca96 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13203.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue13203 : _IssuesUITest +{ + public Issue13203(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug] [iOS] CollectionView does not bind to items if `IsVisible=False`"; + + // [Test] + // [Category(UITestCategories.CollectionView)] + // [FailsOnIOS] + // public void CollectionShouldInvalidateOnVisibilityChange() + // { + // RunningApp.WaitForElement(Success); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1323.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1323.cs new file mode 100644 index 000000000000..d5edb85fd29c --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1323.cs @@ -0,0 +1,26 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1323 : _IssuesUITest +{ + const string Success = "Success"; + + public Issue1323(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "tabbed page BarTextColor is not pervasive and can't be applied after instantiation"; + + // [Test] + // [Category(UITestCategories.TabbedPage)] + // [FailsOnIOS] + // public void Issue1323Test() + // { + // RunningApp.WaitForElement(X => X.Marked("Page 1")); + // RunningApp.WaitForElement(X => X.Marked("Page5")); + // RunningApp.Screenshot("All tab bar items text should be white"); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1342.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1342.cs new file mode 100644 index 000000000000..c5f28df35d38 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1342.cs @@ -0,0 +1,26 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1342 : _IssuesUITest +{ + const string Success = "Success"; + + public Issue1342(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[iOS] ListView throws Exception on ObservableCollection.Add/Remove for non visible list view"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [Ignore("Fails sometimes - needs a better test")] + // public void AddingItemsToNonVisibleListViewDoesntCrash() + // { + // RunningApp.Tap(add2); + // RunningApp.Tap(add3); + // RunningApp.WaitForElement(success); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1355.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1355.cs index faad6c9f364d..dbed749a9922 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1355.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1355.cs @@ -3,27 +3,26 @@ using UITest.Appium; using UITest.Core; -namespace Microsoft.Maui.TestCases.Tests.Issues +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1355 : _IssuesUITest { - public class Issue1355 : _IssuesUITest - { - const string Success = "Success"; + const string Success = "Success"; - public Issue1355(TestDevice testDevice) : base(testDevice) - { - } + public Issue1355(TestDevice testDevice) : base(testDevice) + { + } - public override string Issue => "Setting Main Page in quick succession causes crash on Android"; + public override string Issue => "Setting Main Page in quick succession causes crash on Android"; - [Test] - [Category(UITestCategories.LifeCycle)] - [Category(UITestCategories.Compatibility)] - [FailsOnAndroid] - public void SwitchMainPageOnAppearing() - { - // Without the fix, this would crash. If we're here at all, the test passed. - App.WaitForNoElement(Success); - } + [Test] + [Category(UITestCategories.LifeCycle)] + [Category(UITestCategories.Compatibility)] + [FailsOnAndroid] + public void SwitchMainPageOnAppearing() + { + // Without the fix, this would crash. If we're here at all, the test passed. + App.WaitForNoElement(Success); } } #endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13616.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13616.cs index 8f1112b35d70..ffad8f76092f 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13616.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13616.cs @@ -3,25 +3,24 @@ using UITest.Appium; using UITest.Core; -namespace Microsoft.Maui.TestCases.Tests.Issues +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue13616 : _IssuesUITest { - public class Issue13616 : _IssuesUITest + public Issue13616(TestDevice testDevice) : base(testDevice) { - public Issue13616(TestDevice testDevice) : base(testDevice) - { - } + } - public override string Issue => "[Bug] After updating XF 5.0.0.1931 getting Java.Lang.IllegalArgumentException: Invalid target position at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod"; + public override string Issue => "[Bug] After updating XF 5.0.0.1931 getting Java.Lang.IllegalArgumentException: Invalid target position at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod"; - [Test] - [Category(UITestCategories.CarouselView)] - [Category(UITestCategories.Compatibility)] - public void Issue13616Test() - { - App.WaitForElement("AddItemButtonId"); - App.Tap("AddItemButtonId"); - App.WaitForElement("CarouselViewId"); - } + [Test] + [Category(UITestCategories.CarouselView)] + [Category(UITestCategories.Compatibility)] + public void Issue13616Test() + { + App.WaitForElement("AddItemButtonId"); + App.Tap("AddItemButtonId"); + App.WaitForElement("CarouselViewId"); } } #endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13916.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13916.cs new file mode 100644 index 000000000000..c49abc5dc68e --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue13916.cs @@ -0,0 +1,24 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue13916 : _IssuesUITest +{ + public Issue13916(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[iOS] iOS Application crashes on Back press when navigated to using GoToAsync with \"//\" or \"///\" route if 2 or more things are removed from the navigation stack"; + + // [Test] + // [Category(UITestCategories.Shell)] + // public void RemovingMoreThanOneInnerPageAndThenPushingAPageCrashes() + // { + // App.Tap("ClickMe1"); + // App.Tap("ClickMe2"); + // App.Tap("ClickMe3"); + // App.WaitForElement("Success"); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1414.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1414.cs new file mode 100644 index 000000000000..e44af754b411 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1414.cs @@ -0,0 +1,26 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1414 : _IssuesUITest +{ + public Issue1414(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "InvalidCastException when scrolling and refreshing TableView"; + + // [Test] + // [Category(UITestCategories.TableView)] + // public void InvalidCastExceptionWhenScrollingAndRefreshingTableView() + // { + // RunningApp.Screenshot("Start G1414"); + // var tableFrame = RunningApp.WaitForElement(q => q.Marked("TableView"))[0].Rect; + // RunningApp.ScrollForElement("* marked:'Row-4-24'", new Drag(tableFrame, Drag.Direction.BottomToTop, Drag.DragLength.Long)); + // RunningApp.Screenshot("Scrolled to end without crashing!"); + // RunningApp.ScrollForElement("* marked:'Row-0-0'", new Drag(tableFrame, Drag.Direction.TopToBottom, Drag.DragLength.Long)); + // RunningApp.Screenshot("Scrolled to top without crashing!"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1426.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1426.cs index 545e1c6f1f8f..6417ed971f4e 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1426.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1426.cs @@ -3,30 +3,29 @@ using UITest.Appium; using UITest.Core; -namespace Microsoft.Maui.TestCases.Tests.Issues +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1426 : _IssuesUITest { - public class Issue1426 : _IssuesUITest + public Issue1426(TestDevice testDevice) : base(testDevice) { - public Issue1426(TestDevice testDevice) : base(testDevice) - { - } + } - public override string Issue => "SetHasNavigationBar screen height wrong"; + public override string Issue => "SetHasNavigationBar screen height wrong"; - [Test] - [Category(UITestCategories.LifeCycle)] - [Category(UITestCategories.Compatibility)] - public void Github1426Test() - { - App.Screenshot("You can see the coffe mug"); - App.WaitForElement("CoffeeImageId"); - App.WaitForElement("NextButtonID"); - App.Tap("NextButtonID"); - App.WaitForElement("PopButtonId"); - App.Tap("PopButtonId"); - App.WaitForElement("CoffeeImageId"); - App.Screenshot("Coffe mug Image is still there on the bottom"); - } + [Test] + [Category(UITestCategories.LifeCycle)] + [Category(UITestCategories.Compatibility)] + public void Github1426Test() + { + App.Screenshot("You can see the coffe mug"); + App.WaitForElement("CoffeeImageId"); + App.WaitForElement("NextButtonID"); + App.Tap("NextButtonID"); + App.WaitForElement("PopButtonId"); + App.Tap("PopButtonId"); + App.WaitForElement("CoffeeImageId"); + App.Screenshot("Coffe mug Image is still there on the bottom"); } } #endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1439.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1439.cs new file mode 100644 index 000000000000..67a0485d7511 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1439.cs @@ -0,0 +1,41 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1439 : _IssuesUITest +{ + public Issue1439(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ItemTapped event for a grouped ListView is not working as expected."; + + // [Test] + // [Category(UITestCategories.TableView)] + // [FailsOnIOS] + // public void Issue1439Test() + // { + // RunningApp.WaitForElement(q => q.Marked(A)); + // RunningApp.Tap(q => q.Marked(A)); + + // Assert.AreEqual(A, RunningApp.WaitForElement(q => q.Marked(lblItem))[0].ReadText()); + // Assert.AreEqual(Group_1, RunningApp.WaitForElement(q => q.Marked(lblGroup))[0].ReadText()); + + // RunningApp.Tap(q => q.Marked(B)); + + // Assert.AreEqual(B, RunningApp.WaitForElement(q => q.Marked(lblItem))[0].ReadText()); + // Assert.AreEqual(Group_1, RunningApp.WaitForElement(q => q.Marked(lblGroup))[0].ReadText()); + + // RunningApp.Tap(q => q.Marked(C)); + + // Assert.AreEqual(C, RunningApp.WaitForElement(q => q.Marked(lblItem))[0].ReadText()); + // Assert.AreEqual(Group_2, RunningApp.WaitForElement(q => q.Marked(lblGroup))[0].ReadText()); + + // RunningApp.Tap(q => q.Marked(D)); + + // Assert.AreEqual(D, RunningApp.WaitForElement(q => q.Marked(lblItem))[0].ReadText()); + // Assert.AreEqual(Group_2, RunningApp.WaitForElement(q => q.Marked(lblGroup))[0].ReadText()); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15542.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15542.cs new file mode 100644 index 000000000000..fbb15e4f7d22 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15542.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue15542 : _IssuesUITest +{ + public Issue15542(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug] Shell.TitleView does not render on iOS 16"; + + // [Test] + // [Category(UITestCategories.TitleView)] + // public void TitleViewHeightDoesntOverflow() + // { + // var titleView = RunningApp.WaitForElement("TitleViewId")[0].Rect; + // var topTab = RunningApp.WaitForElement("page 1")[0].Rect; + + // var titleViewBottom = titleView.Y + titleView.Height; + // var topTabTop = topTab.Y; + + // Assert.GreaterOrEqual(topTabTop, titleViewBottom, "Title View is incorrectly positioned in iOS 16"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15565.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15565.cs new file mode 100644 index 000000000000..cf64fcc3948e --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue15565.cs @@ -0,0 +1,52 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.TitleView)] +public class Issue15565 : _IssuesUITest +{ + public Issue15565(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Bug] Shell TitleView and ToolBarItems rendering strange display on iOS 16"; + + // [Test] + // public void TitleViewHeightIsNotZero() + // { + // var titleView = RunningApp.WaitForElement("TitleViewId")[0].Rect; + // var topTab = RunningApp.WaitForElement("page 1")[0].Rect; + + // var titleViewBottom = titleView.Y + titleView.Height; + // var topTabTop = topTab.Y; + + // Assert.GreaterOrEqual(topTabTop, titleViewBottom, "Title View is incorrectly positioned in iOS 16"); + // } + + // [FailsOnAndroid] + // [FailsOnIOS] + // [Test] + // public void ToolbarItemsWithTitleViewAreRendering() + // { + // RunningApp.WaitForElement("Item 1"); + // RunningApp.WaitForElement("Item 3"); + // } + + // [Test] + // public void NoDuplicateTitleViews() + // { + // var titleView = RunningApp.WaitForElement("TitleViewId"); + + // Assert.AreEqual(1, titleView.Length); + + // RunningApp.Tap("page 1"); + // RunningApp.Tap("page 2"); + // RunningApp.Tap("page 3"); + + // titleView = RunningApp.WaitForElement("TitleViewId"); + + // Assert.AreEqual(1, titleView.Length); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1557.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1557.cs new file mode 100644 index 000000000000..abfcc7c3ada2 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1557.cs @@ -0,0 +1,25 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1557 : _IssuesUITest +{ + const int Delay = 3000; + + public Issue1557(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Setting source crashes if view was detached from visual tre"; + + // Maybe this one just works? Not sure where "Bug Repro's" should come from + // [Test] + // [Category(UITestCategories.ListView)] + // public void SettingSourceWhenDetachedDoesNotCrash() + // { + // Task.Delay(Delay + 1000).Wait(); + // App.WaitForElement("Bug Repro's"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1583.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1583.cs index 64d3af284ef7..95b47d2e8b10 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1583.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1583.cs @@ -2,25 +2,24 @@ using UITest.Appium; using UITest.Core; -namespace Microsoft.Maui.TestCases.Tests.Issues +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1583 : _IssuesUITest { - public class Issue1583 : _IssuesUITest + public Issue1583(TestDevice testDevice) : base(testDevice) { - public Issue1583(TestDevice testDevice) : base(testDevice) - { - } + } - public override string Issue => "NavigationPage.TitleIcon broken"; - - [Test] - [Category(UITestCategories.Navigation)] - [Category(UITestCategories.Compatibility)] - [FailsOnIOS] - [FailsOnMac] - [FailsOnWindows] - public void Issue1583TitleIconTest() - { - App.WaitForElement("lblHello"); - } + public override string Issue => "NavigationPage.TitleIcon broken"; + + [Test] + [Category(UITestCategories.Navigation)] + [Category(UITestCategories.Compatibility)] + [FailsOnIOS] + [FailsOnMac] + [FailsOnWindows] + public void Issue1583TitleIconTest() + { + App.WaitForElement("lblHello"); } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1614.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1614.cs new file mode 100644 index 000000000000..17b6e5536f94 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1614.cs @@ -0,0 +1,57 @@ +#if IOS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1614 : _IssuesUITest +{ + public Issue1614(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "iOS 11 prevents InputAccessoryView from showing in landscape mode"; + + // [Test] + // [FailsOnIOS] + // public void Issue1614Test() + // { + // RunningApp.SetOrientationPortrait(); + + // RunningApp.WaitForElement(x => x.Class("UITextField")); + // RunningApp.Tap(x => x.Class("UITextField").Index(0)); + // CheckPickerAccessory("UIPickerView"); + // RunningApp.SetOrientationLandscape(); + // CheckPickerAccessory("UIPickerView"); + // RunningApp.SetOrientationPortrait(); + // RunningApp.DismissKeyboard(); + + // RunningApp.Tap(x => x.Class("UITextField").Index(1)); + // CheckPickerAccessory("UIDatePicker"); + // RunningApp.SetOrientationLandscape(); + // CheckPickerAccessory("UIDatePicker"); + // RunningApp.SetOrientationPortrait(); + // RunningApp.DismissKeyboard(); + + // RunningApp.Tap(x => x.Class("UITextField").Index(2)); + // CheckPickerAccessory("UIDatePicker"); + // RunningApp.SetOrientationLandscape(); + // CheckPickerAccessory("UIDatePicker"); + // RunningApp.SetOrientationPortrait(); + // RunningApp.DismissKeyboard(); + // } + + // private void CheckPickerAccessory(string className) + // { + // RunningApp.WaitForElement(x => x.Class("UIButtonLabel")); + // var buttonRect = RunningApp.Query(x => x.Class("UIButtonLabel"))[0].Rect; + // var pickerRect = RunningApp.Query(x => x.Class(className))[0].Rect; + + // var buttonBottom = buttonRect.Y + buttonRect.Height; + // var pickerTop = pickerRect.Y; + + // Assert.IsTrue(buttonBottom <= pickerTop); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1658.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1658.cs new file mode 100644 index 000000000000..53efe9b30cee --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1658.cs @@ -0,0 +1,30 @@ +#if MACCATALYST +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1658 : _IssuesUITest +{ + public Issue1658(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[macOS] GestureRecognizer on ListView Item not working"; + + // [Test] + // [Category(UITestCategories.ListView)] + // public void ContextActionsIconImageSource() + // { + // RunningApp.ActivateContextMenu("ListViewItem"); + // RunningApp.WaitForElement("coffee.png"); + // RunningApp.DismissContextMenu(); + + // RunningApp.WaitForElement("ColorBox"); + // RunningApp.Screenshot("Box should be red"); + // RunningApp.Tap("ColorBox"); + // RunningApp.Screenshot("Box should be yellow"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1700.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1700.cs index 4c48bb1bc30d..e55810e3285d 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1700.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1700.cs @@ -2,32 +2,31 @@ using UITest.Appium; using UITest.Core; -namespace Microsoft.Maui.TestCases.Tests.Issues +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1700 : _IssuesUITest { - public class Issue1700 : _IssuesUITest - { - const string Success = "Success"; + const string Success = "Success"; - public Issue1700(TestDevice testDevice) : base(testDevice) - { - } + public Issue1700(TestDevice testDevice) : base(testDevice) + { + } - public override string Issue => "Image fails loading from long URL"; + public override string Issue => "Image fails loading from long URL"; - [Test] - [Category(UITestCategories.Image)] - [Category(UITestCategories.Compatibility)] - [FailsOnIOS] - [FailsOnMac] - [FailsOnWindows] - public void LongImageURLsShouldNotCrash() - { - // Give the images some time to load (or fail) - Task.Delay(3000).Wait(); + [Test] + [Category(UITestCategories.Image)] + [Category(UITestCategories.Compatibility)] + [FailsOnIOS] + [FailsOnMac] + [FailsOnWindows] + public void LongImageURLsShouldNotCrash() + { + // Give the images some time to load (or fail) + Task.Delay(3000).Wait(); - // If we can see this label at all, it means we didn't crash and the test is successful - App.WaitForNoElement(Success); - } + // If we can see this label at all, it means we didn't crash and the test is successful + App.WaitForNoElement(Success); } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1704.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1704.cs new file mode 100644 index 000000000000..d25cb882b655 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1704.cs @@ -0,0 +1,36 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1704 : _IssuesUITest +{ + public Issue1704(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Enhancement] Basic GIF animation features"; + + // [Test] + // [Category(UITestCategories.TabbedPage)] + // [Category(UITestCategories.ManualReview)] + // public void Issue1704Test() + // { + // RunningApp.WaitForElement("On Load"); + // RunningApp.WaitForElement("On Start"); + // RunningApp.WaitForElement("Source"); + // RunningApp.WaitForElement("Misc"); + + // RunningApp.Tap(q => q.Marked("On Load")); + // RunningApp.Tap(q => q.Marked("On Start")); + // RunningApp.WaitForElement(q => q.Marked("Start Animation")); + // RunningApp.Tap(q => q.Marked("Start Animation")); + // RunningApp.Tap(q => q.Marked("Stop Animation")); + + // RunningApp.Tap(q => q.Marked("Misc")); + // RunningApp.WaitForElement(q => q.Marked("Start Animation")); + // RunningApp.Tap(q => q.Marked("Start Animation")); + // RunningApp.Tap(q => q.Marked("Stop Animation")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1763.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1763.cs new file mode 100644 index 000000000000..2fb9d273944c --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1763.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1763 : _IssuesUITest +{ + public Issue1763(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "First item of grouped ListView not firing .ItemTapped"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // [FailsOnAndroid] + // public void TestIssue1763ItemTappedFiring() + // { + // RunningApp.WaitForElement(q => q.Marked("Contacts")); + // RunningApp.Tap(q => q.Marked("Egor1")); + // RunningApp.WaitForElement(q => q.Marked("Tapped a List item")); + // RunningApp.Tap(q => q.Marked("Destruction")); + // RunningApp.WaitForElement(q => q.Marked("Contacts")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1769.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1769.cs index e250c2975f5e..dd5b0735c5ad 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1769.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1769.cs @@ -2,33 +2,32 @@ using UITest.Appium; using UITest.Core; -namespace Microsoft.Maui.TestCases.Tests.Issues +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1769 : _IssuesUITest { - public class Issue1769 : _IssuesUITest - { - const string GoToPageTwoButtonText = "Go To Page 2"; - const string SwitchAutomatedId = nameof(SwitchAutomatedId); - const string SwitchIsNowLabelTextFormat = "Switch is now {0}"; + const string GoToPageTwoButtonText = "Go To Page 2"; + const string SwitchAutomatedId = nameof(SwitchAutomatedId); + const string SwitchIsNowLabelTextFormat = "Switch is now {0}"; - public Issue1769(TestDevice testDevice) : base(testDevice) - { - } + public Issue1769(TestDevice testDevice) : base(testDevice) + { + } - public override string Issue => "PushAsync with Switch produces NRE"; + public override string Issue => "PushAsync with Switch produces NRE"; - [Test] - [Category(UITestCategories.Switch)] - [Category(UITestCategories.Compatibility)] - [FailsOnAllPlatforms] - public void Issue1769Test() - { - App.WaitForElement(GoToPageTwoButtonText); - App.Tap(GoToPageTwoButtonText); + [Test] + [Category(UITestCategories.Switch)] + [Category(UITestCategories.Compatibility)] + [FailsOnAllPlatforms] + public void Issue1769Test() + { + App.WaitForElement(GoToPageTwoButtonText); + App.Tap(GoToPageTwoButtonText); - App.WaitForElement(SwitchAutomatedId); - App.WaitForElement(string.Format(SwitchIsNowLabelTextFormat, false)); - App.Tap(SwitchAutomatedId); - App.WaitForElement(string.Format(SwitchIsNowLabelTextFormat, true)); - } + App.WaitForElement(SwitchAutomatedId); + App.WaitForElement(string.Format(SwitchIsNowLabelTextFormat, false)); + App.Tap(SwitchAutomatedId); + App.WaitForElement(string.Format(SwitchIsNowLabelTextFormat, true)); } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1777.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1777.cs new file mode 100644 index 000000000000..23fd35c0ca49 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1777.cs @@ -0,0 +1,27 @@ +#if WINDOWS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1777 : _IssuesUITest +{ + public Issue1777(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Adding picker items when picker is in a ViewCell breaks"; + + // [Test] + // [Category(UITestCategories.TableView)] + // public void Issue1777Test() + // { + // RunningApp.WaitForElement(q => q.Button(_btnText)); + // RunningApp.Tap(q => q.Button(_btnText)); + // RunningApp.Tap(q => q.Marked(_pickerTableId)); + // RunningApp.WaitForElement(q => q.Marked("test 0")); + // RunningApp.Screenshot("Picker is displayed correctly in the ViewCell"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1851.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1851.cs index 978680e4e1b5..e9034e9ddb37 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1851.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1851.cs @@ -2,29 +2,28 @@ using UITest.Appium; using UITest.Core; -namespace Microsoft.Maui.TestCases.Tests.Issues +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1851 : _IssuesUITest { - public class Issue1851 : _IssuesUITest + public Issue1851(TestDevice testDevice) : base(testDevice) { - public Issue1851(TestDevice testDevice) : base(testDevice) - { - } + } - public override string Issue => "ObservableCollection in ListView gets Index out of range when removing item"; + public override string Issue => "ObservableCollection in ListView gets Index out of range when removing item"; - [Test] - [Category(UITestCategories.ListView)] - [Category(UITestCategories.Compatibility)] - [FailsOnIOS] - [FailsOnMac] - [FailsOnWindows] - public void Issue1851Test() - { - App.WaitForElement("btn"); - App.Tap("btn"); - App.WaitForElement("btn"); - App.Tap("btn"); - App.WaitForElement("btn"); - } + [Test] + [Category(UITestCategories.ListView)] + [Category(UITestCategories.Compatibility)] + [FailsOnIOS] + [FailsOnMac] + [FailsOnWindows] + public void Issue1851Test() + { + App.WaitForElement("btn"); + App.Tap("btn"); + App.WaitForElement("btn"); + App.Tap("btn"); + App.WaitForElement("btn"); } } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1875.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1875.cs new file mode 100644 index 000000000000..2d6646a2e991 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1875.cs @@ -0,0 +1,24 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1875 : _IssuesUITest +{ + public Issue1875(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "NSRangeException adding items through ItemAppearing"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void NSRangeException() + // { + // RunningApp.WaitForElement(q => q.Marked("Load")); + // RunningApp.Tap(q => q.Marked("Load")); + // RunningApp.WaitForElement(q => q.Marked("5")); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1909.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1909.cs index 985c824c121d..e67b083fab56 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1909.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1909.cs @@ -12,15 +12,15 @@ public Issue1909(TestDevice testDevice) : base(testDevice) public override string Issue => "Xamarin.forms 2.5.0.280555 and android circle button issue"; - [Test] - [Category(UITestCategories.Button)] - [Category(UITestCategories.Compatibility)] - [FailsOnIOS] - [FailsOnMac] - public void Issue1909Test() - { - App.WaitForElement("TestReady"); - App.Screenshot("I am at Issue 1909"); - } + // [Test] + // [Category(UITestCategories.Button)] + // [Category(UITestCategories.Compatibility)] + // [FailsOnIOS] + // [FailsOnMac] + // public void Issue1909Test() + // { + // App.WaitForElement("TestReady"); + // App.Screenshot("I am at Issue 1909"); + // } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19283.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19283.cs index 368fedfa957e..ec19aeed0ba8 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19283.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19283.cs @@ -10,13 +10,13 @@ public Issue19283(TestDevice device) : base(device) { } public override string Issue => "PointerOver VSM Breaks Button"; - [Test] - [Category(UITestCategories.Button)] - public void ButtonStillWorksWhenItHasPointerOverVSMSet() - { - App.WaitForElement("btn"); - App.Tap("btn"); - App.WaitForElement("Success"); - } + // [Test] + // [Category(UITestCategories.Button)] + // public void ButtonStillWorksWhenItHasPointerOverVSMSet() + // { + // App.WaitForElement("btn"); + // App.Tap("btn"); + // App.WaitForElement("Success"); + // } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1939.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1939.cs new file mode 100644 index 000000000000..e1d32e0bf8a3 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue1939.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue1939 : _IssuesUITest +{ + public Issue1939(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ArgumentOutOfRangeException on clearing a group on a grouped ListView on Android"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Issue1939Test() + // { + // RunningApp.WaitForElement(q => q.Marked("Group #1")); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue198.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue198.cs new file mode 100644 index 000000000000..5b7b6c86c638 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue198.cs @@ -0,0 +1,41 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue198 : _IssuesUITest +{ + public Issue198(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "TabbedPage shouldn't proxy content of NavigationPage"; + + // [Test] + // [Category(UITestCategories.TabbedPage)] + // [FailsOnIOS] + // public void Issue198TestsNREWithPopModal() + // { + // RunningApp.WaitForElement(q => q.Marked("Page One")); + // RunningApp.WaitForElement(q => q.Button("Leave")); + // RunningApp.Screenshot("All Elements Present"); + + // RunningApp.Tap(q => q.Marked("Leave")); + // RunningApp.Screenshot("Clicked Leave"); + + // RunningApp.WaitForElement(q => q.Marked("Bug Repro's")); + // #if !__MACOS__ + // RunningApp.ClearText(q => q.Raw("* marked:'SearchBarGo'")); + // RunningApp.EnterText(q => q.Raw("* marked:'SearchBarGo'"), "G198"); + // #endif + // RunningApp.Tap(q => q.Marked("SearchButton")); + // RunningApp.Screenshot("Navigate into gallery again"); + + // RunningApp.WaitForElement(q => q.Marked("Page Three")); + // RunningApp.Tap(q => q.Marked("Page Three")); + + // RunningApp.WaitForElement(q => q.Marked("No Crash")); + // RunningApp.Screenshot("App did not crash"); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2266.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2266.cs new file mode 100644 index 000000000000..8eb3cbf522c9 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2266.cs @@ -0,0 +1,34 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2266 : _IssuesUITest +{ + public Issue2266(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Setting a different Detail page from a FlyoutPage after 2nd time on MainPage"; + + // [Test] + // [Category(UITestCategories.Navigation)] + // [FailsOnIOS] + // public void SwapMainPageWithFlyoutPages() + // { + // RunningApp.WaitForElement(q => q.Text("FlyoutPage Navigation")); + // RunningApp.Tap(q => q.Text("FlyoutPage Navigation")); + // RunningApp.Tap(q => q.Marked("OpenMaster")); + // RunningApp.Tap(q => q.Text("Page 1")); + // RunningApp.Tap(q => q.Text("START")); + // RunningApp.Tap(q => q.Text("FlyoutPage Navigation ->> Page 1")); + // RunningApp.WaitForElement(q => q.Text("Page 1")); + // RunningApp.Tap(q => q.Text("START")); + // RunningApp.Tap(q => q.Text("FlyoutPage Navigation ->> Page 2")); + // RunningApp.WaitForElement(q => q.Text("Page 2")); + // RunningApp.Tap(q => q.Text("START")); + // RunningApp.Tap(q => q.Text("FlyoutPage Navigation ->> Page 3")); + // RunningApp.WaitForElement(q => q.Text("Page 3")); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2272.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2272.cs new file mode 100644 index 000000000000..716aa2051a7e --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2272.cs @@ -0,0 +1,41 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2272 : _IssuesUITest +{ + public Issue2272(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Setting a different Detail page from a FlyoutPage after 2nd time on MainPage"; + + // [Test] + // [Category(UITestCategories.Navigation)] + // [FailsOnIOS] + // #if MACCATALYST // Check if this is still try for MAUI? + // [Ignore("EnterText problems in UITest Desktop")] + // #endif + // public void TestFocusIsOnTheEndAfterSettingText () + // { + // RunningApp.WaitForElement("userNameEditorEmptyString"); + // RunningApp.Tap (c => c.Marked ("userNameEditorEmptyString")); + // RunningApp.EnterText ("1"); + // PressEnter (); + // var q = RunningApp.Query(c => c.Marked("userNameEditorEmptyString")); + // Assert.AreEqual("focused1", q[0].Text); + // } + + // void PressEnter () + // { + // var androidApp = RunningApp as AndroidApp; + // if (androidApp != null) { + // androidApp.PressUserAction (UserAction.Done); + // } + // else { + // RunningApp.PressEnter (); + // } + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2414.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2414.cs new file mode 100644 index 000000000000..5bb5d78f0fff --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2414.cs @@ -0,0 +1,35 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2414 : _IssuesUITest +{ + public Issue2414(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "NullReferenceException when swiping over Context Actions"; + + // [Test] + // [Category(UITestCategories.TableView)] + // [FailsOnIOS] + // public void TestDoesntCrashShowingContextMenu() + // { + // RunningApp.ActivateContextMenu("Swipe ME"); + // RunningApp.WaitForElement(c => c.Marked("Text0")); + // RunningApp.Screenshot("Didn't crash"); + // RunningApp.Tap(c => c.Marked("Text0")); + // } + + // [Test] + // [FailsOnIOS] + // public void TestShowContextMenuItemsInTheRightOrder() + // { + // RunningApp.ActivateContextMenu("Swipe ME"); + // RunningApp.WaitForElement(c => c.Marked("Text0")); + // RunningApp.Screenshot("Are the menuitems in the right order?"); + // RunningApp.Tap(c => c.Marked("Text0")); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2499.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2499.cs new file mode 100644 index 000000000000..790536638a56 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2499.cs @@ -0,0 +1,38 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2499 : _IssuesUITest +{ + public Issue2499(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Binding Context set to Null in Picker"; + + // [Test] + // [Category(UITestCategories.Picker)] + // [FailsOnIOS] + // public void Issue2499Test() + // { + // RunningApp.WaitForElement("picker"); + // RunningApp.Tap("picker"); + // RunningApp.WaitForElement("cat"); + + // AppResult[] items = RunningApp.Query("cat"); + // Assert.AreNotEqual(items.Length, 0); + // RunningApp.WaitForElement(q => q.Marked("mouse")); + // RunningApp.Tap("mouse"); + // #if __IOS__ + // System.Threading.Tasks.Task.Delay(500).Wait(); + // var cancelButtonText = "Done"; + // RunningApp.WaitForElement(q => q.Marked(cancelButtonText)); + // RunningApp.Tap(q => q.Marked(cancelButtonText)); + // System.Threading.Tasks.Task.Delay(1000).Wait(); + // #endif + // items = RunningApp.Query("cat"); + // Assert.AreEqual(items.Length, 0); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2597.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2597.cs new file mode 100644 index 000000000000..e9210e212f01 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2597.cs @@ -0,0 +1,37 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2597 : _IssuesUITest +{ + public Issue2597(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Stepper control .IsEnabled doesn't work"; + + // [Test] + // [Category(UITestCategories.Stepper)] + // [FailsOnIOS] +// public void Issue2597Test() +// { +// #if __IOS__ +// RunningApp.Tap(x => x.Marked("Increment")); +// #else +// RunningApp.Tap("+"); +// #endif + +// RunningApp.WaitForElement(q => q.Marked("Stepper value is 0")); + + +// #if __IOS__ +// RunningApp.Tap(x => x.Marked("Decrement")); +// #else +// RunningApp.Tap("−"); +// #endif + +// RunningApp.WaitForElement(q => q.Marked("Stepper value is 0")); +// } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue264.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue264.cs new file mode 100644 index 000000000000..a952cb633a1e --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue264.cs @@ -0,0 +1,36 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue264 : _IssuesUITest +{ + public Issue264(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "PopModal NRE"; + + // [Test] + // [Category(UITestCategories.DisplayAlert)] + // [FailsOnIOS] + // public void Issue264TestsPushAndPopModal() + // { + // RunningApp.WaitForElement(q => q.Marked("Home")); + // RunningApp.WaitForElement(q => q.Button("About")); + // RunningApp.Screenshot("All elements present"); + + // RunningApp.Tap(q => q.Button("About")); + // RunningApp.WaitForElement(q => q.Button("Close")); + // RunningApp.Screenshot("Modal pushed"); + + // RunningApp.Tap(q => q.Button("Close")); + // RunningApp.WaitForElement(q => q.Button("About")); + // RunningApp.Screenshot("Modal popped"); + + // RunningApp.Tap(q => q.Button("Pop me")); + // RunningApp.WaitForElement(q => q.Marked("Bug Repro's")); + // RunningApp.Screenshot("No crash"); + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2681.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2681.cs new file mode 100644 index 000000000000..f626004dcf6b --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2681.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2681 : _IssuesUITest +{ + public Issue2681(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[UWP] Label inside Listview gets stuck inside infinite loop"; + + // [Test] + // [Category(UITestCategories.ListView)] + // public void ListViewDoesntFreezeApp() + // { + // RunningApp.Tap(x => x.Marked(NavigateToPage)); + // RunningApp.WaitForElement("3"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2740.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2740.cs new file mode 100644 index 000000000000..9cf465bc41f9 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2740.cs @@ -0,0 +1,25 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2740 : _IssuesUITest +{ + public Issue2740(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "System.NotSupportedException: Unable to activate instance of type Microsoft.Maui.Controls.Platform.Android.PageContainer from native handle"; + + // [Test] + // [Category(UITestCategories.LifeCycle)] + // public void Issue2740Test() + // { + // RunningApp.WaitForElement(q => q.Marked("1")); + // RunningApp.Tap(q => q.Marked("1")); + // RunningApp.WaitForElement(q => q.Marked("Switch")); + // RunningApp.Tap(q => q.Marked("Switch")); + // RunningApp.WaitForElement(q => q.Marked("1")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2767.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2767.cs new file mode 100644 index 000000000000..941721c01fa9 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2767.cs @@ -0,0 +1,23 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2767 : _IssuesUITest +{ + public Issue2767(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ArgumentException: NaN not valid for height"; + + // [Test] + // [Category(UITestCategories.Grid)] + // [FailsOnIOS] + // public void Issue2767Test() + // { + // RunningApp.WaitForElement("Label 1:1"); + // Assert.IsEmpty(RunningApp.Query("Collapsed")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2794.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2794.cs new file mode 100644 index 000000000000..046ab4ecbac3 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2794.cs @@ -0,0 +1,30 @@ +#if ANDROID +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2794 : _IssuesUITest +{ + public Issue2794(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "TableView does not react on underlying collection change"; + + // [Test] + // [Category(UITestCategories.TableView)] + // [FailsOnAndroid] + // public void Issue2794Test() + // { + // RunningApp.TouchAndHold(x => x.Marked("Cell2")); + // RunningApp.Tap(x => x.Text("Delete me first")); + // RunningApp.WaitForNoElement(q => q.Marked("Cell2")); + + // RunningApp.TouchAndHold(x => x.Marked("Cell1")); + // RunningApp.Tap(x => x.Text("Delete me after")); + // RunningApp.WaitForNoElement(q => q.Marked("Cell1")); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2809.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2809.cs new file mode 100644 index 000000000000..c43091257800 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2809.cs @@ -0,0 +1,34 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2809 : _IssuesUITest +{ + public Issue2809(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Secondary ToolbarItems cause app to hang during PushAsync"; + + // [Test] + // [Category(UITestCategories.DisplayAlert)] + // [FailsOnIOS] + // public void TestPageDoesntCrash() + // { + // ShouldShowMenu(); + // RunningApp.Tap(c => c.Marked("Item 1")); + // RunningApp.Screenshot("Didn't crash"); + // } + + // void ShouldShowMenu() + // { + // #if ANDROID + // //show secondary menu + // RunningApp.TapOverflowMenuButton(); + // #elif WINDOWS + // RunningApp.Tap ("MoreButton"); + // #endif + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2818.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2818.cs new file mode 100644 index 000000000000..606524793b77 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2818.cs @@ -0,0 +1,70 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.FlyoutPage)] +public class Issue2818 : _IssuesUITest +{ + public Issue2818(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Right-to-Left FlyoutPage in Xamarin.Forms Hamburger icon issue"; + +// [Test] +// public void RootViewMovesAndContentIsVisible() +// { +// var idiom = RunningApp.WaitForElement("Idiom"); + +// // This behavior is currently broken on a phone device Issue 7270 +// if (idiom[0].ReadText() != "Tablet") +// return; + +// RunningApp.Tap("OpenRootView"); +// RunningApp.Tap("CloseRootView"); +// RunningApp.SetOrientationLandscape(); +// RunningApp.Tap("OpenRootView"); +// var positionStart = RunningApp.WaitForElement("CloseRootView"); +// RunningApp.Tap("ShowLeftToRight"); + +// var results = RunningApp.QueryUntilPresent(() => +// { +// var secondPosition = RunningApp.Query("CloseRootView"); + +// if (secondPosition.Length == 0) +// return null; + +// if (secondPosition[0].Rect.X < positionStart[0].Rect.X) +// return secondPosition; + +// return null; +// }); + +// Assert.IsNotNull(results, "Flyout View Did not change flow direction correctly"); +// Assert.AreEqual(1, results.Length, "Flyout View Did not change flow direction correctly"); + +// } + +// #if __IOS__ +// [Test] +// public void RootViewSizeDoesntChangeAfterBackground() +// { +// var idiom = RunningApp.WaitForElement("Idiom"); +// // This behavior is currently broken on a phone device Issue 7270 +// if (idiom[0].ReadText() != "Tablet") +// return; + +// RunningApp.SetOrientationLandscape(); +// RunningApp.Tap("CloseRootView"); +// RunningApp.Tap("ShowLeftToRight"); +// var windowSize = RunningApp.WaitForElement("RootLayout")[0]; +// RunningApp.SendAppToBackground(TimeSpan.FromSeconds(5)); +// var newWindowSize = RunningApp.WaitForElement("RootLayout")[0]; +// Assert.AreEqual(newWindowSize.Rect.Width, windowSize.Rect.Width); +// Assert.AreEqual(newWindowSize.Rect.Height, windowSize.Rect.Height); + +// } +// #endif +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2883.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2883.cs new file mode 100644 index 000000000000..053980a9ea59 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2883.cs @@ -0,0 +1,42 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.TableView)] +public class Issue2883 : _IssuesUITest +{ + public Issue2883(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ViewCell IsEnabled set to false does not disable a cell in a TableView"; + + // [UITests.FailsOnIOS] + // [Test] + // public void Issue2883TestDisabled () + // { + // RunningApp.Screenshot ("I am at Issue 2883"); + // RunningApp.Tap( c=> c.Marked("btnCustomCellTable")); + // RunningApp.WaitForNoElement( c=> c.Marked("Clicked")); + // RunningApp.Screenshot ("I dont see the disable cell"); + // RunningApp.Tap( c=> c.Marked("btnCustomCellListView")); + // RunningApp.WaitForNoElement( c=> c.Marked("Clicked")); + // RunningApp.Screenshot ("I dont see the disable cell"); + // } + + // [UITests.FailsOnIOS] + // [Test] + // public void Issue2883TestEnabled () + // { + + // RunningApp.Tap( c=> c.Marked("btnCustomCellTableEnabled")); + // RunningApp.Screenshot ("I see the cell that is enabled"); + // RunningApp.WaitForElement( c=> c.Marked("Clicked")); + // RunningApp.Tap (c => c.Marked ("ok")); + // RunningApp.Tap( c=> c.Marked("btnCustomCellListViewEnabled")); + // RunningApp.WaitForElement( c=> c.Marked("Clicked")); + // RunningApp.Tap (c => c.Marked ("ok")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2894.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2894.cs new file mode 100644 index 000000000000..49acfe1be3ae --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2894.cs @@ -0,0 +1,73 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2894 : _IssuesUITest +{ + public Issue2894(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Gesture Recognizers added to Span after it's been set to FormattedText don't work and can cause an NRE"; + +// [FailsOnAndroid] +// [FailsOnIOS] +// [Test] +// [Category(UITestCategories.Gestures)] +// public void VariousSpanGesturePermutation() +// { +// RunningApp.WaitForElement($"{kGesture1}0"); +// RunningApp.WaitForElement($"{kGesture2}0"); +// var labelId = RunningApp.WaitForElement(kLabelAutomationId); +// var target = labelId.First().Rect; + + +// for (int i = 1; i < 5; i++) +// { +// RunningApp.Tap($"TestSpan{i}"); + +// // These tap retries work around a Tap Coordinate bug +// // with Xamarin.UITest >= 3.0.7 +// int tapAttempts = 0; +// do +// { +// RunningApp.TapCoordinates(target.X + 5, target.Y + 5); +// if (tapAttempts == 4) +// RunningApp.WaitForElement($"{kGesture1}{i}"); + +// tapAttempts++; +// } while (RunningApp.Query($"{kGesture1}{i}").Length == 0); + +// tapAttempts = 0; + +// do +// { +// #if WINDOWS +// RunningApp.TapCoordinates(target.X + target.Width - 10, target.Y + 2); +// #else +// RunningApp.TapCoordinates(target.X + target.CenterX, target.Y + 2); +// #endif +// if (tapAttempts == 4) +// RunningApp.WaitForElement($"{kGesture1}{i}"); + +// tapAttempts++; + +// } while (RunningApp.Query($"{kGesture2}{i}").Length == 0); +// } + + +// RunningApp.Tap($"TestSpan5"); +// RunningApp.TapCoordinates(target.X + 5, target.Y + 5); + +// #if WINDOWS +// RunningApp.TapCoordinates(target.X + target.Width - 10, target.Y + 2); +// #else +// RunningApp.TapCoordinates(target.X + target.CenterX, target.Y + 2); +// #endif + +// RunningApp.WaitForElement($"{kGesture1}4"); +// RunningApp.WaitForElement($"{kGesture2}4"); +// } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2923.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2923.cs new file mode 100644 index 000000000000..c24ea142715d --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2923.cs @@ -0,0 +1,30 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +[Category(UITestCategories.TabbedPage)] +public class Issue2923 : _IssuesUITest +{ + public Issue2923(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "First tab does not load until navigating"; + + // [Test] + // public void Issue2923TestOne() + // { + // RunningApp.WaitForElement(q => q.Marked("FirstPageLabel")); + // RunningApp.Screenshot("First Tab is showing"); + // } + + // [Test] + // public void Issue2923TestTwo() + // { + // RunningApp.Tap(q => q.Marked("ResetButton")); + // RunningApp.Screenshot("Tabs Reset"); + // RunningApp.WaitForElement(q => q.Marked("ResetPageLabel")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2927.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2927.cs new file mode 100644 index 000000000000..1eaff7f76ba4 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2927.cs @@ -0,0 +1,35 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2927 : _IssuesUITest +{ + public Issue2927(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ListView item tapped not firing multiple times"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Issue2927Test() + // { + // RunningApp.Screenshot("I am at Issue 2927"); + // RunningApp.WaitForElement(q => q.Marked("Cell1 0")); + // RunningApp.Tap(q => q.Marked("Cell1 0")); + // RunningApp.WaitForElement(q => q.Marked("Cell1 1")); + // RunningApp.Screenshot("Tapped Once"); + // RunningApp.Tap(q => q.Marked("Cell1 1")); + // RunningApp.WaitForElement(q => q.Marked("Cell1 2")); + // RunningApp.Screenshot("Tapped Twice"); + // RunningApp.Tap(q => q.Marked("Cell3 0")); + // RunningApp.WaitForElement(q => q.Marked("Cell3 1")); + // RunningApp.Screenshot("Click other cell"); + // RunningApp.Tap(q => q.Marked("Cell1 2")); + // RunningApp.WaitForElement(q => q.Marked("Cell1 3")); + // RunningApp.Screenshot("Click first cell again"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2948.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2948.cs new file mode 100644 index 000000000000..89713c73c098 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2948.cs @@ -0,0 +1,55 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2948 : _IssuesUITest +{ + public Issue2948(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "FlyoutPage Detail is interactive even when Flyout is open when in Landscape"; + + // [Test] + // [Category(UITestCategories.FlyoutPage)] + // public void Issue2948Test() + // { + // RunningApp.Screenshot("I am at Issue 2948"); + // RunningApp.SetOrientationLandscape(); + // Thread.Sleep(5000); + // if (ShouldRunTest()) + // { + // OpenMDP(); + // var btns = RunningApp.Query(c => c.Marked("btnOnDetail")); + // if (btns.Length > 0) + // { + // // on iOS the button could be out of screen + // RunningApp.Tap(c => c.Marked("btnOnDetail")); + // RunningApp.Screenshot("I in landscape and flyout is open"); + // } + // RunningApp.WaitForNoElement(c => c.Marked("Clicked"), "Time out", new TimeSpan(0, 0, 1)); + // } + // } + + // public bool ShouldRunTest() + // { + // var isMasterVisible = RunningApp.Query(q => q.Marked("Leads")).Length > 0; + // return !isMasterVisible; + // } + // public void OpenMDP() + // { + // #if __IOS__ + // RunningApp.Tap(q => q.Marked("Menu")); + // #else + // RunningApp.Tap ("ShowFlyoutBtn"); + // #endif + // } + + // [TearDown] + // public void TestTearDown() + // { + // RunningApp.SetOrientationPortrait(); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2953.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2953.cs new file mode 100644 index 000000000000..5276c12b8a5d --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2953.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2953 : _IssuesUITest +{ + public Issue2953(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "GroupHeaderCells disappear when item is removed from a group in ListView (iOS only) "; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Issue2953Test() + // { + // RunningApp.Screenshot("I am at Issue 2953"); + // RunningApp.WaitForElement(q => q.Marked("Header 3")); + // RunningApp.Screenshot("I see the Header 3"); + // RunningApp.Tap(q => q.Marked("btnRemove")); + // RunningApp.WaitForElement(q => q.Marked("Header 3")); + // RunningApp.Screenshot("I still see the Header 3"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2954.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2954.cs new file mode 100644 index 000000000000..762ae9cb82fe --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2954.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2954 : _IssuesUITest +{ + public Issue2954(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Cell becomes empty after adding a new one with context actions (TableView) "; + + // [Test] + // [Category(UITestCategories.TableView)] + // [FailsOnIOS] + // public void Issue2954Test() + // { + // RunningApp.Screenshot("I am at Issue 2954"); + // RunningApp.WaitForElement(q => q.Marked("Cell2")); + // RunningApp.Screenshot("I see the Cell2"); + // RunningApp.Tap(c => c.Marked("Add new")); + // RunningApp.WaitForElement(q => q.Marked("Cell2")); + // RunningApp.Screenshot("I still see the Cell2"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2964.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2964.cs new file mode 100644 index 000000000000..5b280ab81450 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2964.cs @@ -0,0 +1,33 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2964 : _IssuesUITest +{ + public Issue2964(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "TabbedPage toolbar item crash"; + + // [Test] + // [Category(UITestCategories.ToolbarItem)] + // public void Issue2964Test() + // { + // RunningApp.Screenshot("I am at Issue 2964"); + + // RunningApp.Tap(q => q.Marked("FlyoutButton")); + // RunningApp.Screenshot("Create new Detail instance"); + + // RunningApp.Tap(q => q.Marked("Page1PushModalButton")); + // RunningApp.Screenshot("Modal is pushed"); + + // RunningApp.Tap(q => q.Marked("ModalPagePopButton")); + // RunningApp.Screenshot("Modal is popped"); + + // RunningApp.WaitForElement(q => q.Marked("Page1Label")); + // RunningApp.Screenshot("Didn't blow up! :)"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2976.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2976.cs new file mode 100644 index 000000000000..f2ccf8236696 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2976.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2976 : _IssuesUITest +{ + public Issue2976(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Sample 'WorkingWithListviewNative' throw Exception on Xam.Android project."; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnAndroid] + // [FailsOnIOS] + // public void Issue1Test() + // { + // RunningApp.Screenshot("I am at Issue 2976"); + // RunningApp.Tap(q => q.Marked("DEMOA")); + // RunningApp.Tap(q => q.Marked("DEMOB")); + // RunningApp.Tap(q => q.Marked("DEMOC")); + // RunningApp.Tap(q => q.Marked("DEMOD")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2981.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2981.cs new file mode 100644 index 000000000000..3451d560564d --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2981.cs @@ -0,0 +1,30 @@ +#if !WINDOWS +// This test won't work on Windows right now because we can only test desktop, so touch events +// (like LongPress) don't really work. The test should work manually on a touch screen, though. +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2981 : _IssuesUITest +{ + public Issue2981(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Long Press on ListView causes crash"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Issue2981Test() + // { + // RunningApp.Screenshot("I am at Issue 1"); + // RunningApp.TouchAndHold(q => q.Marked("Cell1")); + // RunningApp.Screenshot("Long Press first cell"); + // RunningApp.TouchAndHold(q => q.Marked("Cell2")); + // RunningApp.Screenshot("Long Press second cell"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2993.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2993.cs new file mode 100644 index 000000000000..8dfbe01c66e8 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue2993.cs @@ -0,0 +1,23 @@ +#if !ANDROID +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue2993 : _IssuesUITest +{ + public Issue2993(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Android] Bottom Tab Bar with a navigation page is hiding content"; + + // [Test] + // [Category(UITestCategories.Layout)] + // public void BottomContentVisibleWithBottomBarAndNavigationPage() + // { + // RunningApp.WaitForElement("Bottom Text"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3001.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3001.cs index e26c2b8827e9..0721b9071d63 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3001.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3001.cs @@ -3,28 +3,27 @@ using UITest.Appium; using UITest.Core; -namespace Microsoft.Maui.TestCases.Tests.Issues +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3001 : _IssuesUITest { - public class Issue3001 : _IssuesUITest - { - const string ButtonId = "ClearButton"; - const string ReadyId = "ReadyLabel"; + const string ButtonId = "ClearButton"; + const string ReadyId = "ReadyLabel"; - public Issue3001(TestDevice testDevice) : base(testDevice) - { - } + public Issue3001(TestDevice testDevice) : base(testDevice) + { + } - public override string Issue => "[macOS] Navigating back from a complex page is highly inefficient"; + public override string Issue => "[macOS] Navigating back from a complex page is highly inefficient"; - [Test] - [Category(UITestCategories.Navigation)] - [Category(UITestCategories.Compatibility)] - public void Issue3001Test() - { - App.WaitForElement(ButtonId); - App.Tap(ButtonId); - App.WaitForElement(ReadyId, timeout: TimeSpan.FromSeconds(5)); - } + [Test] + [Category(UITestCategories.Navigation)] + [Category(UITestCategories.Compatibility)] + public void Issue3001Test() + { + App.WaitForElement(ButtonId); + App.Tap(ButtonId); + App.WaitForElement(ReadyId, timeout: TimeSpan.FromSeconds(5)); } } #endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3008.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3008.cs new file mode 100644 index 000000000000..c1f2e4055817 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3008.cs @@ -0,0 +1,51 @@ +#if !ANDROID +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3008 : _IssuesUITest +{ + + public Issue3008(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Setting ListView.ItemSource to null doesn't cause it clear out its contents"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void EnsureListViewEmptiesOut() + // { + // RunningApp.Tap("Click Until Success"); + // RunningApp.WaitForElement("Not Grouped Item"); + // RunningApp.WaitForElement("Grouped Item"); + + // RunningApp.Tap("Click Until Success"); + // RunningApp.WaitForElement("Not Grouped Item"); + // RunningApp.WaitForElement("Grouped Item"); + + // RunningApp.Tap("Click Until Success"); + // RunningApp.WaitForNoElement("Not Grouped Item"); + // RunningApp.WaitForNoElement("Grouped Item"); + + // RunningApp.Tap("Click Until Success"); + // RunningApp.WaitForElement("Not Grouped Item"); + // RunningApp.WaitForElement("Grouped Item"); + + // RunningApp.Tap("Click Until Success"); + // RunningApp.WaitForNoElement("Not Grouped Item"); + // RunningApp.WaitForNoElement("Grouped Item"); + + // RunningApp.Tap("Click Until Success"); + // RunningApp.WaitForElement("Not Grouped Item"); + // RunningApp.WaitForElement("Grouped Item"); + + // RunningApp.Tap("Click Until Success"); + // RunningApp.WaitForNoElement("Not Grouped Item"); + // RunningApp.WaitForNoElement("Grouped Item"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3012.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3012.cs new file mode 100644 index 000000000000..935e610bfa65 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3012.cs @@ -0,0 +1,31 @@ +#if MACCATALYST +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3012 : _IssuesUITest +{ + public Issue3012(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[macOS] Entry focus / unfocus behavior"; + + // [Test] + // [Category(UITestCategories.Entry)] + // public void Issue3012Test() + // { + // RunningApp.WaitForElement(q => q.Marked("DumbyEntry")); + // RunningApp.Tap(q => q.Marked("DumbyEntry")); + + // RunningApp.WaitForElement(q => q.Marked("FocusTargetEntry")); + // RunningApp.Tap(q => q.Marked("FocusTargetEntry")); + // Assert.AreEqual(0, _unfocusedCount, "Unfocused should not have fired"); + + // RunningApp.Tap(q => q.Marked("DumbyEntry")); + // Assert.AreEqual(1, _unfocusedCount, "Unfocused should have been fired once"); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3019.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3019.cs new file mode 100644 index 000000000000..0eac83eb95e3 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3019.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3019 : _IssuesUITest +{ + public Issue3019(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Grouped ListView Header empty for adding items"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void MakeSureListGroupShowsUpAndItemsAreClickable() + // { + // RunningApp.WaitForElement("Group 1"); + + // RunningApp.Tap(x => x.Marked("Grouped Item: 0")); + // RunningApp.Tap(x => x.Marked("Grouped Item: 1")); + // RunningApp.Tap(x => x.Marked("Grouped Item: 1 Clicked")); + + // } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3053.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3053.cs new file mode 100644 index 000000000000..84dd0c97b100 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3053.cs @@ -0,0 +1,25 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3053 : _IssuesUITest +{ + public Issue3053(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Moving items around on an Observable Collection causes the last item to disappear"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // [FailsOnAndroid] + // public void MovingItemInObservableCollectionBreaksListView() + // { + // RunningApp.WaitForElement(_instructions); + // RunningApp.Tap(_instructions); + // RunningApp.WaitForElement("Item 2"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3139.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3139.cs new file mode 100644 index 000000000000..1c1202187b37 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3139.cs @@ -0,0 +1,27 @@ +#if WINDOWS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3139 : _IssuesUITest +{ + public Issue3139(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "DisplayActionSheet is hiding behind Dialogs"; + + // [Test] + // [Category(UITestCategories.ActionSheet)] + // public void Issue3139Test () + // { + // RunningApp.WaitForElement (q => q.Marked ("Click Yes")); + // RunningApp.Tap (c => c.Marked ("Yes")); + // RunningApp.WaitForElement (q => q.Marked ("Again Yes")); + // RunningApp.Tap (c => c.Marked ("Yes")); + // RunningApp.WaitForElement(q => q.Marked("Test passed")); + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3276.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3276.cs new file mode 100644 index 000000000000..57aa8a6e4562 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3276.cs @@ -0,0 +1,23 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3276 : _IssuesUITest +{ + public Issue3276(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Crashing Unknown cell parent type on ContextAction Bindings"; + + // [Test] + // [Category(UITestCategories.ContextActions)] + // public void Issue3276Test() + // { + // RunningApp.Tap(q => q.Marked("Second")); + // RunningApp.Tap(q => q.Marked("First")); + // RunningApp.WaitForElement(q => q.Marked("second 1")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3292.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3292.cs new file mode 100644 index 000000000000..df5b7a2fe319 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3292.cs @@ -0,0 +1,22 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3292 : _IssuesUITest +{ + public Issue3292(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "TableSection.Title property binding fails in XAML"; + + // [Test] + // [Category(UITestCategories.TableView)] + // [FailsOnIOS] + // public void Issue3292Test() + // { + // RunningApp.WaitForElement(q => q.Marked("Hello World Changed")); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3318.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3318.cs new file mode 100644 index 000000000000..055afb17fcd3 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3318.cs @@ -0,0 +1,25 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3318 : _IssuesUITest +{ + public Issue3318(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[MAC] ScrollTo method is not working in Xamarin.Forms for mac platform"; + + // [Test] + // [Category(UITestCategories.ListView)] + // [FailsOnIOS] + // public void Issue3318Test() + // { + // RunningApp.WaitForElement(q => q.Marked("End")); + // RunningApp.Tap(q => q.Marked("End")); + // RunningApp.WaitForElement(q => q.Marked("Item 19")); + // RunningApp.Back(); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3342.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3342.cs index 1c6033850a9e..8fc3c2a1e791 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3342.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3342.cs @@ -12,14 +12,14 @@ public Issue3342(TestDevice testDevice) : base(testDevice) public override string Issue => "[Android] BoxView BackgroundColor not working on 3.2.0-pre1"; - [Test] - [Category(UITestCategories.BoxView)] - [Category(UITestCategories.Compatibility)] - public void Issue3342Test() - { - App.Screenshot("I am at Issue 3342"); - App.Screenshot("I see the green box"); - } + // [Test] + // [Category(UITestCategories.BoxView)] + // [Category(UITestCategories.Compatibility)] + // public void Issue3342Test() + // { + // App.Screenshot("I am at Issue 3342"); + // App.Screenshot("I see the green box"); + // } } } #endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3390.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3390.cs index 37144ce42f90..e71d26528c8e 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3390.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3390.cs @@ -12,16 +12,16 @@ public Issue3390(TestDevice testDevice) : base(testDevice) public override string Issue => "Crash or incorrect behavior with corner radius 5"; - [Test] - [Category(UITestCategories.Button)] - [Category(UITestCategories.Compatibility)] - [FailsOnIOS] - [FailsOnMac] - public void Issue3390Test() - { - App.WaitForElement("TestButton"); - App.Tap("TestButton"); - App.WaitForNoElement("Success"); - } + // [Test] + // [Category(UITestCategories.Button)] + // [Category(UITestCategories.Compatibility)] + // [FailsOnIOS] + // [FailsOnMac] + // public void Issue3390Test() + // { + // App.WaitForElement("TestButton"); + // App.Tap("TestButton"); + // App.WaitForNoElement("Success"); + // } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3475.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3475.cs new file mode 100644 index 000000000000..895969ab33c3 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3475.cs @@ -0,0 +1,45 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3475 : _IssuesUITest +{ + public Issue3475(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[iOS] LayoutCompression Performance Issues"; + + // [Test] + // [Category(UITestCategories.Layout)] + // [FailsOnAndroid] + // [FailsOnIOS] + // public void Issue3475TestsLayoutCompressionPerformance() + // { + // RunningApp.WaitForElement(_titleLabelId); + // RunningApp.WaitForElement(_withoutCompressionBtnId); + // RunningApp.WaitForElement(_withCompressionBtnId); + + // RunningApp.Tap(_withoutCompressionBtnId); + // RunningApp.WaitForElement(DoneLabelId); + // RunningApp.Screenshot("Without Layout Compression"); + + // int elapsedWithoutCompression = GetMs(RunningApp.Query(ElapsedLabelId).First().Text); + + // RunningApp.Tap(BackButtonId); + // RunningApp.WaitForElement(_withCompressionBtnId); + + // RunningApp.Tap(_withCompressionBtnId); + // RunningApp.WaitForElement(DoneLabelId); + // RunningApp.Screenshot("With Layout Compression"); + + // int elapsedWithCompression = GetMs(RunningApp.Query(ElapsedLabelId).First().Text); + // var delta = elapsedWithCompression - elapsedWithoutCompression; + + // //if layoutcompressions is slower than 100 then there is a problem. + // //it should be at least very similar and no more than 100ms slower i guess... + // Assert.LessOrEqual(delta, 100); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3509.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3509.cs new file mode 100644 index 000000000000..963e9d432138 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3509.cs @@ -0,0 +1,23 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3509 : _IssuesUITest +{ + public Issue3509(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[iOS] NavigationPage.Popped called twice when Navigation.PopAsync is called"; + + // [Test] + // [Category(UITestCategories.Navigation)] + // public void PoppedOnlyFiresOnce() + // { + // RunningApp.WaitForElement(_popPage); + // RunningApp.Tap(_popPage); + // RunningApp.WaitForElement("1"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3524.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3524.cs new file mode 100644 index 000000000000..7cef062305bb --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3524.cs @@ -0,0 +1,24 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3524 : _IssuesUITest +{ + public Issue3524(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ICommand binding from a TapGestureRecognizer on a Span doesn't work"; + + // [Test] + // [Category(UITestCategories.Gestures)] + // [FailsOnIOS] + // public void SpanGestureCommand() + // { + // RunningApp.WaitForElement(kText); + // RunningApp.Tap(kText); + // RunningApp.WaitForElement($"{kText}: 1"); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3653.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3653.cs new file mode 100644 index 000000000000..ba226c3f1479 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3653.cs @@ -0,0 +1,50 @@ +#if !WINDOWS +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3653 : _IssuesUITest +{ + public Issue3653(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "Loses the correct reference to the cell after adding and removing items to a ListView"; + + // [Test] + // [Category(UITestCategories.ContextActions)] + // [FailsOnAndroid] + // [FailsOnIOS] + // public void TestRemovingContextMenuItems() + // { + // for (int i = 1; i <= 3; i++) + // { + // string searchFor = $"Remove me using the context menu. #{i}"; + // RunningApp.WaitForElement(searchFor); + + // RunningApp.ActivateContextMenu(searchFor); + // RunningApp.WaitForElement(c => c.Marked("Remove")); + // RunningApp.Tap(c => c.Marked("Remove")); + // } + + // for (int i = 4; i <= 6; i++) + // { + // RunningApp.Tap("Add an item"); + // string searchFor = $"Remove me using the context menu. #{i}"; + + // RunningApp.ActivateContextMenu(searchFor); + // RunningApp.WaitForElement(c => c.Marked("Remove")); + // RunningApp.Tap(c => c.Marked("Remove")); + // } + + + // for (int i = 1; i <= 6; i++) + // { + // string searchFor = $"Remove me using the context menu. #{i}"; + // RunningApp.WaitForNoElement(c => c.Marked("Remove")); + // } + // } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3667.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3667.cs new file mode 100644 index 000000000000..94270ac207dd --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue3667.cs @@ -0,0 +1,30 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue3667 : _IssuesUITest +{ + public Issue3667(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "[Enhancement] Add text-transforms to Label"; + + // [Test] + // [Category(UITestCategories.Label)] + // [FailsOnIOS] + // public void Issue3667Tests () + // { + // RunningApp.WaitForElement(query => query.Text(text)); + // RunningApp.Tap("Change TextTransform"); + // RunningApp.WaitForElement(query => query.Text(text)); + // RunningApp.Tap("Change TextTransform"); + // RunningApp.WaitForElement(query => query.Text(text.ToLowerInvariant())); + // RunningApp.Tap("Change TextTransform"); + // RunningApp.WaitForElement(query => query.Text(text.ToUpperInvariant())); + // RunningApp.Tap("Change TextTransform"); + // RunningApp.WaitForElement(query => query.Text(text)); + // } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8715.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8715.cs index ce6a08997a30..3254a888de1b 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8715.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue8715.cs @@ -7,8 +7,6 @@ namespace Microsoft.Maui.TestCases.Tests.Issues { public class Issue8715 : _IssuesUITest { - const string FlyoutIconAutomationId = "OK"; - public Issue8715(TestDevice testDevice) : base(testDevice) { } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue9419.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue9419.cs index 73dbf4871a00..7132772041e3 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue9419.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue9419.cs @@ -14,15 +14,15 @@ public Issue9419(TestDevice testDevice) : base(testDevice) public override string Issue => "Crash when toolbar item removed then page changed"; - [Test] - [Category(UITestCategories.ToolbarItem)] - [Category(UITestCategories.Compatibility)] - [FailsOnIOS] - [FailsOnMac] - [FailsOnWindows] - public void TestIssue9419() - { - App.WaitForElement(OkResult); - } + // [Test] + // [Category(UITestCategories.ToolbarItem)] + // [Category(UITestCategories.Compatibility)] + // [FailsOnIOS] + // [FailsOnMac] + // [FailsOnWindows] + // public void TestIssue9419() + // { + // App.WaitForElement(OkResult); + // } } } \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue2681.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue2681.cs index 5c31147eb3fc..9eb72fc6d212 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue2681.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/XFIssue2681.cs @@ -14,14 +14,14 @@ public XFIssue2681(TestDevice device) : base(device) public override string Issue => "[UWP] Label inside Listview gets stuck inside infinite loop"; - [Test] - [Category(UITestCategories.ListView)] - public void ListViewDoesntFreezeApp() - { - App.WaitForElement(NavigateToPage); - App.Tap(NavigateToPage); - App.WaitForElement("3"); - App.Tap("GoBack"); - } + // [Test] + // [Category(UITestCategories.ListView)] + // public void ListViewDoesntFreezeApp() + // { + // App.WaitForElement(NavigateToPage); + // App.Tap(NavigateToPage); + // App.WaitForElement("3"); + // App.Tap("GoBack"); + // } } } diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs index 01648d2b8bf1..ab2dd7e87a2d 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/_IssuesUITest.cs @@ -6,6 +6,17 @@ namespace Microsoft.Maui.TestCases.Tests { public abstract class _IssuesUITest : UITest { +#if ANDROID + protected const string FlyoutIconAutomationId = "Open navigation drawer"; +#else + protected const string FlyoutIconAutomationId = "OK"; +#endif +#if __IOS__ || WINDOWS + protected const string BackButtonAutomationId = "Back"; +#else + protected const string BackButtonAutomationId = "Navigate up"; +#endif + public _IssuesUITest(TestDevice device) : base(device) { } protected override void FixtureSetup()