示例#1
0
        public void GetVisibleGridPoints_Padding()
        {
            // arrange
            IMedianFlowTrackerBoundingBox bb = new MedianFlowTrackerBoundingBox
                                               (
                new PointF(2.5f, 3),
                new SizeF(3, 2),        // bb is not square
                new Size(2, 2),         // there are 4 grid points
                new SizeF(1, 0.5f)      // padding, different for horizontal and vertical
                                               );

            // define expected
            PointF[] expectedPoints =
            {
                new PointF(2, 2.5f), new PointF(3, 2.5f),
                new PointF(2, 3.5f), new PointF(3, 3.5f)
            };

            // get actual
            PointF[] actualPoints = bb.GetGridPoints();

            // assert
            CollectionAssert.AreEqual(expectedPoints, actualPoints);
        }
示例#2
0
        public void GetVisibleGridPoints_Simple()
        {
            // arrange
            IMedianFlowTrackerBoundingBox bb = new MedianFlowTrackerBoundingBox
                                               (
                new PointF(2.5f, 3),
                new SizeF(3, 2),        // bb is not square
                new Size(2, 2),         // there are 4 grid points
                new SizeF(0, 0)
                                               );

            // define expected
            PointF[] expectedPoints =
            {
                new PointF(1, 2), new PointF(4, 2),
                new PointF(1, 4), new PointF(4, 4)
            };

            // get actual
            PointF[] actualPoints = bb.GetGridPoints();

            // assert
            CollectionAssert.AreEqual(expectedPoints, actualPoints);
        }