summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared
diff options
context:
space:
mode:
authorPaul DiPietro <pauldipietro@users.noreply.github.com>2017-06-13 13:22:31 -0500
committerJason Smith <jason.smith@xamarin.com>2017-06-13 11:22:31 -0700
commit9a7b97de54df283fa0a42ed56c5af02becf5016d (patch)
tree21372c783d6c1b1a2a3c2aa4d2e670a912b400ac /Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared
parentc94331368f65353fe225ee296b6c38b697c17d73 (diff)
downloadxamarin-forms-9a7b97de54df283fa0a42ed56c5af02becf5016d.tar.gz
xamarin-forms-9a7b97de54df283fa0a42ed56c5af02becf5016d.tar.bz2
xamarin-forms-9a7b97de54df283fa0a42ed56c5af02becf5016d.zip
[A] Check Visibility for tab's page appearing (#963)
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla52419.cs112
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
2 files changed, 113 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla52419.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla52419.cs
new file mode 100644
index 00000000..4776b73a
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla52419.cs
@@ -0,0 +1,112 @@
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using System;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls.Issues
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 52419, "[A] OnAppearing called for previous pages in a tab's navigation when switching active tabs", PlatformAffected.Android)]
+ public class Bugzilla52419 : TestTabbedPage
+ {
+ protected override void Init()
+ {
+ var nav1 = new NavigationPage { Title = "Tab Page 1" };
+ nav1.PushAsync(new Bugzilla52419Page1());
+ var nav2 = new NavigationPage { Title = "Tab Page 2" };
+ nav2.PushAsync(new Bugzilla52419Page2());
+ Children.Add(nav1);
+ Children.Add(nav2);
+ }
+
+#if UITEST
+
+#if __ANDROID__
+ [Test]
+ public void Bugzilla52419Test()
+ {
+ RunningApp.WaitForElement(q => q.Marked("Push new page"));
+ RunningApp.Tap(q => q.Marked("Push new page"));
+ RunningApp.WaitForElement(q => q.Marked("Push new page"));
+ RunningApp.Tap(q => q.Marked("Push new page"));
+ RunningApp.WaitForElement(q => q.Marked("Push new page"));
+ RunningApp.Tap(q => q.Marked("Push new page"));
+ RunningApp.Tap(q => q.Marked("Tab Page 2"));
+ RunningApp.Tap(q => q.Marked("Tab Page 1"));
+ RunningApp.Tap(q => q.Marked("Tab Page 2"));
+ RunningApp.Tap(q => q.Marked("Tab Page 1"));
+ RunningApp.Back();
+ RunningApp.WaitForElement(q => q.Marked("AppearanceLabel"));
+ var label = RunningApp.Query(q => q.Marked("AppearanceLabel"))[0];
+ Assert.AreEqual("Times Appeared: 2", label.Text);
+ }
+#endif
+
+#endif
+ }
+
+ class Bugzilla52419Page1 : ContentPage
+ {
+ public Label _timesAppeared { get; set; }
+ int _count;
+
+ string _guid = Guid.NewGuid().ToString();
+ public Bugzilla52419Page1()
+ {
+ _timesAppeared = new Label
+ {
+ Text = "Times Appeared: " + _count.ToString(),
+ AutomationId = "AppearanceLabel"
+ };
+ Content = new StackLayout
+ {
+ Children =
+ {
+ new Label
+ {
+ Text = "Page Guid: " + _guid
+ },
+ _timesAppeared,
+ new Label
+ {
+ Text = "Click the button a couple times, switch to the second tab, and then back to the first. The Appearing event (which increase the counter) should only occur for the visible first tab."
+ },
+ new Button
+ {
+ Text = "Push new page",
+ Command = new Command(() => Navigation.PushAsync(new Bugzilla52419Page1()))
+ }
+ }
+ };
+ Appearing += OnAppearing;
+ }
+
+ void OnAppearing(object sender, EventArgs e)
+ {
+ _count++;
+ _timesAppeared.Text = "Times Appeared: " + _count.ToString();
+ }
+ }
+
+ class Bugzilla52419Page2 : ContentPage
+ {
+ public Bugzilla52419Page2()
+ {
+ Title = "Tab Page 2";
+ Content = new StackLayout
+ {
+ Children =
+ {
+ new Label
+ {
+ Text = "Other content"
+ }
+ }
+ };
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index 0722232e..b8c313ac 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -165,6 +165,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla45215.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44500.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla47548.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla52419.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla53834.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla51536.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44940.cs" />