-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
Issue2883.cs
130 lines (110 loc) · 3.93 KB
/
Issue2883.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
using System;
using Xamarin.Forms.CustomAttributes;
using System.Collections.Generic;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.UITest.iOS;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github5000)]
[NUnit.Framework.Category(Core.UITests.UITestCategories.UwpIgnore)]
#endif
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Github, 2883, "ViewCell IsEnabled set to false does not disable a cell in a TableView")]
public class Issue2883 : TestContentPage
{
protected override void Init ()
{
var btnCustom1 = new Button () {
AutomationId = "btnCustomCellTable",
Text = "Custom Table Cell" ,
HorizontalOptions = LayoutOptions.Start
};
var btnCustom1Enabled = new Button () {
AutomationId = "btnCustomCellTableEnabled",
Text = "Custom Table Cell Enabled" ,
HorizontalOptions = LayoutOptions.Start
};
var btnCustom = new Button () {
AutomationId = "btnCustomCellListView",
Text = "Custom Cell" ,
HorizontalOptions = LayoutOptions.Start
};
var btnCustomEnabled = new Button () {
AutomationId = "btnCustomCellListViewEnabled",
Text = "Custom Cell Enabled" ,
HorizontalOptions = LayoutOptions.Start
};
btnCustom.Clicked += (object sender, EventArgs e) => {
DisplayAlert ("Clicked", "I was clicked even disabled", "ok");
};
btnCustom1.Clicked += (object sender, EventArgs e) => {
DisplayAlert ("Clicked", "I was clicked even disabled", "ok");
};
btnCustom1Enabled.Clicked += (object sender, EventArgs e) => {
DisplayAlert ("Clicked", "I was clicked", "ok");
};
btnCustomEnabled.Clicked += (object sender, EventArgs e) => {
DisplayAlert ("Clicked", "I was clicked", "ok");
};
var customCell = new ViewCell () {
IsEnabled = false,
View = new StackLayout { Children = { btnCustom } }
};
var customCellEnabled = new ViewCell () {
View = new StackLayout { Children = { btnCustomEnabled } }
};
var customTableCell = new ViewCell () {
IsEnabled = false,
View = new StackLayout { Children = { btnCustom1 } }
};
var customTableCellEnabled = new ViewCell () {
View = new StackLayout { Children = { btnCustom1Enabled } }
};
var tableview = new TableView () {
Intent = TableIntent.Form,
Root = new TableRoot (),
VerticalOptions = LayoutOptions.Start
};
tableview.Root.Add (new TableSection () { customTableCell, customTableCellEnabled });
var listview = new ListView { VerticalOptions = LayoutOptions.Start };
var listview2 = new ListView { VerticalOptions = LayoutOptions.Start };
listview.ItemTemplate = new DataTemplate (() => customCell);
listview2.ItemTemplate = new DataTemplate (() => customCellEnabled);
listview2.ItemsSource = listview.ItemsSource = new List<string> () { "1" };
Content = new StackLayout {
Orientation = StackOrientation.Vertical,
VerticalOptions = LayoutOptions.Start,
Children = { tableview, listview, listview2 }
};
}
#if UITEST
[Test]
public void Issue2883TestDisabled ()
{
RunningApp.Screenshot ("I am at Issue 2883");
RunningApp.Tap( c=> c.Marked("btnCustomCellTable"));
RunningApp.WaitForNoElement( c=> c.Marked("Clicked"));
RunningApp.Screenshot ("I dont see the disable cell");
RunningApp.Tap( c=> c.Marked("btnCustomCellListView"));
RunningApp.WaitForNoElement( c=> c.Marked("Clicked"));
RunningApp.Screenshot ("I dont see the disable cell");
}
[Test]
public void Issue2883TestEnabled ()
{
RunningApp.Tap( c=> c.Marked("btnCustomCellTableEnabled"));
RunningApp.Screenshot ("I see the cell that is enabled");
RunningApp.WaitForElement( c=> c.Marked("Clicked"));
RunningApp.Tap (c => c.Marked ("ok"));
RunningApp.Tap( c=> c.Marked("btnCustomCellListViewEnabled"));
RunningApp.WaitForElement( c=> c.Marked("Clicked"));
RunningApp.Tap (c => c.Marked ("ok"));
}
#endif
}
}