summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32801.cs
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-03-22 13:02:25 -0700
committerJason Smith <jason.smith@xamarin.com>2016-03-22 16:13:41 -0700
commit17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch)
treeb5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32801.cs
downloadxamarin-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/Bugzilla32801.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32801.cs92
1 files changed, 92 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32801.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32801.cs
new file mode 100644
index 00000000..c285aeff
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla32801.cs
@@ -0,0 +1,92 @@
+´╗┐using System;
+
+using Xamarin.Forms.CustomAttributes;
+
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+using Xamarin.UITest.iOS;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.Bugzilla, 32801, "Memory Leak in TabbedPage + NavigationPage")]
+ public class Bugzilla32801 : TestTabbedPage // or TestMasterDetailPage, etc ...
+ {
+ protected override void Init ()
+ {
+ Children.Add (new NavigationPage (new TestDemoPage (1)) { Title = "Tab", Icon = "bank.png" });
+ Children.Add (new NavigationPage (new TestDemoPage (1)) { Title = "Tab 1", Icon = "bank.png" });
+
+ }
+
+ public class TestDemoPage : ContentPage
+ {
+ int _level = 0;
+
+ public TestDemoPage (int level)
+ {
+ _level = level;
+
+ System.Diagnostics.Debug.WriteLine ("Page Level {0} : Created", _level);
+
+ Title = string.Format ("Level {0}", level);
+
+ var lblStack = new Label ();
+
+ var buttonAdd = new Button {
+ Text = "Add Level",
+ AutomationId = "btnAdd",
+ BackgroundColor = Color.Aqua
+ };
+
+ buttonAdd.Clicked += (sender, e) => Navigation.PushAsync (new TestDemoPage (_level + 1));
+
+ var buttonStack = new Button {
+ Text = "Show Navigation Stack",
+ AutomationId = "btnStack",
+ BackgroundColor = Color.Aqua
+ };
+
+ buttonStack.Clicked += (object sender, EventArgs e) => {
+ lblStack.Text = "Stack " + Navigation.NavigationStack.Count.ToString ();
+ System.Diagnostics.Debug.WriteLine ("------------------------------------------------------------");
+ foreach (TestDemoPage page in Navigation.NavigationStack)
+ System.Diagnostics.Debug.WriteLine ("Items On Navigation Stack =====> Level {0}", page._level);
+ System.Diagnostics.Debug.WriteLine ("------------------------------------------------------------");
+ };
+
+ Content = new StackLayout {
+ Padding = new Thickness (20.0),
+ Spacing = 20.0,
+ Children = {
+ buttonAdd, buttonStack, lblStack
+ }
+ };
+ }
+
+ ~TestDemoPage ()
+ {
+ System.Diagnostics.Debug.WriteLine ("Page Level {0} : Destroyed", _level);
+ }
+ }
+
+ #if UITEST
+ [Test]
+ public void Bugzilla32801Test ()
+ {
+ if (RunningApp is iOSApp) {
+ RunningApp.Tap (c => c.Marked ("btnAdd"));
+ RunningApp.Tap (c => c.Marked ("btnAdd"));
+ RunningApp.Tap (c => c.Marked ("btnStack"));
+ RunningApp.WaitForElement (c => c.Marked ("Stack 3"));
+ RunningApp.Tap (c => c.Marked ("Tab"));
+ RunningApp.Tap (c => c.Marked ("btnStack"));
+ RunningApp.WaitForElement (c => c.Marked ("Stack 1"));
+ }
+ }
+#endif
+ }
+}