示例#1
0
        public void LookAhead_BeginingL2RMeet2AngledLines()
        {
            //arrange
            PathSection pathSection         = getPathSection(true);
            double      maxY                = -517.92;//-529.92;
            ColoBox     currentBoxReference = getBox(maxY);

            //act
            pathSection.SetRelativeLocation(currentBoxReference);

            Assert.AreEqual(pathSection.UpperPathSections.Count, 1);
            Assert.AreEqual(pathSection.LowerPathSections.Count, 1);
        }
示例#2
0
        public void IsBoxOutside_inside_TouchR2L()
        {
            ColoBox box = getBox(-375);

            box.MoveOriginTo(new Point {
                X = 410, Y = 335
            });
            PathSection pathSectionR2L = getPathSection(false, true);

            pathSectionR2L.SetRelativeLocation(box);

            //act
            bool isBoxR2LOutside = pathSectionR2L.machine.direction.IsBoxOutside(box, pathSectionR2L);

            //assert
            Assert.AreEqual(isBoxR2LOutside, false);
        }
示例#3
0
        public void IsBoxOutside_Outside_CrazyColoR2L()
        {
            //arrange
            ColoBox box = getBox(-375);

            box.MoveOriginTo(new Point {
                X = 692, Y = -395
            });
            PathSection pathSectionR2L = getPathSection(false);

            pathSectionR2L.SetRelativeLocation(box);

            //act
            bool isBoxR2LOutside = pathSectionR2L.machine.direction.IsBoxOutside(box, pathSectionR2L);

            //assert
            Assert.AreEqual(isBoxR2LOutside, true);
        }
示例#4
0
        public void IsBoxOutside_Inside_CrazyColoL2R()
        {
            //arrange
            ColoBox box = getBox(-375);

            box.MoveOriginTo(new Point {
                X = 655, Y = -375
            });
            PathSection pathSectionL2R = getPathSection(true);

            pathSectionL2R.SetRelativeLocation(box);

            //act
            bool isBoxL2ROutside = pathSectionL2R.machine.direction.IsBoxOutside(box, pathSectionL2R);

            //assert
            Assert.AreEqual(isBoxL2ROutside, false);
        }
示例#5
0
        public void _2_IsBoxOutside_inside_TouchL2R()
        {
            ColoBox box = getBox(-375);

            box.MoveOriginTo(new Point {
                X = 410, Y = 335
            });
            PathSection pathSectionL2R = getPathSection(true, true);

            pathSectionL2R.machine.CurrentBoxReference = box;
            pathSectionL2R.SetRelativeLocation(box);


            //act
            bool isBoxL2ROutside = pathSectionL2R.machine.direction.IsBoxOutside(box, pathSectionL2R);

            //assert
            Assert.AreEqual(isBoxL2ROutside, false);
        }
示例#6
0
        public void LookAhead_Top2SectionsPositiveNegative_NegativePositive()
        {
            //arrange
            PathSection pathSection         = getPathSection(true);
            double      maxY                = -102.92;
            ColoBox     currentBoxReference = getBox(maxY);

            //act
            pathSection.SetRelativeLocation(currentBoxReference);

            //assert
            Assert.AreEqual(pathSection.UpperPathSections.Count, 3);
            Assert.AreEqual(pathSection.LowerPathSections.Count, 3);
            //upper
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[0].X, 2), 310.81);
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[0].Y, 2), 342.65);
            Assert.AreEqual(pathSection.UpperPathSections[0].RelativeLocation, RelativeLocation.Inside);

            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[1].X, 2), 342.65);
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[1].Y, 2), 400.61);
            Assert.AreEqual(pathSection.UpperPathSections[1].RelativeLocation, RelativeLocation.Outside);

            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[2].X, 2), 400.61);
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[2].Y, 2), 474.96);
            Assert.AreEqual(pathSection.UpperPathSections[2].RelativeLocation, RelativeLocation.Inside);

            //lower
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[0].X, 2), 295.13);
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[0].Y, 2), 358.33);
            Assert.AreEqual(pathSection.LowerPathSections[0].RelativeLocation, RelativeLocation.Inside);

            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[1].X, 2), 358.33);
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[1].Y, 2), 390);
            Assert.AreEqual(pathSection.LowerPathSections[1].RelativeLocation, RelativeLocation.Outside);

            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[2].X, 2), 390);
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[2].Y, 2), 487.91);
            Assert.AreEqual(pathSection.LowerPathSections[2].RelativeLocation, RelativeLocation.Inside);
        }
示例#7
0
        public void LookAhead_2VerticalsAndNegative()
        {
            //arrange
            PathSection pathSection         = getPathSection(true);
            double      maxY                = -381.92;
            ColoBox     currentBoxReference = getBox(maxY);

            //act
            pathSection.SetRelativeLocation(currentBoxReference);

            //assert
            Assert.AreEqual(pathSection.UpperPathSections.Count, 1);
            Assert.AreEqual(pathSection.LowerPathSections.Count, 1);
            //upper
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[0].X, 2), 300.5);
            Assert.AreEqual(Math.Round(pathSection.UpperPathSections[0].Y, 2), 697);
            Assert.AreEqual(pathSection.UpperPathSections[0].RelativeLocation, RelativeLocation.Inside);

            //upper
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[0].X, 2), 297.61);
            Assert.AreEqual(Math.Round(pathSection.LowerPathSections[0].Y, 2), 697);
            Assert.AreEqual(pathSection.LowerPathSections[0].RelativeLocation, RelativeLocation.Inside);
        }