-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathOpacityTests.cs
More file actions
33 lines (31 loc) · 898 Bytes
/
OpacityTests.cs
File metadata and controls
33 lines (31 loc) · 898 Bytes
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
using System.Collections;
using System.Threading.Tasks;
using Microsoft.Maui.Controls.CustomAttributes;
using NUnit.Framework;
using NUnit.Framework.Internal;
namespace Microsoft.Maui.Controls.Compatibility.Platform.Android.UnitTests
{
[TestFixture]
public class OpacityTests : PlatformTestFixture
{
static IEnumerable TestCases
{
get
{
foreach (var element in BasicElements)
{
element.Opacity = 0.35;
yield return CreateTestCase(element);
}
}
}
[Test, Category("Opacity"), TestCaseSource(nameof(TestCases))]
[Description("VisualElement opacity should match renderer opacity")]
public async Task OpacityConsistent(VisualElement element)
{
var expected = element.Opacity;
var actual = await GetRendererProperty(element, ver => ver.View.Alpha, requiresParent: true);
Assert.That((double)actual, Is.EqualTo(expected).Within(0.001d));
}
}
}