From 17fdde66d94155fc62a034fa6658995bef6fd6e5 Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 22 Mar 2016 13:02:25 -0700 Subject: Initial import --- .../Bugzilla32230.cs | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32230.cs (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32230.cs') diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32230.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32230.cs new file mode 100644 index 00000000..e7d99b06 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32230.cs @@ -0,0 +1,59 @@ +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, 32230, "isPresentedChanged raises multiple times")] + public class Bugzilla32230 : TestMasterDetailPage // or TestMasterDetailPage, etc ... + { + Label _lblCount; + Button _btnOpen; + Button _btnClose; + int _count; + + protected override void Init () + { + _lblCount = new Label { Text = _count.ToString (), AutomationId = "lblCount" }; + _btnOpen = new Button { Text = "Open", AutomationId = "btnOpen", + Command = new Command (() => { + IsPresented = true; + }) + }; + _btnClose = new Button { Text = "Close", AutomationId = "btnClose", + Command = new Command (() => { + IsPresented = false; + }) + }; + + Master = new ContentPage { + Title = "Master", + Content = new StackLayout { Children = { _lblCount, _btnClose } } + }; + + Detail = new NavigationPage (new ContentPage { Content = _btnOpen }); + IsPresentedChanged += (object sender, EventArgs e) => { + _count++; + _lblCount.Text = _count.ToString(); + }; + } + +#if UITEST + [Test] + public void Bugzilla32230Test () + { + RunningApp.Tap (q => q.Marked ("btnOpen")); + Assert.AreEqual ("1", RunningApp.Query (q => q.Marked ("lblCount"))[0].Text); + RunningApp.Tap (q => q.Marked ("btnClose")); + RunningApp.Tap (q => q.Marked ("btnOpen")); + Assert.AreEqual ("3", RunningApp.Query (q => q.Marked ("lblCount"))[0].Text); + } +#endif + } +} -- cgit v1.2.3