-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Bugzilla31688.cs
131 lines (112 loc) · 2.96 KB
/
Bugzilla31688.cs
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using System.Threading.Tasks;
using System;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
#if UITEST
[Category(Core.UITests.UITestCategories.Bugzilla)]
#endif
[Issue(IssueTracker.Bugzilla, 31688, "'Navigation.InsertPageBefore()' does not work for more than two pages, \"throws java.lang.IndexOutOfBoundsException: index=3 count=2", PlatformAffected.Android)]
public class Bugzilla31688 : TestNavigationPage // or TestMasterDetailPage, etc ...
{
MyMainPage page;
protected override async void Init()
{
page = new MyMainPage();
await Navigation.PushAsync(page);
page.LoadAsync();
}
public class MyMainPage : ContentPage
{
public MyMainPage()
{
Content = new Label { Text = "My Main Page" };
}
public async void LoadAsync()
{
ActivityIndicatorPage aip = new ActivityIndicatorPage();
await Navigation.PushAsync(aip);
var page1 = await Page1.CreateAsync();
Navigation.InsertPageBefore(page1, aip);
var page2 = await Page2.CreateAsync();
Navigation.InsertPageBefore(page2, aip);
var page3 = await Page3.CreateAsync();
Navigation.InsertPageBefore(page3, aip);
//// try to remove last page (with AcitivityIndicator) and here it bombs with the error: "java.lang.IndexOutOfBoundsException: index=3 count=2"
await Navigation.PopAsync();
}
}
public class Page1 : ContentPage
{
private Page1()
{
Content = new Label { Text = "Page 1" };
}
public static async Task<Page1> CreateAsync()
{
var page = new Page1();
await Task.Delay(TimeSpan.FromMilliseconds(200)); // simulate loading of state from DB
return page;
}
}
public class Page2 : ContentPage
{
private Page2()
{
Content = new Label { Text = "Page 2" };
}
public static async Task<Page2> CreateAsync()
{
var page = new Page2();
await Task.Delay(TimeSpan.FromMilliseconds(200)); // simulate loading of state from DB
return page;
}
}
class Page3 : ContentPage
{
private Page3()
{
Content = new Label { Text = "Page 3" };
}
public static async Task<Page3> CreateAsync()
{
var page = new Page3();
await Task.Delay(TimeSpan.FromMilliseconds(200)); // simulate loading of state from DB
return page;
}
}
public class Page4 : ContentPage
{
private Page4()
{
Content = new Label { Text = "Page 4" };
}
public static async Task<Page4> CreateAsync()
{
var page = new Page4();
await Task.Delay(TimeSpan.FromMilliseconds(200)); // simulate loading of state from DB
return page;
}
}
public class ActivityIndicatorPage : ContentPage
{
public ActivityIndicatorPage()
{
Content = new ActivityIndicator { IsRunning = true };
}
}
#if UITEST
[Test]
public void Bugzilla31688Test()
{
RunningApp.WaitForElement(q => q.Marked("Page 3"));
}
#endif
}
}