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 | 131 |
1 files changed, 58 insertions, 73 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 a86a625d..91ef39a4 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 @@ -14,26 +14,16 @@ namespace Xamarin.Forms.Controls.Issues #endif [Preserve(AllMembers = true)] - [Issue(IssueTracker.Bugzilla, 44096, "Grid, StackLayout, and ContentView still participate in hit testing on " - + "Android after IsEnabled is set to false", PlatformAffected.Android)] + [Issue(IssueTracker.Bugzilla, 44096, "Grid, StackLayout, and ContentView still participate in hit testing on Android after IsEnabled is set to false", PlatformAffected.Android)] 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"; - const string RelativeLayout = "relativeLayout"; protected override void Init() { var result = new Label { - Text = Original + Text = "Original" }; var grid = new Grid @@ -41,7 +31,7 @@ namespace Xamarin.Forms.Controls.Issues IsEnabled = true, WidthRequest = 250, HeightRequest = 50, - AutomationId = Grid + AutomationId = "grid" }; AddTapGesture(result, grid); @@ -50,7 +40,7 @@ namespace Xamarin.Forms.Controls.Issues IsEnabled = true, WidthRequest = 250, HeightRequest = 50, - AutomationId = ContentView + AutomationId = "contentView" }; AddTapGesture(result, contentView); @@ -59,19 +49,10 @@ namespace Xamarin.Forms.Controls.Issues IsEnabled = true, WidthRequest = 250, HeightRequest = 50, - AutomationId = StackLayout + AutomationId = "stackLayout" }; AddTapGesture(result, stackLayout); - var relativeLayout = new RelativeLayout - { - IsEnabled = true, - WidthRequest = 250, - HeightRequest = 50, - AutomationId = RelativeLayout - }; - AddTapGesture(result, relativeLayout); - var color = new Button { Text = "Toggle colors", @@ -82,34 +63,31 @@ namespace Xamarin.Forms.Controls.Issues grid.BackgroundColor = Color.Red; contentView.BackgroundColor = Color.Blue; stackLayout.BackgroundColor = Color.Yellow; - relativeLayout.BackgroundColor = Color.Green; } else { grid.BackgroundColor = Color.Default; contentView.BackgroundColor = Color.Default; stackLayout.BackgroundColor = Color.Default; - relativeLayout.BackgroundColor = Color.Default; } _flag = !_flag; }), - AutomationId = ToggleColor + AutomationId = "color" }; var disabled = new Button { - Text = "Toggle IsEnabled", + Text = "Disabled", Command = new Command(() => { grid.IsEnabled = false; contentView.IsEnabled = false; stackLayout.IsEnabled = false; - relativeLayout.IsEnabled = false; - result.Text = Original; + result.Text = "Original"; }), - AutomationId = ToggleIsEnabled + AutomationId = "disabled" }; var parent = new StackLayout @@ -125,8 +103,7 @@ namespace Xamarin.Forms.Controls.Issues result, grid, contentView, - stackLayout, - relativeLayout + stackLayout } }; @@ -139,64 +116,72 @@ namespace Xamarin.Forms.Controls.Issues { Command = new Command(() => { - result.Text = Child; + result.Text = "Child"; }) }; view.GestureRecognizers.Add(tapGestureRecognizer); } #if UITEST - [Test] - public void TestGrid() + public void Test() { - TestControl(Grid); - } + RunningApp.WaitForElement(q => q.Marked("grid")); + RunningApp.Tap(q => q.Marked("grid")); + RunningApp.WaitForElement(q => q.Marked("Child")); - [Test] - public void TestContentView() - { - TestControl(ContentView); - } + RunningApp.WaitForElement(q => q.Marked("contentView")); + RunningApp.Tap(q => q.Marked("contentView")); + RunningApp.WaitForElement(q => q.Marked("Child")); - [Test] - public void TestStackLayout() - { - TestControl(StackLayout); - } + RunningApp.WaitForElement(q => q.Marked("stackLayout")); + RunningApp.Tap(q => q.Marked("stackLayout")); + RunningApp.WaitForElement(q => q.Marked("Child")); - [Test] - public void TestRelativeLayout() - { - TestControl(RelativeLayout); - } + RunningApp.WaitForElement(q => q.Marked("color")); + RunningApp.Tap(q => q.Marked("color")); - 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("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("disabled")); + RunningApp.Tap(q => q.Marked("disabled")); + + RunningApp.WaitForElement(q => q.Marked("grid")); + RunningApp.Tap(q => q.Marked("grid")); + RunningApp.WaitForElement(q => q.Marked("Original")); - RunningApp.WaitForElement(q => q.Marked(ToggleColor)); - RunningApp.Tap(q => q.Marked(ToggleColor)); + RunningApp.WaitForElement(q => q.Marked("contentView")); + RunningApp.Tap(q => q.Marked("contentView")); + 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("stackLayout")); + RunningApp.Tap(q => q.Marked("stackLayout")); + RunningApp.WaitForElement(q => q.Marked("Original")); - RunningApp.WaitForElement(q => q.Marked(ToggleIsEnabled)); - RunningApp.Tap(q => q.Marked(ToggleIsEnabled)); + RunningApp.WaitForElement(q => q.Marked("color")); + RunningApp.Tap(q => q.Marked("color")); - RunningApp.WaitForElement(q => q.Marked(control)); - RunningApp.Tap(q => q.Marked(control)); - RunningApp.WaitForElement(q => q.Marked(Original)); + RunningApp.WaitForElement(q => q.Marked("grid")); + RunningApp.Tap(q => q.Marked("grid")); + RunningApp.WaitForElement(q => q.Marked("Original")); - RunningApp.WaitForElement(q => q.Marked(ToggleColor)); - RunningApp.Tap(q => q.Marked(ToggleColor)); + RunningApp.WaitForElement(q => q.Marked("contentView")); + RunningApp.Tap(q => q.Marked("contentView")); + 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("stackLayout")); + RunningApp.Tap(q => q.Marked("stackLayout")); + RunningApp.WaitForElement(q => q.Marked("Original")); } #endif } |