public void AddGap1() { // Add a gap to a null gap array. SymPath path = new SymPath(new PointF[] { new PointF(10, 10), new PointF(10, 0), new PointF(0, 0) }); PointF pt1 = new PointF(7, -2); PointF pt2 = new PointF(11, 4); LegGap[] gaps = LegGap.AddGap(path, null, pt1, pt2); Assert.AreEqual(1, gaps.Length); Assert.AreEqual(6, gaps[0].distanceFromStart); Assert.AreEqual(7, gaps[0].length); }
public void AddGap2() { // Add a gap to an existing array. SymPath path = new SymPath(new PointF[] { new PointF(10, 10), new PointF(10, 0), new PointF(0, 0) }); LegGap[] oldGaps = { new LegGap(6, 7) }; PointF pt1 = new PointF(8, -2); PointF pt2 = new PointF(11, 8.5F); LegGap[] gaps = LegGap.AddGap(path, oldGaps, pt1, pt2); Assert.AreEqual(1, gaps.Length); Assert.AreEqual(1.5F, gaps[0].distanceFromStart); Assert.AreEqual(11.5F, gaps[0].length); pt1 = new PointF(3, -2); pt2 = new PointF(1.5F, 1); gaps = LegGap.AddGap(path, oldGaps, pt1, pt2); Assert.AreEqual(2, gaps.Length); Assert.AreEqual(6, gaps[0].distanceFromStart); Assert.AreEqual(7, gaps[0].length); Assert.AreEqual(17F, gaps[1].distanceFromStart); Assert.AreEqual(1.5F, gaps[1].length); }