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
|
using System;
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, 38658, "Rotation causes app containing CarouselPage to freeze", PlatformAffected.iOS)]
public class Bugzilla38658 : TestTabbedPage // or TestMasterDetailPage, etc ...
{
public class TestCarouselPage : CarouselPage
{
public TestCarouselPage ()
{
Children.Add (new ContentPage () {
Content = new StackLayout {
Children = {
new Label { Text = "Rotate the device to Landscape and back to Portrait. If the app hangs, this test has failed." },
new BoxView { Color = Color.Red, HeightRequest = 200, WidthRequest = 200 }
}
}
});
Children.Add (new ContentPage () {
Content = new StackLayout {
Children = {
new Label { Text = "Rotate the device to Landscape and back to Portrait. If the app hangs, this test has failed." },
new BoxView { Color = Color.Green, HeightRequest = 200, WidthRequest = 200 }
}
}
});
}
}
public class StartPage : ContentPage
{
public StartPage ()
{
Button button = new Button {
AutomationId = "btn",
Text = "Click"
};
button.Clicked += button_Clicked;
Content = button;
}
async void button_Clicked (object sender, EventArgs e)
{
await Navigation.PushAsync (new TestCarouselPage ());
}
}
protected override void Init ()
{
Children.Add (new NavigationPage (new StartPage () { Title = "Page" }));
}
#if UITEST
[Test]
public void Bugzilla38658Test ()
{
RunningApp.WaitForElement (q => q.Marked ("btn"));
RunningApp.Tap (q => q.Marked ("btn"));
RunningApp.SetOrientationLandscape ();
RunningApp.SetOrientationPortrait ();
RunningApp.Back ();
RunningApp.WaitForElement (q => q.Marked ("btn"));
}
[TearDown]
public void TearDown()
{
RunningApp.SetOrientationPortrait ();
}
#endif
}
}
|