summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla29363.cs
blob: e36099b6201567eaaef2b3b5941f087474467117 (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
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

#if UITEST
using NUnit.Framework;
using Xamarin.Forms.Core.UITests;
#endif


namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
	[Category(UITestCategories.LifeCycle)]
#endif

	[Preserve (AllMembers = true)]
	[Issue (IssueTracker.Bugzilla, 29363, "PushModal followed immediate by PopModal crashes")]
    public class Bugzilla29363 : TestContentPage
    {
		protected override void Init ()
		{
			var layout = new StackLayout () {HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand};

			Button modal = new Button {
				Text = "Modal Push Pop Test",
				Font = Font.SystemFontOfSize (25, FontAttributes.Bold),
				HorizontalOptions = LayoutOptions.Center
			};
			modal.Clicked += async (object sender, EventArgs e) => {
				var page = new ContentPage () {BackgroundColor = Color.Red};

				await Navigation.PushModalAsync (page);

				await Navigation.PopModalAsync (true);
			};

			layout.Children.Add (modal);
			Content = layout;
		}

#if UITEST
		[Test]
		public void PushButton ()
		{
			RunningApp.Tap (q => q.Marked ("Modal Push Pop Test"));
			System.Threading.Thread.Sleep (2000);
			// if it didn't crash, yay
			RunningApp.WaitForElement(q => q.Marked("Modal Push Pop Test"));
		}
#endif
    }
}