summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2954.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2954.cs')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2954.cs58
1 files changed, 58 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2954.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2954.cs
new file mode 100644
index 00000000..6c645eeb
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue2954.cs
@@ -0,0 +1,58 @@
+using System;
+
+using Xamarin.Forms.CustomAttributes;
+
+#if UITEST
+using Xamarin.UITest;
+using NUnit.Framework;
+#endif
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve (AllMembers = true)]
+ [Issue (IssueTracker.Github, 2954, "Cell becomes empty after adding a new one with context actions (TableView) ")]
+ public class Issue2954 : TestContentPage // or TestMasterDetailPage, etc ...
+ {
+ TableSection _dataSection;
+ TableView _tableView;
+ int _count = 0;
+ protected override void Init ()
+ {
+ _dataSection = new TableSection {
+ new TextCell{ Text = "Cell1" },
+ new TextCell{ Text = "Cell2", ContextActions = { new MenuItem{ Text = "Delete" } } },
+ new TextCell{ Text = "Add new", Command = new Command (AddNew) }
+ };
+
+ _tableView = new TableView {
+ Root = new TableRoot {
+ _dataSection
+ }
+ };
+
+ Content = _tableView;
+ }
+
+ void AddNew (object parameters)
+ {
+ _count++;
+ _dataSection.Insert (0, new TextCell { Text = "Fresh cell " + _count
+ , ContextActions = { new MenuItem{ Text = "Delete" } }
+ });
+ _tableView.Root = _tableView.Root; //HACK - force table reload
+ }
+
+ #if UITEST
+ [Test]
+ public void Issue2954Test ()
+ {
+ RunningApp.Screenshot ("I am at Issue 2954");
+ RunningApp.WaitForElement (q => q.Marked ("Cell2"));
+ RunningApp.Screenshot ("I see the Cell2");
+ RunningApp.Tap(c => c.Marked("Add new"));
+ RunningApp.WaitForElement (q => q.Marked ("Cell2"));
+ RunningApp.Screenshot ("I still see the Cell2");
+ }
+#endif
+ }
+}