Пример #1
0
 public void ShouldNotThrowExceptionWhenDoubleArrayHasInvalidSize()
 {
     using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
     {
         using (IPixelCollection pixels = image.GetPixelsUnsafe())
         {
             pixels.SetPixels(new double[] { 0, 0, 0, 0 });
         }
     }
 }
Пример #2
0
 public void SetPixelsWithArray_InvalidSize_ThrowsNoException()
 {
     using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
     {
         using (IPixelCollection pixels = image.GetPixelsUnsafe())
         {
             pixels.SetPixels(new QuantumType[] { 0, 0, 0, 0 });
         }
     }
 }
Пример #3
0
 public void ShouldNotThrowExceptionWhenDoubleArrayIsNull()
 {
     using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
     {
         using (IPixelCollection pixels = image.GetPixelsUnsafe())
         {
             pixels.SetPixels((double[])null);
         }
     }
 }
Пример #4
0
 public void ShouldNotThrowExceptionWhenByteArrayIsTooLong()
 {
     using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
     {
         using (IPixelCollection pixels = image.GetPixelsUnsafe())
         {
             var values = new byte[(image.Width * image.Height * image.ChannelCount) + 1];
             pixels.SetPixels(values);
         }
     }
 }
Пример #5
0
 public void SetPixelsWithArray_TooManyValues_ThrowsNoException()
 {
     using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
     {
         using (IPixelCollection pixels = image.GetPixelsUnsafe())
         {
             var values = new QuantumType[(image.Width * image.Height * image.ChannelCount) + 1];
             pixels.SetPixels(values);
         }
     }
 }
Пример #6
0
 public void ShouldThrowExceptionWhenDoubleArrayIsNull()
 {
     using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
     {
         using (IPixelCollection pixels = image.GetPixels())
         {
             ExceptionAssert.Throws <ArgumentNullException>("values", () =>
             {
                 pixels.SetPixels((double[])null);
             });
         }
     }
 }
Пример #7
0
            public void ShouldChangePixelsWhenByteArrayHasMaxNumberOfValues()
            {
                using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
                {
                    using (IPixelCollection pixels = image.GetPixels())
                    {
                        var values = new byte[image.Width * image.Height * image.ChannelCount];
                        pixels.SetPixels(values);

                        ColorAssert.AreEqual(MagickColors.Black, image, image.Width - 1, image.Height - 1);
                    }
                }
            }
Пример #8
0
 public void ShouldThrowExceptionWhenByteArrayHasInvalidSize()
 {
     using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
     {
         using (IPixelCollection pixels = image.GetPixels())
         {
             ExceptionAssert.Throws <ArgumentException>("values", () =>
             {
                 pixels.SetPixels(new byte[] { 0, 0, 0, 0 });
             });
         }
     }
 }
Пример #9
0
        public void SetPixelsWithArray_MaxNumberOfValues_ChangesPixels()
        {
            using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
            {
                using (IPixelCollection pixels = image.GetPixels())
                {
                    var values = new QuantumType[image.Width * image.Height * image.ChannelCount];
                    pixels.SetPixels(values);

                    ColorAssert.AreEqual(MagickColors.Black, image, image.Width - 1, image.Height - 1);
                }
            }
        }
Пример #10
0
 public void SetPixelsWithArray_InvalidSize_ThrowsException()
 {
     using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
     {
         using (IPixelCollection pixels = image.GetPixels())
         {
             ExceptionAssert.ThrowsArgumentException("values", () =>
             {
                 pixels.SetPixels(new QuantumType[] { 0, 0, 0, 0 });
             });
         }
     }
 }
Пример #11
0
 public void ShouldThrowExceptionWhenByteArrayIsTooLong()
 {
     using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
     {
         using (IPixelCollection pixels = image.GetPixels())
         {
             ExceptionAssert.Throws <ArgumentException>("values", () =>
             {
                 var values = new byte[(image.Width * image.Height * image.ChannelCount) + 1];
                 pixels.SetPixels(values);
             });
         }
     }
 }
Пример #12
0
 public void SetPixelsWithArray_TooManyValues_ThrowsException()
 {
     using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
     {
         using (IPixelCollection pixels = image.GetPixels())
         {
             ExceptionAssert.ThrowsArgumentException("values", () =>
             {
                 var values = new QuantumType[(image.Width * image.Height * image.ChannelCount) + 1];
                 pixels.SetPixels(values);
             });
         }
     }
 }