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/Bugzilla35472.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/Bugzilla35472.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35472.cs | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35472.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35472.cs new file mode 100644 index 00000000..1513463c --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35472.cs @@ -0,0 +1,88 @@ +using System; +using System.Diagnostics; +using Xamarin.Forms.CustomAttributes; +#if UITEST +using Xamarin.Forms.Core.UITests; +using NUnit.Framework; +using Xamarin.UITest; + +#endif + +namespace Xamarin.Forms.Controls +{ + [Preserve (AllMembers = true)] + [Issue (IssueTracker.Bugzilla, 35472, "PopAsync during ScrollToAsync throws NullReferenceException")] + public class Bugzilla35472 : TestNavigationPage + { + protected override void Init () + { + // Set up the scroll viewer page + var scrollToButton = new Button () { Text = "Now push this button" }; + + var stackLayout = new StackLayout (); + + stackLayout.Children.Add (scrollToButton); + + for (int n = 0; n < 100; n++) { + stackLayout.Children.Add (new Label () { Text = n.ToString () }); + } + + var scrollView = new ScrollView () { + Content = stackLayout + }; + + var pageWithScrollView = new ContentPage () { + Content = scrollView + }; + + // Set up the start page + var goButton = new Button () { + Text = "Push this button" + }; + + var successLabel = new Label () { Text = "The test has passed", IsVisible = false }; + + var startPage = new ContentPage () { + Content = new StackLayout { + VerticalOptions = LayoutOptions.Center, + Children = { + goButton, + successLabel + } + } + }; + + PushAsync (startPage); + + goButton.Clicked += (sender, args) => Navigation.PushAsync (pageWithScrollView); + + scrollToButton.Clicked += async (sender, args) => { + try { + // Deliberately not awaited so we can simulate a user navigating back + scrollView.ScrollToAsync (0, 1500, true); + await Navigation.PopAsync (); + successLabel.IsVisible = true; + } catch (Exception ex) { + Debug.WriteLine (ex); + } + }; + } + +#if UITEST + [Test] + [UiTest (typeof(NavigationPage))] + public void Issue35472PopAsyncDuringAnimatedScrollToAsync () + { + RunningApp.WaitForElement (q => q.Marked ("Push this button")); + RunningApp.Tap (q => q.Marked ("Push this button")); + + RunningApp.WaitForElement (q => q.Marked ("Now push this button")); + RunningApp.Screenshot ("On Page With ScrollView"); + RunningApp.Tap (q => q.Marked ("Now push this button")); + + RunningApp.WaitForElement ("The test has passed"); + RunningApp.Screenshot ("Success"); + } +#endif + } +}
\ No newline at end of file |