1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-16 02:53:11 +01:00
MLEM/Tests/CameraTests.cs

31 lines
643 B
C#
Raw Normal View History

2021-04-04 18:31:51 +02:00
using Microsoft.Xna.Framework;
using MLEM.Cameras;
using NUnit.Framework;
2022-12-13 13:11:36 +01:00
namespace Tests;
2021-04-04 18:31:51 +02:00
2022-10-27 10:22:25 +02:00
public class CameraTests {
2021-04-04 18:31:51 +02:00
2022-10-27 10:22:25 +02:00
private TestGame game;
2021-04-04 18:31:51 +02:00
2022-10-27 10:22:25 +02:00
[SetUp]
public void SetUp() {
this.game = TestGame.Create();
}
2021-04-04 18:31:51 +02:00
2022-10-27 10:22:25 +02:00
[TearDown]
public void TearDown() {
this.game?.Dispose();
}
2021-04-04 18:31:51 +02:00
2022-10-27 10:22:25 +02:00
[Test]
public void TestConversions([Range(-4, 4, 4F)] float x, [Range(-4, 4, 4F)] float y) {
var camera = new Camera(this.game.GraphicsDevice);
var pos = new Vector2(x, y);
var cam = camera.ToCameraPos(pos);
var ret = camera.ToWorldPos(cam);
Assert.AreEqual(pos, ret);
2021-04-04 18:31:51 +02:00
}
2022-10-27 10:22:25 +02:00
2022-06-17 18:23:47 +02:00
}