blob: 2b3009531b07954276b9e3bbf35e46250349e35e (
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
|
using System.Diagnostics;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.UITest.iOS;
#endif
namespace Xamarin.Forms.Controls
{
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Github, 774, "ActionSheet won't dismiss after rotation to landscape", PlatformAffected.Android, NavigationBehavior.PushModalAsync)]
public class Issue774 : TestContentPage
{
protected override void Init ()
{
Content = new StackLayout {
Children = {
new Label {
Text = "Hi"
},
new Button {
Text = "Show ActionSheet",
Command = new Command (async () => await DisplayActionSheet ("What's up", "Dismiss", "Destroy"))
}
}
};
}
#if UITEST
[Test]
public void Issue774TestsDismissActionSheetAfterRotation ()
{
RunningApp.Tap (q => q.Button ("Show ActionSheet"));
RunningApp.Screenshot ("Show ActionSheet");
RunningApp.SetOrientationLandscape ();
RunningApp.Screenshot ("Rotate Device");
var app = (RunningApp as iOSApp);
if (app != null) {
if (!app.Device.IsTablet)
RunningApp.Tap (q => q.Marked ("Dismiss"));
else // iPad does not have dismiss option
RunningApp.Tap (q => q.Marked ("Destroy"));
if(app.Device.IsTablet)
RunningApp.WaitForNoElement (q => q.Marked ("Destroy"));
else
RunningApp.WaitForNoElement (q => q.Marked ("Dismiss"));
RunningApp.Screenshot ("Dismiss ActionSheet");
// App.SetOrientationPortrait ();
// App.Tap (q => q.Button ("Show ActionSheet"));
// App.Screenshot ("Rotate and show ActionSheet");
//
// if (!app.Device.IsTablet)
// App.Tap (q => q.Button ("Dismiss"));
// else // iPad does not have dismiss option
// App.Tap (q => q.Marked ("Destroy"));
//
// if (app.Device.IsTablet)
// App.WaitForNoElement (q => q.Marked ("Destroy"));
// else // iPad does not have dismiss option
// App.WaitForNoElement (q => q.Marked ("Dismiss"));
}
}
#endif
}
}
|