maui-linux/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issu.../Bugzilla25662.cs

48 строки
1.0 KiB
C#

using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif
namespace Xamarin.Forms.Controls.Issues
{
[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
}
}