-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
ButtonTests.cs
35 lines (31 loc) · 1.09 KB
/
ButtonTests.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
using System;
using System.Threading.Tasks;
using NUnit.Framework;
using Xamarin.Forms.CustomAttributes;
using AColor = Android.Graphics.Color;
namespace Xamarin.Forms.Platform.Android.UnitTests
{
[TestFixture]
public class ButtonTests : PlatformTestFixture
{
[Test, Category("Button")]
[Description("Default Button Disabled color on Android doesn't look disabled after retrieving default VSM")]
[Issue(IssueTracker.Github, 10040, "[Bug] Button IsEnabled color Android")]
public async Task ButtonDisabledColorWorks()
{
Button myButton = new Button()
{
BackgroundColor = Color.Green,
TextColor = Color.White,
BindingContext = new object(),
Text = "test text",
IsEnabled = false
};
var vsm = myButton.GetValue(VisualStateManager.VisualStateGroupsProperty);
var textColors = await GetControlProperty(myButton, (b) => b.TextColors);
var disabledColor = textColors.GetColorForState(new[] { -global::Android.Resource.Attribute.StateEnabled }, AColor.Green);
int compareTo = Color.White.ToAndroid();
Assert.AreNotEqual(compareTo, disabledColor);
}
}
}