2023-04-05 19:18:06 +01:00
|
|
|
|
using NUnit.Framework;
|
2022-05-28 14:19:46 +01:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
using X10D.Core;
|
|
|
|
|
using X10D.Unity.Drawing;
|
|
|
|
|
using Random = System.Random;
|
|
|
|
|
|
|
|
|
|
namespace X10D.Unity.Tests.Drawing
|
|
|
|
|
{
|
|
|
|
|
public class RectTests
|
|
|
|
|
{
|
2023-04-05 19:18:06 +01:00
|
|
|
|
[Test]
|
|
|
|
|
public void ToSystemRectangleF_ShouldReturnRectangleF_WithEquivalentMembers()
|
2022-05-28 14:19:46 +01:00
|
|
|
|
{
|
|
|
|
|
var random = new Random();
|
|
|
|
|
var rect = new Rect(random.NextSingle(), random.NextSingle(), random.NextSingle(), random.NextSingle());
|
|
|
|
|
var rectangle = rect.ToSystemRectangleF();
|
|
|
|
|
|
2023-04-05 22:51:04 +01:00
|
|
|
|
Assert.That(rectangle.X, Is.EqualTo(rect.x).Within(1e-6f));
|
|
|
|
|
Assert.That(rectangle.Y, Is.EqualTo(rect.y).Within(1e-6f));
|
|
|
|
|
Assert.That(rectangle.Width, Is.EqualTo(rect.width).Within(1e-6f));
|
|
|
|
|
Assert.That(rectangle.Height, Is.EqualTo(rect.height).Within(1e-6f));
|
2022-05-28 14:19:46 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|