summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla59097.cs
blob: 304a52d11416f110a508d0fa1bbae765583913d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif

namespace Xamarin.Forms.Controls.Issues
{
	[Preserve(AllMembers = true)]
	[Issue(IssueTracker.Bugzilla, 59097, "[Android] Calling PopAsync via TapGestureRecognizer causes an application crash", PlatformAffected.Android)]
	public class Bugzilla59097 : TestNavigationPage // or TestMasterDetailPage, etc ...
	{
		protected override void Init()
		{
			Navigation.PushAsync(new ContentPage { Content = new Label { Text = "previous page " } });
			Navigation.PushAsync(new ToPopPage());
		}

		public class ToPopPage : ContentPage
		{
			public ToPopPage()
			{
				var boxView = new BoxView { WidthRequest = 100, HeightRequest = 100, Color = Color.Red, AutomationId = "boxView" };
				var tapGesture = new TapGestureRecognizer { NumberOfTapsRequired = 1, Command = new Command(PopPageBack) };
				boxView.GestureRecognizers.Add(tapGesture);
				var layout = new StackLayout();
				layout.Children.Add(boxView);
				Content = layout;
			}

			async void PopPageBack(object obj)
			{
				await Navigation.PopAsync(true);
			}
		}


#if UITEST
		[Test]
		public void Bugzilla59097Test()
		{
			RunningApp.WaitForElement(q => q.Marked("boxView"));
			RunningApp.Tap(q => q.Marked("boxView"));
		}
#endif
	}
}