public void ShouldNotThrowExceptionWhenDoubleArrayHasInvalidSize() { using (IMagickImage image = new MagickImage(Files.ImageMagickJPG)) { using (IPixelCollection pixels = image.GetPixelsUnsafe()) { pixels.SetPixels(new double[] { 0, 0, 0, 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 }); } } }
public void ShouldNotThrowExceptionWhenDoubleArrayIsNull() { using (IMagickImage image = new MagickImage(Files.ImageMagickJPG)) { using (IPixelCollection pixels = image.GetPixelsUnsafe()) { pixels.SetPixels((double[])null); } } }
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); } } }
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); } } }
public void ShouldThrowExceptionWhenDoubleArrayIsNull() { using (IMagickImage image = new MagickImage(Files.ImageMagickJPG)) { using (IPixelCollection pixels = image.GetPixels()) { ExceptionAssert.Throws <ArgumentNullException>("values", () => { pixels.SetPixels((double[])null); }); } } }
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); } } }
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 }); }); } } }
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); } } }
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 }); }); } } }
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); }); } } }
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); }); } } }