diff options
author | E.Z. Hart <hartez@users.noreply.github.com> | 2017-03-23 11:18:38 -0600 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-03-23 17:18:38 +0000 |
commit | f27f5a3650f37894d4a1ac925d6fab4dc7350087 (patch) | |
tree | b368c6c35f6592ef28e638c431bb5f3012f58a93 /Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53445.cs | |
parent | 2be80a55a514a050ab5ab07a201d13c111f49f63 (diff) | |
download | xamarin-forms-f27f5a3650f37894d4a1ac925d6fab4dc7350087.tar.gz xamarin-forms-f27f5a3650f37894d4a1ac925d6fab4dc7350087.tar.bz2 xamarin-forms-f27f5a3650f37894d4a1ac925d6fab4dc7350087.zip |
UI tests for InputTransparent and fixes for Android/Windows (#808)
* Set up automated UI tests for InputTransparent
* Pull in Adrian's UI tests from PR 483
* Fix bugs with box/label/image gestures passing through when not transparent
* Fix disabling of layouts on Windows; fix 44096 test for iOS/Windows;
* Automate the 53445 test
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53445.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53445.cs | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53445.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53445.cs new file mode 100644 index 00000000..a9c5f5ab --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla53445.cs @@ -0,0 +1,109 @@ +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; + +#if UITEST +using NUnit.Framework; +using Xamarin.Forms.Core.UITests; +#endif + +namespace Xamarin.Forms.Controls.Issues +{ +#if UITEST + [Category(UITestCategories.IsEnabled)] +#endif + + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 53445, "Setting Grid.IsEnabled to false does not disable child controls", PlatformAffected.All)] + public class Bugzilla53445 : TestContentPage + { + protected override void Init() + { + var layout = new StackLayout { VerticalOptions = LayoutOptions.Fill, Spacing = 20 }; + + var status = new Label { Text = "Success" }; + + var instructions = new Label { Text = "Disable all of the layouts by clicking the Toggle button. Then click the buttons inside each layout. If the status changes from Success to Fail, this test has failed." }; + + var grid = new Grid + { + BackgroundColor = Color.Blue, + IsEnabled = true, + WidthRequest = 250, + HeightRequest = 50, + AutomationId = "grid" + }; + + var gridButton = new Button { AutomationId = "gridbutton", Text = "Test", WidthRequest = 50 }; + grid.Children.Add(gridButton); + gridButton.Clicked += (sender, args) => status.Text = "Fail"; + + var contentView = new ContentView + { + BackgroundColor = Color.Green, + IsEnabled = true, + WidthRequest = 250, + HeightRequest = 50, + AutomationId = "contentView" + }; + + var contentViewButton = new Button { AutomationId = "contentviewbutton", Text = "Test", WidthRequest = 50 }; + contentView.Content = contentViewButton; + contentViewButton.Clicked += (sender, args) => status.Text = "Fail"; + + var stackLayout = new StackLayout + { + BackgroundColor = Color.Orange, + IsEnabled = true, + WidthRequest = 250, + HeightRequest = 50, + AutomationId = "stackLayout" + }; + + var stackLayoutButton = new Button { AutomationId = "stacklayoutbutton", Text = "Test", WidthRequest = 50 }; + stackLayout.Children.Add(stackLayoutButton); + stackLayoutButton.Clicked += (sender, args) => status.Text = "Fail"; + + var toggleButton = new Button { AutomationId = "toggle", Text = $"Toggle IsEnabled (currently {grid.IsEnabled})" }; + toggleButton.Clicked += (sender, args) => + { + grid.IsEnabled = !grid.IsEnabled; + contentView.IsEnabled = !contentView.IsEnabled; + stackLayout.IsEnabled = !stackLayout.IsEnabled; + toggleButton.Text = $"Toggle IsEnabled (currently {grid.IsEnabled})"; + }; + + layout.Children.Add(instructions); + layout.Children.Add(status); + layout.Children.Add(toggleButton); + layout.Children.Add(grid); + layout.Children.Add(contentView); + layout.Children.Add(stackLayout); + + Content = layout; + } + + +#if UITEST + [Test] + public void Test() + { + RunningApp.WaitForElement(q => q.Marked("Success")); + + // Disable the layouts + RunningApp.Tap(q => q.Marked("toggle")); + + // Tap the grid button; the event should not fire and the label should not change + RunningApp.Tap(q => q.Marked("gridbutton")); + RunningApp.WaitForElement(q => q.Marked("Success")); + + // Tap the contentview button; the event should not fire and the label should not change + RunningApp.Tap(q => q.Marked("contentviewbutton")); + RunningApp.WaitForElement(q => q.Marked("Success")); + + // Tap the stacklayout button; the event should not fire and the label should not change + RunningApp.Tap(q => q.Marked("stacklayoutbutton")); + RunningApp.WaitForElement(q => q.Marked("Success")); + } +#endif + } +}
\ No newline at end of file |