-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
RotationTests.cs
74 lines (68 loc) · 2.04 KB
/
RotationTests.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
using System.Collections;
using System.Threading.Tasks;
using NUnit.Framework;
using NUnit.Framework.Internal;
namespace Xamarin.Forms.Platform.Android.UnitTests
{
[TestFixture]
public class RotationTests : PlatformTestFixture
{
static IEnumerable RotationXCases
{
get
{
foreach (var element in BasicElements)
{
element.RotationX = 33.0;
yield return CreateTestCase(element);
}
}
}
static IEnumerable RotationYCases
{
get
{
foreach (var element in BasicElements)
{
element.RotationY = 87.0;
yield return CreateTestCase(element);
}
}
}
static IEnumerable RotationCases
{
get
{
foreach (var element in BasicElements)
{
element.Rotation = 23.0;
yield return CreateTestCase(element);
}
}
}
[Test, Category("RotationX"), TestCaseSource(nameof(RotationXCases))]
[Description("VisualElement X rotation should match renderer X rotation")]
public async Task RotationXConsistent(VisualElement element)
{
var expected = element.RotationX;
var actual = await GetRendererProperty(element, ver => ver.View.RotationX, requiresParent: true);
Assert.That((double)actual, Is.EqualTo(expected).Within(0.0001d));
}
[Test, Category("RotationY"), TestCaseSource(nameof(RotationYCases))]
[Description("VisualElement Y rotation should match renderer Y rotation")]
public async Task RotationYConsistent(VisualElement element)
{
var expected = element.RotationY;
var actual = await GetRendererProperty(element, ver => ver.View.RotationY, requiresParent: true);
Assert.That((double)actual, Is.EqualTo(expected).Within(0.0001d));
}
[Test, Category("Rotation"), TestCaseSource(nameof(RotationCases))]
[Description("VisualElement rotation should match renderer rotation")]
public async Task RotationConsistent(VisualElement element)
{
var expected = element.Rotation;
var actual = await GetRendererProperty(element, ver => ver.View.Rotation, requiresParent: true);
Assert.That((double)actual, Is.EqualTo(expected).Within(0.0001d));
}
}
}