public void BurstedJobTest() { var r1 = Rect2D.FromPositionSize(0, 0, 10, 10); NativeList <int2> output = new NativeList <int2>(Allocator.TempJob); new GetPointsJob { Output = output, Rect = r1 }.Schedule().Complete(); Assert.AreEqual(10 * 10, output.Length); output.Dispose(); }
public void RectInitialization() { Rect2D r = Rect2D.FromExtents(0, 0, 10, 10); Assert.AreEqual(new int2(0, 0), r.Position); Assert.AreEqual(new int2(10, 10), r.Max); Assert.AreEqual(new int2(10, 10), r.Size); r = Rect2D.FromPositionSize(5, 5, 5, 5); Assert.IsFalse(r.Intersect(new int2(0, 0))); Assert.AreEqual(new int2(5, 5), r.Position); Assert.AreEqual(new int2(5, 5), r.Size); }
public void SetCenter() { var r1 = Rect2D.FromPositionSize(0, 10); r1.Center = 30; Assert.AreEqual(30, r1.Center.x); Assert.AreEqual(30, r1.Center.y); Assert.AreEqual(25, r1.xMin); Assert.AreEqual(25, r1.yMin); Assert.AreEqual(35, r1.xMax); Assert.AreEqual(35, r1.yMax); Assert.AreEqual(10, r1.Width); Assert.AreEqual(10, r1.Height); }