Skip to content

Commit 35b9904

Browse files
committed
add tests for ui transforms
1 parent d726324 commit 35b9904

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

tests/UITransformTests.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using Worlds;
3+
4+
namespace UI.Tests
5+
{
6+
public class UITransformTests : UITests
7+
{
8+
[Test]
9+
public void RotateTransform()
10+
{
11+
using World world = CreateWorld();
12+
UITransform a = new(world, new(-123, 6990), new(100, 800), MathF.Tau * 0.25f);
13+
Assert.That(a.Position.X, Is.EqualTo(-123));
14+
Assert.That(a.Position.Y, Is.EqualTo(6990));
15+
Assert.That(a.Rotation, Is.EqualTo(MathF.Tau * 0.25f).Within(0.01f));
16+
Assert.That(a.Width, Is.EqualTo(100));
17+
Assert.That(a.Height, Is.EqualTo(800));
18+
19+
UITransform b = new(world, new(-123, 6990), new(100, 800), MathF.Tau * -0.5f);
20+
Assert.That(b.Rotation, Is.EqualTo(MathF.Tau * 0.5f).Within(0.01f));
21+
}
22+
}
23+
}

0 commit comments

Comments
 (0)