diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33450.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33450.cs index 5875c7c01..e70d03f97 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33450.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla33450.cs @@ -3,13 +3,13 @@ using Xamarin.Forms.Internals; namespace Xamarin.Forms.Controls.Issues { - [Preserve (AllMembers = true)] - [Issue (IssueTracker.Bugzilla, 33450, "[iOS] Cell with ContextAction has a different layout")] + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 33450, "[iOS] Cell with ContextAction has a different layout")] public class Bugzilla33450 : TestContentPage // or TestMasterDetailPage, etc ... { - protected override void Init () + protected override void Init() { - var list = new ListView { ItemTemplate = new DataTemplate (typeof(MyImageCell)) }; + var list = new ListView { ItemTemplate = new DataTemplate(typeof(MyImageCell)) }; list.ItemsSource = new[] { "One", @@ -24,10 +24,15 @@ namespace Xamarin.Forms.Controls.Issues "Ten", }; - Content = list; + Content = new StackLayout + { + Children = { + new Label { Text = "The following list contains cells with and without context actions, but all of the cells should be laid out identically. If the cells do not look identical, this test has failed." }, + list } + }; } - [Preserve (AllMembers = true)] + [Preserve(AllMembers = true)] public class MyImageCell : ImageCell { static bool s_addContextAction = false; @@ -36,8 +41,8 @@ namespace Xamarin.Forms.Controls.Issues { ImageSource = "bank.png"; SetBinding(TextProperty, new Binding(".")); - - if(s_addContextAction) + + if (s_addContextAction) { ContextActions.Add(new MenuItem() { Text = "Delete" }); } diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue1931.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue1931.cs index 937b5641e..34dfca988 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue1931.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue1931.cs @@ -55,6 +55,7 @@ namespace Xamarin.Forms.Controls.Issues return page; } + [Preserve(AllMembers = true)] public class Item2 : System.ComponentModel.INotifyPropertyChanged { public string Name diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue3652.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue3652.cs index b9e163b1a..93f902139 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue3652.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue3652.cs @@ -2,6 +2,13 @@ using Xamarin.Forms.CustomAttributes; using Xamarin.Forms.Internals; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +using Xamarin.Forms.Core.UITests; +#endif + namespace Xamarin.Forms.Controls.Issues { [Preserve(AllMembers = true)] @@ -49,7 +56,7 @@ namespace Xamarin.Forms.Controls.Issues { 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); @@ -102,5 +109,41 @@ namespace Xamarin.Forms.Controls.Issues public Command Remove => new Command(() => MessagingCenter.Send(this, "Remove", this)); } + +#if UITEST && !__WINDOWS__ + [Test] + 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/Xamarin.Forms.Platform.iOS/Renderers/LabelRenderer.cs b/Xamarin.Forms.Platform.iOS/Renderers/LabelRenderer.cs index ef0855419..ad4c08ecb 100644 --- a/Xamarin.Forms.Platform.iOS/Renderers/LabelRenderer.cs +++ b/Xamarin.Forms.Platform.iOS/Renderers/LabelRenderer.cs @@ -142,6 +142,8 @@ namespace Xamarin.Forms.Platform.MacOS protected override void OnElementChanged(ElementChangedEventArgs