diff options
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44096.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44096.cs | 108 |
1 files changed, 51 insertions, 57 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44096.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44096.cs index 91ef39a4..37c135dc 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44096.cs +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla44096.cs @@ -18,12 +18,20 @@ namespace Xamarin.Forms.Controls.Issues public class Bugzilla44096 : TestContentPage { bool _flag; + const string Child = "Child"; + const string Original = "Original"; + const string ToggleColor = "color"; + const string ToggleIsEnabled = "disabled"; + + const string StackLayout = "stackLayout"; + const string ContentView = "contentView"; + const string Grid = "grid"; protected override void Init() { var result = new Label { - Text = "Original" + Text = Original }; var grid = new Grid @@ -31,7 +39,7 @@ namespace Xamarin.Forms.Controls.Issues IsEnabled = true, WidthRequest = 250, HeightRequest = 50, - AutomationId = "grid" + AutomationId = Grid }; AddTapGesture(result, grid); @@ -40,7 +48,7 @@ namespace Xamarin.Forms.Controls.Issues IsEnabled = true, WidthRequest = 250, HeightRequest = 50, - AutomationId = "contentView" + AutomationId = ContentView }; AddTapGesture(result, contentView); @@ -49,7 +57,7 @@ namespace Xamarin.Forms.Controls.Issues IsEnabled = true, WidthRequest = 250, HeightRequest = 50, - AutomationId = "stackLayout" + AutomationId = StackLayout }; AddTapGesture(result, stackLayout); @@ -73,21 +81,21 @@ namespace Xamarin.Forms.Controls.Issues _flag = !_flag; }), - AutomationId = "color" + AutomationId = ToggleColor }; var disabled = new Button { - Text = "Disabled", + Text = "Toggle IsEnabled", Command = new Command(() => { grid.IsEnabled = false; contentView.IsEnabled = false; stackLayout.IsEnabled = false; - result.Text = "Original"; + result.Text = Original; }), - AutomationId = "disabled" + AutomationId = ToggleIsEnabled }; var parent = new StackLayout @@ -116,72 +124,58 @@ namespace Xamarin.Forms.Controls.Issues { Command = new Command(() => { - result.Text = "Child"; + result.Text = Child; }) }; view.GestureRecognizers.Add(tapGestureRecognizer); } #if UITEST + [Test] - public void Test() + public void TestGrid() { - RunningApp.WaitForElement(q => q.Marked("grid")); - RunningApp.Tap(q => q.Marked("grid")); - RunningApp.WaitForElement(q => q.Marked("Child")); - - RunningApp.WaitForElement(q => q.Marked("contentView")); - RunningApp.Tap(q => q.Marked("contentView")); - RunningApp.WaitForElement(q => q.Marked("Child")); - - RunningApp.WaitForElement(q => q.Marked("stackLayout")); - RunningApp.Tap(q => q.Marked("stackLayout")); - RunningApp.WaitForElement(q => q.Marked("Child")); - - RunningApp.WaitForElement(q => q.Marked("color")); - RunningApp.Tap(q => q.Marked("color")); - - RunningApp.WaitForElement(q => q.Marked("grid")); - RunningApp.Tap(q => q.Marked("grid")); - RunningApp.WaitForElement(q => q.Marked("Child")); - - RunningApp.WaitForElement(q => q.Marked("contentView")); - RunningApp.Tap(q => q.Marked("contentView")); - RunningApp.WaitForElement(q => q.Marked("Child")); + TestControl(Grid); + } - RunningApp.WaitForElement(q => q.Marked("stackLayout")); - RunningApp.Tap(q => q.Marked("stackLayout")); - RunningApp.WaitForElement(q => q.Marked("Child")); + [Test] + public void TestContentView() + { + TestControl(ContentView); + } - RunningApp.WaitForElement(q => q.Marked("disabled")); - RunningApp.Tap(q => q.Marked("disabled")); + [Test] + public void TestStackLayout() + { + TestControl(StackLayout); + } - RunningApp.WaitForElement(q => q.Marked("grid")); - RunningApp.Tap(q => q.Marked("grid")); - RunningApp.WaitForElement(q => q.Marked("Original")); + void TestControl(string control) + { + RunningApp.WaitForElement(q => q.Marked(control)); + RunningApp.Tap(q => q.Marked(control)); + RunningApp.WaitForElement(q => q.Marked(Child)); - RunningApp.WaitForElement(q => q.Marked("contentView")); - RunningApp.Tap(q => q.Marked("contentView")); - RunningApp.WaitForElement(q => q.Marked("Original")); + RunningApp.WaitForElement(q => q.Marked(ToggleColor)); + RunningApp.Tap(q => q.Marked(ToggleColor)); - RunningApp.WaitForElement(q => q.Marked("stackLayout")); - RunningApp.Tap(q => q.Marked("stackLayout")); - RunningApp.WaitForElement(q => q.Marked("Original")); + RunningApp.WaitForElement(q => q.Marked(control)); + RunningApp.Tap(q => q.Marked(control)); + RunningApp.WaitForElement(q => q.Marked(Child)); - RunningApp.WaitForElement(q => q.Marked("color")); - RunningApp.Tap(q => q.Marked("color")); + RunningApp.WaitForElement(q => q.Marked(ToggleIsEnabled)); + RunningApp.Tap(q => q.Marked(ToggleIsEnabled)); - RunningApp.WaitForElement(q => q.Marked("grid")); - RunningApp.Tap(q => q.Marked("grid")); - RunningApp.WaitForElement(q => q.Marked("Original")); + RunningApp.WaitForElement(q => q.Marked(control)); + RunningApp.Tap(q => q.Marked(control)); + RunningApp.WaitForElement(q => q.Marked(Original)); - RunningApp.WaitForElement(q => q.Marked("contentView")); - RunningApp.Tap(q => q.Marked("contentView")); - RunningApp.WaitForElement(q => q.Marked("Original")); + RunningApp.WaitForElement(q => q.Marked(ToggleColor)); + RunningApp.Tap(q => q.Marked(ToggleColor)); - RunningApp.WaitForElement(q => q.Marked("stackLayout")); - RunningApp.Tap(q => q.Marked("stackLayout")); - RunningApp.WaitForElement(q => q.Marked("Original")); + RunningApp.WaitForElement(q => q.Marked(control)); + RunningApp.Tap(q => q.Marked(control)); + RunningApp.WaitForElement(q => q.Marked(Original)); } #endif } |