2023-08-26 18:15:04 +01:00
|
|
|
using System.Drawing;
|
2022-05-28 14:19:46 +01:00
|
|
|
using NUnit.Framework;
|
|
|
|
using X10D.Unity.Drawing;
|
|
|
|
using Random = System.Random;
|
|
|
|
|
|
|
|
namespace X10D.Unity.Tests.Drawing
|
|
|
|
{
|
|
|
|
public class RectangleTests
|
|
|
|
{
|
2023-04-05 19:18:06 +01:00
|
|
|
[Test]
|
|
|
|
public void ToUnityRect_ShouldReturnRect_WithEquivalentMembers()
|
2022-05-28 14:19:46 +01:00
|
|
|
{
|
|
|
|
var random = new Random();
|
|
|
|
var rectangle = new Rectangle(random.Next(), random.Next(), random.Next(), random.Next());
|
|
|
|
var rect = rectangle.ToUnityRect();
|
2022-06-01 11:06:24 +01:00
|
|
|
|
2023-04-05 22:51:04 +01:00
|
|
|
Assert.That(rect.x, Is.EqualTo(rectangle.X));
|
|
|
|
Assert.That(rect.y, Is.EqualTo(rectangle.Y));
|
|
|
|
Assert.That(rect.width, Is.EqualTo(rectangle.Width));
|
|
|
|
Assert.That(rect.height, Is.EqualTo(rectangle.Height));
|
2022-06-01 11:06:24 +01:00
|
|
|
}
|
|
|
|
|
2023-04-05 19:18:06 +01:00
|
|
|
[Test]
|
|
|
|
public void ToUnityRectInt_ShouldReturnRect_WithEquivalentMembers()
|
2022-06-01 11:06:24 +01:00
|
|
|
{
|
|
|
|
var random = new Random();
|
|
|
|
var rectangle = new Rectangle(random.Next(), random.Next(), random.Next(), random.Next());
|
|
|
|
var rect = rectangle.ToUnityRectInt();
|
|
|
|
|
2023-04-05 22:51:04 +01:00
|
|
|
Assert.That(rect.x, Is.EqualTo(rectangle.X));
|
|
|
|
Assert.That(rect.y, Is.EqualTo(rectangle.Y));
|
|
|
|
Assert.That(rect.width, Is.EqualTo(rectangle.Width));
|
|
|
|
Assert.That(rect.height, Is.EqualTo(rectangle.Height));
|
2022-05-28 14:19:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|