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/Bugzilla34007.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/Bugzilla34007.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34007.cs | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34007.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34007.cs new file mode 100644 index 00000000..cc490e4c --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla34007.cs @@ -0,0 +1,91 @@ +using System; +using System.Xml.Linq; +using Xamarin.Forms.CustomAttributes; +#if UITEST +using NUnit.Framework; +using Xamarin.UITest; + +#endif + +namespace Xamarin.Forms.Controls +{ + [Preserve (AllMembers = true)] + [Issue (IssueTracker.Bugzilla, 34007, "Z order drawing of children views are different on Android, iOS, Win", PlatformAffected.Android | PlatformAffected.iOS)] + public class Bugzilla34007 : TestContentPage + { + protected override void Init () + { + var grid = new Grid (); + + var button0 = new Button { + Text = "Button 0", + HorizontalOptions = LayoutOptions.Fill, + VerticalOptions = LayoutOptions.Fill + }; + + var button1 = new Button { + Text = "Button 1", + HorizontalOptions = LayoutOptions.Fill, + VerticalOptions = LayoutOptions.Fill + }; + + var lastButtonTappedLabel = new Label (); + + Action reorder = () => { + // Get the last item in the grid + var item = grid.Children[1]; + + // Remove it + grid.Children.RemoveAt(1); + + // And put it back as the 0th item + grid.Children.Insert(0, item); + }; + + button0.Clicked += (sender, args) => { + lastButtonTappedLabel.Text = "Button 0 was tapped last"; + }; + + button1.Clicked += (sender, args) => { + lastButtonTappedLabel.Text = "Button 1 was tapped last"; + + reorder (); + }; + + grid.Children.Add(button0, 0, 0); + grid.Children.Add(button1, 0, 0); + + Content = new StackLayout { + Children = { grid, lastButtonTappedLabel } + }; + } + +#if UITEST + [Test] + [UiTest (typeof (Grid))] + public void Issue34007TestFirstElementHasLowestZOrder () + { + var buttonLocations = RunningApp.WaitForElement (q => q.Marked ("Button 0")); + + var x = buttonLocations [0].Rect.CenterX; + var y = buttonLocations [0].Rect.CenterY; + + // Button 1 was the last item added to the grid; it should be tappable + RunningApp.Tap (q => q.Button ("Button 1")); + + // The label should indicate that Button 1 was the last button tapped + RunningApp.WaitForElement(q => q.Marked("Button 1 was tapped last")); + + RunningApp.Screenshot("Buttons Reordered"); + + // Tapping Button1 1 reordered the buttons in the grid; Button 0 should + // now be on top. Tapping at the Button 1 location should actually tap + // Button 0, and the label should indicate that + RunningApp.TapCoordinates(x, y); + RunningApp.WaitForElement(q => q.Marked("Button 0 was tapped last")); + + RunningApp.Screenshot("Button 0 Tapped"); + } +#endif + } +}
\ No newline at end of file |