Example #1
0
        public void Constructor_ValidOrder_PropertiesAreSet()
        {
            var matrix = new MagickColorMatrix(2, 0.0, 1.0, 0.1, 1.1);

            Assert.Equal(2, matrix.Order);
            Assert.Equal(0.0, matrix.GetValue(0, 0));
            Assert.Equal(1.0, matrix.GetValue(1, 0));
            Assert.Equal(0.1, matrix.GetValue(0, 1));
            Assert.Equal(1.1, matrix.GetValue(1, 1));
        }
Example #2
0
        public void SetRow_CorrectNumberOfValues_SetsColumn()
        {
            var matrix = new MagickColorMatrix(2);

            matrix.SetRow(1, 6, 8);
            Assert.Equal(0, matrix.GetValue(0, 0));
            Assert.Equal(6, matrix.GetValue(0, 1));
            Assert.Equal(0, matrix.GetValue(1, 0));
            Assert.Equal(8, matrix.GetValue(1, 1));
        }
Example #3
0
        public void Test_Value()
        {
            MagickColorMatrix matrix = new MagickColorMatrix(2);

            matrix.SetValue(0, 0, 1.5);
            Assert.AreEqual(1.5, matrix.GetValue(0, 0));

            Assert.AreEqual(0.0, matrix.GetValue(0, 1));
            Assert.AreEqual(0.0, matrix.GetValue(1, 0));
        }
Example #4
0
        public void SetValue_ValidIndex_SetsValue()
        {
            var matrix = new MagickColorMatrix(2);

            matrix.SetValue(1, 0, 1.5);

            Assert.Equal(0.0, matrix.GetValue(0, 0));
            Assert.Equal(0.0, matrix.GetValue(0, 1));
            Assert.Equal(1.5, matrix.GetValue(1, 0));
            Assert.Equal(0.0, matrix.GetValue(1, 1));
        }
Example #5
0
        public void Test_SetRow()
        {
            MagickColorMatrix matrix = new MagickColorMatrix(2);

            matrix.SetRow(0, 2, 4);
            Assert.AreEqual(2, matrix.GetValue(0, 0));
            Assert.AreEqual(4, matrix.GetValue(1, 0));

            matrix.SetRow(1, 6, 8);
            Assert.AreEqual(6, matrix.GetValue(0, 1));
            Assert.AreEqual(8, matrix.GetValue(1, 1));
        }
Example #6
0
        private static void GetValue_InvalidIndex_ThrowsException(string paramName, int x, int y)
        {
            var matrix = new MagickColorMatrix(2);

            Assert.Throws <ArgumentOutOfRangeException>(paramName, () =>
            {
                matrix.GetValue(x, y);
            });
        }
Example #7
0
        public void Test_Constructor()
        {
            ExceptionAssert.Throws <ArgumentException>(delegate()
            {
                new MagickColorMatrix(-1);
            });

            ExceptionAssert.Throws <ArgumentException>(delegate()
            {
                new MagickColorMatrix(7);
            });

            new MagickColorMatrix(1);

            ExceptionAssert.Throws <ArgumentException>(delegate()
            {
                new MagickColorMatrix(2, 1.0);
            });

            MagickColorMatrix matrix = new MagickColorMatrix(2, 0.0, 1.0, 0.1, 1.1);

            Assert.AreEqual(0.0, matrix.GetValue(0, 0));
            Assert.AreEqual(1.0, matrix.GetValue(1, 0));
            Assert.AreEqual(0.1, matrix.GetValue(0, 1));
            Assert.AreEqual(1.1, matrix.GetValue(1, 1));

            ExceptionAssert.Throws <ArgumentOutOfRangeException>(delegate()
            {
                matrix.GetValue(2, 1);
            });

            ExceptionAssert.Throws <ArgumentOutOfRangeException>(delegate()
            {
                matrix.GetValue(1, 2);
            });

            ExceptionAssert.Throws <ArgumentOutOfRangeException>(delegate()
            {
                matrix.GetValue(1, -1);
            });

            ExceptionAssert.Throws <ArgumentOutOfRangeException>(delegate()
            {
                matrix.GetValue(-1, 1);
            });
        }
Example #8
0
        public void GetValue_ValidIndex_ReturnValue()
        {
            var matrix = new MagickColorMatrix(1, 4);

            Assert.Equal(4, matrix.GetValue(0, 0));
        }