blob: 12aa823dccf7e77a467faa48626395b3d803013e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
}
}
|