diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 13:02:25 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 16:13:41 -0700 |
commit | 17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch) | |
tree | b5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38112.cs | |
download | xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2 xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip |
Initial import
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38112.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38112.cs | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38112.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38112.cs new file mode 100644 index 00000000..bab6f2d9 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla38112.cs @@ -0,0 +1,98 @@ +using System; + +using Xamarin.Forms.CustomAttributes; + +#if UITEST +using Xamarin.UITest; +using NUnit.Framework; +#endif + +namespace Xamarin.Forms.Controls +{ + [Preserve (AllMembers = true)] + [Issue (IssueTracker.Bugzilla, 38112, "Switch becomes reenabled when previous ViewCell is removed from TableView", PlatformAffected.Android)] + public class Bugzilla38112 : TestContentPage + { + bool _removed; + protected override void Init () + { + var layout = new StackLayout (); + var button = new Button { Text = "Click" }; + var tablesection = new TableSection { Title = "Switches" }; + var tableview = new TableView { Intent = TableIntent.Form, Root = new TableRoot { tablesection } }; + var viewcell1 = new ViewCell { + View = new StackLayout { + HorizontalOptions = LayoutOptions.FillAndExpand, + Orientation = StackOrientation.Horizontal, + Children = { + new Label { Text = "Switch 1", HorizontalOptions = LayoutOptions.StartAndExpand }, + new Switch { AutomationId = "switch1", HorizontalOptions = LayoutOptions.End, IsToggled = true } + } + } + }; + var viewcell2 = new ViewCell { + View = new StackLayout { + HorizontalOptions = LayoutOptions.FillAndExpand, + Orientation = StackOrientation.Horizontal, + Children = { + new Label { Text = "Switch 2", HorizontalOptions = LayoutOptions.StartAndExpand }, + new Switch { AutomationId = "switch2", HorizontalOptions = LayoutOptions.End, IsToggled = true } + } + } + }; + Label label = new Label { Text = "Switch 3", HorizontalOptions = LayoutOptions.StartAndExpand }; + Switch switchie = new Switch { AutomationId = "switch3", HorizontalOptions = LayoutOptions.End, IsToggled = true, IsEnabled = false }; + switchie.Toggled += (sender, e) => { + label.Text = "FAIL"; + }; + var viewcell3 = new ViewCell { + View = new StackLayout { + HorizontalOptions = LayoutOptions.FillAndExpand, + Orientation = StackOrientation.Horizontal, + Children = { + label, + switchie, + } + } + }; + + tablesection.Add (viewcell1); + tablesection.Add (viewcell2); + tablesection.Add (viewcell3); + + button.Clicked += (sender, e) => { + if (_removed) + tablesection.Insert (1, viewcell2); + else + tablesection.Remove (viewcell2); + + _removed = !_removed; + }; + + layout.Children.Add (button); + layout.Children.Add (tableview); + + Content = layout; + } + +#if UITEST + [Test] + public void Bugzilla38112_SwitchIsStillOnScreen () + { + RunningApp.WaitForElement (q => q.Marked ("Click")); + RunningApp.Tap (q => q.Marked ("Click")); + RunningApp.WaitForElement (q => q.Marked ("switch3")); + } + + [Test] + public void Bugzilla38112_SwitchIsStillDisabled () + { + RunningApp.WaitForElement (q => q.Marked ("Click")); + RunningApp.Tap (q => q.Marked ("Click")); + RunningApp.WaitForElement (q => q.Marked ("switch3")); + RunningApp.Tap (q => q.Marked ("switch3")); + RunningApp.WaitForNoElement (q => q.Marked ("FAIL")); + } +#endif + } +} |