summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2964.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2964.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2964.cs101
1 files changed, 101 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2964.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2964.cs
new file mode 100644
index 00000000..e86dad15
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2964.cs
@@ -0,0 +1,101 @@
+´╗┐using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Linq;
+
+using Xamarin.Forms.CustomAttributes;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.Github, 2964, "TabbedPage toolbar item crash")]
+ public class Issue2964 : TestMasterDetailPage
+ {
+ public class ModalPage : ContentPage
+ {
+ public ModalPage ()
+ {
+ Content = new Button {
+ AutomationId = "ModalPagePopButton",
+ Text ="Pop Me",
+ Command = new Command (async () => {
+ MessagingCenter.Send (this, "update");
+ await Navigation.PopModalAsync ();
+ })
+ };
+ }
+ }
+
+ public class Page1 : ContentPage
+ {
+ public Page1 ()
+ {
+ Title = "Testpage 1";
+
+ MessagingCenter.Subscribe<ModalPage> (this, "update", sender => {
+ BlowUp ();
+ });
+
+ 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";
+
+ Master = new ContentPage {
+ Title = "Master",
+ Content = new Button {
+ AutomationId = "MasterButton",
+ Text = "Make a new page",
+ Command= new Command(() => {
+ Detail = new Page1 ();
+ IsPresented = false;
+ })
+ }
+ };
+
+ Detail = new Page1 ();
+
+ IsPresented = true;
+ }
+
+#if UITEST
+ [Test]
+ public void Issue2964Test ()
+ {
+ RunningApp.Screenshot ("I am at Issue 2964");
+
+ RunningApp.Tap (q => q.Marked ("MasterButton"));
+ 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! :)");
+ }
+#endif
+ }
+}