summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31366.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31366.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31366.cs85
1 files changed, 85 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31366.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31366.cs
new file mode 100644
index 00000000..75853f1d
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla31366.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Threading.Tasks;
+using Xamarin.Forms.CustomAttributes;
+#if UITEST
+using NUnit.Framework;
+using Xamarin.UITest;
+
+#endif
+
+namespace Xamarin.Forms.Controls.TestCasesPages
+{
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.Bugzilla, 31366, "Pushing and then popping a page modally causes ArgumentOutOfRangeException",
+ PlatformAffected.All)]
+ public class Bugzilla31366 : TestNavigationPage
+ {
+ protected override void Init ()
+ {
+ var page1 = new ContentPage () { Title = "Page1" };
+
+ var successLabel = new Label ();
+ var startPopOnAppearing = new Button () { Text = "Start PopOnAppearing Test" };
+ var startModalStack = new Button () { Text = "Start ModalStack Test" };
+
+ page1.Content = new StackLayout () {
+ Children = { startPopOnAppearing, startModalStack, successLabel }
+ };
+
+ var popOnAppearing = new ContentPage () {
+ Title = "PopOnAppearing",
+ Content = new StackLayout ()
+ };
+
+ popOnAppearing.Appearing += async (sender, args) => {
+ await Task.Yield ();
+ await popOnAppearing.Navigation.PopModalAsync ();
+ };
+
+ startPopOnAppearing.Clicked += async (sender, args) => {
+ successLabel.Text = string.Empty;
+
+ await page1.Navigation.PushModalAsync (popOnAppearing);
+
+ successLabel.Text = "If this is visible, the PopOnAppearing test has passed.";
+ };
+
+ startModalStack.Clicked += async (sender, args) => {
+ successLabel.Text = string.Empty;
+
+ var intermediatePage = new ContentPage () {
+ Content = new StackLayout () {
+ Children = {
+ new Label () { Text = "If this is visible, the modal stack test has passed." }
+ }
+ }
+ };
+
+ await intermediatePage.Navigation.PushModalAsync (popOnAppearing);
+
+ await page1.Navigation.PushModalAsync (intermediatePage);
+ };
+
+ PushAsync (page1);
+ }
+
+
+#if UITEST
+ [Test]
+ [UiTest (typeof (NavigationPage))]
+ public void Issue31366PushingAndPoppingModallyCausesArgumentOutOfRangeException ()
+ {
+ RunningApp.Tap (q => q.Marked ("Start PopOnAppearing Test"));
+ RunningApp.WaitForElement (q => q.Marked ("If this is visible, the PopOnAppearing test has passed."));
+ }
+
+ [Test]
+ [UiTest (typeof (NavigationPage))]
+ public void Issue31366PushingWithModalStackCausesIncorrectStackOrder ()
+ {
+ RunningApp.Tap (q => q.Marked ("Start ModalStack Test"));
+ RunningApp.WaitForElement (q => q.Marked ("If this is visible, the modal stack test has passed."));
+ }
+#endif
+ }
+} \ No newline at end of file