summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla28001.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla28001.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla28001.cs60
1 files changed, 60 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla28001.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla28001.cs
new file mode 100644
index 00000000..e73bc0dd
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla28001.cs
@@ -0,0 +1,60 @@
+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, 28001, "[Android] TabbedPage: invisible tabs are not Disposed", PlatformAffected.Android)]
+ public class Bugzilla28001 : TestContentPage
+ {
+ static int s_disposeCount;
+ static Label s_lbl;
+
+ void HandleDispose (object sender, EventArgs e)
+ {
+ s_disposeCount++;
+ s_lbl.Text = string.Format ("Dispose {0} pages", s_disposeCount);
+ }
+
+ protected override void Init ()
+ {
+ s_lbl = new Label { AutomationId = "lblDisposedCound" };
+ var tab1 = new DisposePage { Title = "Tab1" };
+ var tab2 = new DisposePage { Title = "Tab2" };
+ tab1.RendererDisposed += HandleDispose;
+ tab2.RendererDisposed += HandleDispose;
+
+ tab2.PopAction = tab1.PopAction = async () => await Navigation.PopAsync ();
+
+ var tabbedPage = new TabbedPage { Children = { tab1, tab2 } };
+ var btm = new Button { Text = "Push" };
+
+ btm.Clicked += async (object sender, EventArgs e) => {
+ await Navigation.PushAsync (tabbedPage);
+ };
+
+ Content = new StackLayout { Children = { btm, s_lbl } };
+ }
+
+
+ #if UITEST
+ [Test]
+ public void Bugzilla28001Test ()
+ {
+ RunningApp.Screenshot ("I am at Bugzilla 28001");
+ RunningApp.Tap (q => q.Marked ("Push"));
+ RunningApp.Tap (q => q.Marked ("Tab2"));
+ RunningApp.Tap (q => q.Marked ("Tab1"));
+ RunningApp.Tap (q => q.Marked ("Pop"));
+ RunningApp.WaitForElement (q => q.Marked (string.Format ("Dispose {0} pages", 2)));
+
+ }
+#endif
+ }
+}