2022-05-28 14:19:46 +01:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using UnityEngine.TestTools;
|
|
|
|
|
using X10D.Core;
|
|
|
|
|
using X10D.Unity.Drawing;
|
|
|
|
|
using Random = System.Random;
|
|
|
|
|
|
|
|
|
|
namespace X10D.Unity.Tests.Drawing
|
|
|
|
|
{
|
|
|
|
|
public class RectangleFTests
|
|
|
|
|
{
|
|
|
|
|
[UnityTest]
|
|
|
|
|
public IEnumerator ToUnityRect_ShouldReturnRect_WithEquivalentMembers()
|
|
|
|
|
{
|
|
|
|
|
var random = new Random();
|
|
|
|
|
var rectangle = new RectangleF(random.NextSingle(), random.NextSingle(), random.NextSingle(), random.NextSingle());
|
|
|
|
|
var rect = rectangle.ToUnityRect();
|
2022-06-01 11:06:24 +01:00
|
|
|
|
|
2022-05-28 14:19:46 +01:00
|
|
|
|
Assert.AreEqual(rectangle.X, rect.x, 1e-6f);
|
|
|
|
|
Assert.AreEqual(rectangle.Y, rect.y, 1e-6f);
|
|
|
|
|
Assert.AreEqual(rectangle.Width, rect.width, 1e-6f);
|
|
|
|
|
Assert.AreEqual(rectangle.Height, rect.height, 1e-6f);
|
|
|
|
|
|
|
|
|
|
yield break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|