summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34632.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34632.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34632.cs79
1 files changed, 79 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34632.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34632.cs
new file mode 100644
index 00000000..d75f4792
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34632.cs
@@ -0,0 +1,79 @@
+using System;
+using Xamarin.Forms.CustomAttributes;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+using Xamarin.UITest.iOS;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.Bugzilla, 34632, "Can't change IsPresented when setting SplitOnLandscape ")]
+ public class Bugzilla34632 : TestMasterDetailPage
+ {
+ protected override void Init ()
+ {
+ if (Device.OS == TargetPlatform.Windows)
+ MasterBehavior = MasterBehavior.Split;
+ else
+ MasterBehavior = MasterBehavior.SplitOnLandscape;
+
+ Master = new ContentPage { Title = "Main Page",
+ Content = new Button { Text = "Master", AutomationId = "btnMaster",
+ Command = new Command (() => {
+ //If we're in potrait toggle hide the menu on click
+ if (Width < Height || Device.Idiom == TargetIdiom.Phone) {
+ IsPresented = false;
+ }
+ })
+ }
+ };
+
+ Detail = new NavigationPage (new ModalRotationIssue ());
+ NavigationPage.SetHasBackButton (Detail, false);
+ }
+
+ [Preserve (AllMembers = true)]
+ public class ModalRotationIssue : ContentPage
+ {
+ public ModalRotationIssue ()
+ {
+ var btn = new Button { Text = "Open Modal", AutomationId = "btnModal" };
+ btn.Clicked += OnButtonClicked;
+ Content = btn;
+ }
+
+ async void OnButtonClicked (object sender, EventArgs e)
+ {
+ var testButton = new Button { Text = "Rotate Before Clicking", AutomationId = "btnDismissModal" };
+ testButton.Clicked += (async (snd, args) => await Navigation.PopModalAsync ());
+
+ var testModal = new ContentPage () {
+ Content = testButton
+ };
+
+ await Navigation.PushModalAsync (testModal);
+ }
+ }
+
+ #if UITEST
+ [Test]
+ public void Bugzilla34632Test ()
+ {
+ var app = RunningApp as iOSApp;
+ if (app != null && app.Device.IsTablet) {
+ RunningApp.SetOrientationPortrait ();
+ RunningApp.Tap (q => q.Marked ("btnModal"));
+ RunningApp.SetOrientationLandscape ();
+ RunningApp.Tap (q => q.Marked ("btnDismissModal"));
+ RunningApp.Tap (q => q.Marked ("btnModal"));
+ RunningApp.SetOrientationPortrait ();
+ RunningApp.Tap (q => q.Marked ("btnDismissModal"));
+ RunningApp.Tap (q => q.Marked ("btnMaster"));
+ }
+ }
+ #endif
+ }
+}