blob: d878731b186b8df6851f07821a042d180e3fed00 (
plain)
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
|
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.Forms.Core.UITests;
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.Cells)]
#endif
[Preserve (AllMembers = true)]
[Issue (IssueTracker.Bugzilla, 25662, "Setting IsEnabled does not disable SwitchCell")]
public class Bugzilla25662 : TestContentPage
{
[Preserve(AllMembers = true)]
class MySwitch : SwitchCell
{
public MySwitch ()
{
IsEnabled = false;
SetBinding(SwitchCell.TextProperty, new Binding("."));
OnChanged += (sender, e) => Text = "FAIL";
}
}
protected override void Init ()
{
var list = new ListView {
ItemsSource = new[] {
"One", "Two", "Three"
},
ItemTemplate = new DataTemplate (typeof (MySwitch))
};
Content = list;
}
#if UITEST
[Test]
public void Bugzilla25662Test ()
{
RunningApp.WaitForElement (q => q.Marked ("One"));
RunningApp.Tap(q => q.Marked("One"));
RunningApp.WaitForNoElement(q => q.Marked("FAIL"));
}
#endif
}
}
|