Example #1
0
        public void AreaHandleCursor()
        {
            CourseObj courseobj = new OOBCourseObj(SpecialId(0), 1, defaultCourseAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });
            PointF[] handles = courseobj.GetHandles();

            for (int i = 0; i < handles.Length; ++i)
                Assert.AreSame(Util.MoveHandleCursor, courseobj.GetHandleCursor(handles[i]));
        }
Example #2
0
        public void AreaObjectEquals()
        {
            CourseObj courseobj = new OOBCourseObj(SpecialId(0), 1, defaultCourseAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });
            CourseObj courseobj2 = new OOBCourseObj(SpecialId(0), 1, defaultCourseAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });
            CourseObj courseobj3 = new OOBCourseObj(SpecialId(1), 1, defaultCourseAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });
            CourseObj courseobj4 = new OOBCourseObj(SpecialId(2), 1, defaultCourseAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });
            CourseObj courseobj5 = new OOBCourseObj(SpecialId(0), 2, defaultCourseAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });
            CourseObj courseobj6 = new OOBCourseObj(SpecialId(0), 1, defaultCourseAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.6F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });
            CourseObj courseobj7 = new DangerousCourseObj(SpecialId(0), 1, defaultCourseAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });

            Assert.AreEqual(courseobj, courseobj);
            Assert.AreEqual(courseobj, courseobj2);
            Assert.AreNotEqual(courseobj, courseobj3);
            Assert.AreNotEqual(courseobj, courseobj4);
            Assert.AreNotEqual(courseobj, courseobj5);
            Assert.AreNotEqual(courseobj, courseobj6);
            Assert.AreNotEqual(courseobj, courseobj7);
        }
Example #3
0
        public void GetAreaHandles()
        {
            CourseObj courseobj = new OOBCourseObj(SpecialId(0), 1, defaultCourseAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });
            PointF[] handles = courseobj.GetHandles();
            PointF[] expected = { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F) };

            Assert.AreEqual(expected.Length, handles.Length);
            for (int i = 0; i < handles.Length; ++i)
                Assert.AreEqual(expected[i], handles[i]);
        }
Example #4
0
 public void OutOfBoundsSpecial()
 {
     CourseObj courseobj = new OOBCourseObj(SpecialId(0), 1, specialAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });
     SingleObject(courseobj, "out_of_bounds_special");
 }
Example #5
0
 public void OutOfBoundsOffset()
 {
     CourseObj courseobj = new OOBCourseObj(SpecialId(0), 1, defaultCourseAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });
     SingleObjectOffset(courseobj, "out_of_bounds_offset");
 }
Example #6
0
 public void OutOfBoundsDump()
 {
     CourseObj courseobj = new OOBCourseObj(SpecialId(13), 1.5F, defaultCourseAppearance, new PointF[] { new PointF(3, 3), new PointF(1, 1), new PointF(4, 1), new PointF(3, 3) });
     AssertDump(courseobj, @"OOB:            special:13  scale:1.5  path:N(3,3)--N(1,1)--N(4,1)--N(3,3)");
 }
Example #7
0
 public void OutOfBoundsDistance()
 {
     CourseObj courseobj = new OOBCourseObj(SpecialId(0), 1, defaultCourseAppearance, new PointF[] { new PointF(3, 3), new PointF(1, 1), new PointF(4, 1), new PointF(3, 3) });
     Assert.AreEqual(Math.Round(1.414213, 3), Math.Round(courseobj.DistanceFromPoint(new PointF(1, 3)), 3));
     Assert.AreEqual(0.0, courseobj.DistanceFromPoint(new PointF(3.7F, 1.1F)));
     Assert.AreEqual(0.0, courseobj.DistanceFromPoint(new PointF(2F, 1.5F)));
     Assert.AreEqual(1.0, Math.Round(courseobj.DistanceFromPoint(new PointF(5, 1)), 3));
 }
Example #8
0
 public void MoveAreaHandle()
 {
     CourseObj courseobj = new OOBCourseObj(SpecialId(0), 1, defaultCourseAppearance, new PointF[5] { new PointF(-3.0F, -2.0F), new PointF(-2.5F, 1.5F), new PointF(2.5F, 1.0F), new PointF(3.0F, -2.0F), new PointF(-3.0F, -2.0F) });
     courseobj.MoveHandle(new PointF(-3.0F, -2.0F), new PointF(-3.2F, 1.1F));
     courseobj.MoveHandle(new PointF(3F, -2.0F), new PointF(3.1F, -1.3F));
     Assert.AreEqual(@"OOB:            scale:1  path:N(-3.2,1.1)--N(-2.5,1.5)--N(2.5,1)--N(3.1,-1.3)--N(-3.2,1.1)", courseobj.ToString());
 }