maui-linux/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issu.../Bugzilla38658.cs

82 строки
2.0 KiB
C#
Исходник Обычный вид История

2016-03-22 23:02:25 +03:00
using System;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
2016-03-22 23:02:25 +03:00
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
2016-03-22 23:02:25 +03:00
{
[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]
2019-03-27 21:38:38 +03:00
public override void TearDown()
{
RunningApp.SetOrientationPortrait ();
2019-03-27 21:38:38 +03:00
base.TearDown();
}
2016-03-22 23:02:25 +03:00
#endif
}
}