summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorSamantha Houts <samhouts@users.noreply.github.com>2017-09-16 01:52:24 (GMT)
committerSamantha Houts <samantha.houts@xamarin.com>2017-09-16 01:52:50 (GMT)
commitc1095f45a994f5b8ba4e6ca6e44cccb3dffeef95 (patch)
treedf4292fd1bb8a490b0140378769537b4ac037323 /Xamarin.Forms.Controls.Issues
parent352773a8432033fa384b8d1e841f0987d175f93b (diff)
downloadxamarin-forms-c1095f45a994f5b8ba4e6ca6e44cccb3dffeef95.zip
xamarin-forms-c1095f45a994f5b8ba4e6ca6e44cccb3dffeef95.tar.gz
xamarin-forms-c1095f45a994f5b8ba4e6ca6e44cccb3dffeef95.tar.bz2
[iOS] Can activate ContextActions on ListViews reliably again (#1144)
* Add ContextActions test category * Add repro for 58875 * [iOS] Null check for the Delegate; clear the static WeakRef on dispose
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46363.cs1
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla58875.cs111
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
3 files changed, 113 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46363.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46363.cs
index 91b7a95..9beb0ef 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46363.cs
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla46363.cs
@@ -14,6 +14,7 @@ namespace Xamarin.Forms.Controls.Issues
[Category(UITestCategories.Gestures)]
[Category(UITestCategories.ListView)]
[Category(UITestCategories.Cells)]
+ [Category(UITestCategories.ContextActions)]
#endif
[Preserve(AllMembers = true)]
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla58875.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla58875.cs
new file mode 100644
index 0000000..690f3fe
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla58875.cs
@@ -0,0 +1,111 @@
+´╗┐using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using System.Collections.ObjectModel;
+
+#if UITEST
+using Xamarin.Forms.Core.UITests;
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+#if UITEST
+ [Category(UITestCategories.ListView)]
+ [Category(UITestCategories.ContextActions)]
+#endif
+
+ [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(new NavigationPage(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<string> {
+ "Item 1",
+ Target,
+ "Item 3",
+ "Swipe me too, leave me open",
+ "Swipe left -> right (trigger back navigation)"
+ };
+
+ Content = listView;
+ }
+
+ public ObservableCollection<string> 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);
+ }
+ }
+
+#if UITEST
+ [Test]
+ 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();
+#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));
+ }
+#endif
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index f5072e6..4412aca 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -322,6 +322,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla58645.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla27731.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla59097.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla58875.cs" />
<Compile Include="$(MSBuildThisFileDirectory)_Template.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla42620.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue1028.cs" />