コード例 #1
0
        public void Test_PolygonCustomTest()
        {
            CanvasPixel canvas = new CanvasPixel(11, 20);

            Trace.RegionManipulator rm = new Trace.RegionManipulator(canvas, canvas);

            Trace.RegionVO region = new Trace.RegionVO(new Pixel());
            region.Pixels = Helper_GetCustomPolygon(rm);

            Helper_Test_EdgeCrawler(region, rm, new Point(9, 9));
        }
コード例 #2
0
        private void Helper_Test_EdgeCrawler2(Trace.RegionVO region, int [] expectedPoints, Trace.RegionManipulator rm, Point?startPoint)
        {
            List <int> result =
                (startPoint.HasValue) ?
                new RegionToPolygon_Test().EdgeCrawler(region, rm, rm.Get_IndexFromPoint(startPoint.Value)) :
                new RegionToPolygon_Test().EdgeCrawler(region, rm);

            int[] correctResult = expectedPoints;

            bool resultCompare = Helper_ComparePixelRegions(result.ToArray(), correctResult);

            Assert.IsTrue(resultCompare);
        }
コード例 #3
0
        public void Test_PolygonRectangle_AtEdgeTest()
        {
            // arrange
            Test2DPolygonDefinition testPolygon = Helper_Get2DRectangleEdgePolygon();

            Trace.RegionManipulator rm     = Helper_Create_RegionManipulator(testPolygon);
            Trace.RegionVO          region = Helper_Create_RegionFromParam(testPolygon, rm);

            int[] correctPixelsIndex = Helper_Create_PixelsOfRegionFromParam(Helper_Get2DRectangleEdgePolygon_Correct(), rm);

            // act
            int [] newPixelsIndex = new RegionToPolygon_Test().EdgeCrawler(region, rm).ToArray();

            // assert
            bool resultCompare = Helper_ComparePixelRegions(newPixelsIndex, correctPixelsIndex);

            Assert.IsTrue(resultCompare);
        }
コード例 #4
0
 private Trace.RegionVO Helper_Create_RegionFromParam(Test2DPolygonDefinition testPolygon, Trace.RegionManipulator rm)
 {
     Trace.RegionVO region = new Trace.RegionVO(new Pixel());
     region.Pixels = Helper_Create_PixelsOfRegionFromParam(testPolygon, rm);
     return(region);
 }