diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 13:02:25 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 16:13:41 -0700 |
commit | 17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch) | |
tree | b5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue417.cs | |
download | xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2 xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip |
Initial import
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue417.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue417.cs | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue417.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue417.cs new file mode 100644 index 00000000..43aad7e4 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue417.cs @@ -0,0 +1,110 @@ +using System; +using System.Diagnostics; +using System.Linq; +using System.Threading.Tasks; + +using Xamarin.Forms.CustomAttributes; + +#if UITEST +using NUnit.Framework; +using Xamarin.UITest; +#endif + +namespace Xamarin.Forms.Controls +{ + [Preserve (AllMembers = true)] + [Issue (IssueTracker.Github, 417, "Navigation.PopToRootAsync does nothing", PlatformAffected.Android)] + public class Issue417 : TestNavigationPage + { + public static NavigationPage NavRoot; + + protected override void Init () + { + Navigation.PushAsync (new FirstPage ()); + NavRoot = this; + } + + public class FirstPage : ContentPage + { + public FirstPage () + { + Title = "First Page"; + BackgroundColor = Color.Black; + + var nextPageBtn = new Button { + Text = "Next Page" + }; + + nextPageBtn.Clicked += (s, e) => NavRoot.Navigation.PushAsync (new NextPage ()); + + Content = nextPageBtn; + } + + } + + public class NextPage : ContentPage + { + public NextPage () + { + Title = "Second Page"; + + var nextPage2Btn = new Button { + Text = "Next Page 2" + }; + + nextPage2Btn.Clicked += (s, e) => NavRoot.Navigation.PushAsync (new NextPage2 ()); + BackgroundColor = Color.Black; + Content = nextPage2Btn; + + } + } + + public class NextPage2 : ContentPage + { + public NextPage2 () + { + Title = "Third Page"; + + var popToRootButton = new Button { + Text = "Pop to root" + }; + + popToRootButton.Clicked += (s, e) => NavRoot.PopToRootAsync (); + BackgroundColor = Color.Black; + Content = popToRootButton; + } + } + + +#if UITEST + [Test] + [UiTest (typeof(NavigationPage), "PopToRootAsync")] + public void Issue417TestsNavigateAndPopToRoot () + { + RunningApp.WaitForElement (q => q.Marked ("First Page")); + RunningApp.WaitForElement (q => q.Button ("Next Page")); + RunningApp.Screenshot ("All elements present"); + + RunningApp.Tap (q => q.Button ("Next Page")); + + RunningApp.WaitForElement (q => q.Marked ("Second Page")); + RunningApp.WaitForElement (q => q.Button ("Next Page 2")); + RunningApp.Screenshot ("At second page"); + RunningApp.Tap (q => q.Button ("Next Page 2")); + + RunningApp.WaitForElement (q => q.Marked ("Third Page")); + RunningApp.WaitForElement (q => q.Button ("Pop to root")); + RunningApp.Screenshot ("At third page"); + RunningApp.Tap (q => q.Button ("Pop to root")); + + RunningApp.WaitForElement (q => q.Marked ("First Page")); + RunningApp.WaitForElement (q => q.Button ("Next Page")); + RunningApp.Screenshot ("All elements present"); + + RunningApp.Screenshot ("Popped to root"); + } +#endif + } + + +} |