diff options
author | Samantha Houts <samhouts@users.noreply.github.com> | 2017-06-14 06:40:03 -0700 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-06-14 14:40:03 +0100 |
commit | d6252627d0f72485dc9bba8902f777430e1fe148 (patch) | |
tree | a02e29e924892251e4a8340d656a15901da4444e /Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared | |
parent | 28a878d14fa9f763bd76cb8e33ddcb539795316f (diff) | |
download | xamarin-forms-d6252627d0f72485dc9bba8902f777430e1fe148.tar.gz xamarin-forms-d6252627d0f72485dc9bba8902f777430e1fe148.tar.bz2 xamarin-forms-d6252627d0f72485dc9bba8902f777430e1fe148.zip |
[Android] Fix NullPointerException following RemovePage call (#933)
* Add repro for 53179
* Update Android packages to 25+
* Turn off linker to debug
* [Android] Only remove PageContainer < API 25
* Revert "Update Android packages to 25+"
This reverts commit ece252261d709213ad3a3c02c5fd37556bdb093f.
* Revert "Turn off linker to debug"
This reverts commit fdffff71386f1a4b186b89b7421d875e696b7bc7.
* Update test automation
* Add explanatory comment
* Fix test case number
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared')
2 files changed, 84 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53179.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53179.cs new file mode 100644 index 00000000..12aa823d --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53179.cs @@ -0,0 +1,83 @@ +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 53179, "PopAsync crashing after RemovePage when support packages are updated to 25.1.1", PlatformAffected.Android)] + public class Bugzilla53179 : TestNavigationPage + { + class TestPage : ContentPage + { + Button nextBtn, rmBtn, popBtn; + + public TestPage(int index) + { + nextBtn = new Button { Text = "Next Page" }; + rmBtn = new Button { Text = "Remove previous page" }; + popBtn = new Button { Text = "Back" }; + + nextBtn.Clicked += async (sender, e) => await Navigation.PushAsync(new TestPage(index + 1)); + rmBtn.Clicked += (sender, e) => + { + var stackSize = Navigation.NavigationStack.Count; + Navigation.RemovePage(Navigation.NavigationStack[stackSize - 2]); + popBtn.IsVisible = true; + rmBtn.IsVisible = false; + }; + popBtn.Clicked += async (sender, e) => await Navigation.PopAsync(); + + switch (index) + { + case 3: + nextBtn.IsVisible = false; + popBtn.IsVisible = false; + break; + default: + rmBtn.IsVisible = false; + popBtn.IsVisible = false; + break; + } + + Content = new StackLayout + { + Children = { + new Label { Text = $"This is page {index}"}, + nextBtn, + rmBtn, + popBtn + } + }; + } + } + + + protected override void Init() + { + PushAsync(new TestPage(1)); + } + +#if UITEST + [Test] + public void Bugzilla53179Test() + { + RunningApp.WaitForElement(q => q.Marked("Next Page")); + RunningApp.Tap(q => q.Marked("Next Page")); + + RunningApp.WaitForElement(q => q.Marked("Next Page")); + RunningApp.Tap(q => q.Marked("Next Page")); + + RunningApp.WaitForElement(q => q.Marked("Remove previous page")); + RunningApp.Tap(q => q.Marked("Remove previous page")); + + RunningApp.WaitForElement(q => q.Marked("Back")); + RunningApp.Tap(q => q.Marked("Back")); + } +#endif + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index 8b454249..cc6a4fa6 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -289,6 +289,7 @@ <Compile Include="$(MSBuildThisFileDirectory)ListViewNRE.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla55745.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla55365.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Bugzilla53179.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla54036.cs" /> <Compile Include="$(MSBuildThisFileDirectory)_Template.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Issue1028.cs" /> |