Esempio n. 1
0
        public void TestRotate902()
        {
            //Check a rotation returns back to itself when rotated 360 deg
            int[] rows = { 324, 563463, 43543212 };
            int[] cols = { 5 };

            int width = 6;
            int height = int.MaxValue;

            Segmentation s = new Segmentation(rows, cols, width, height);

            s.Rotate90();
            s.Rotate90();
            s.Rotate90();
            s.Rotate90();

            int[] expectedRows = { 324, 563463, 43543212 };
            int[] expectedCols = { 5 };
            int expectedWidth = 6;
            int expectedHeight = int.MaxValue;

            CollectionAssert.AreEqual(expectedRows, rows);
            CollectionAssert.AreEqual(expectedCols, cols);
            Assert.AreEqual(expectedWidth, s.Width);
            Assert.AreEqual(expectedHeight, s.Height);
        }
Esempio n. 2
0
        public void TestDeepCopy2()
        {
            //Test the copy is actually deep
            int[] rows = { 1, 2, 3, 67, 12 };
            int[] cols = { 89, 5, 4 };
            int width = 90;
            int height = 68;
            Segmentation orig = new Segmentation(rows, cols, width, height);
            Segmentation clone = orig.DeepCopy();

            //Rotating through 90 deg changes all of the supplied parameters
            orig.Rotate90();

            CollectionAssert.AreEqual(new int[] { 1, 2, 3, 67, 12 }, clone.Rows);
            CollectionAssert.AreEqual(new int[] { 89, 5, 4 }, clone.Cols);
            Assert.AreEqual(width, clone.Width);
            Assert.AreEqual(height, clone.Height);
        }
Esempio n. 3
0
        public void TestRotate901()
        {
            //Basic test - gives expected output
            int[] rows = { 1, 2, 4 };
            int[] cols = { 2, 7, 11 };
            int width = 20;
            int height = 5;

            Segmentation s = new Segmentation(rows, cols, width, height);

            int[] expectedRows = { 2, 7, 11 };
            int[] expectedCols = { 0, 2, 3 };
            int expectedWidth = 5;
            int expectedHeight = 20;

            s.Rotate90();

            CollectionAssert.AreEqual(expectedRows, s.Rows);
            CollectionAssert.AreEqual(expectedCols, s.Cols);
            Assert.AreEqual(expectedWidth, s.Width);
            Assert.AreEqual(expectedHeight, s.Height);
        }