示例#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);
             });
         }
     }
 }