public void ShouldThrowExceptionWhenStreamIsNotReadable() { ExceptionAssert.ThrowsArgumentException("stream", () => { using (TestStream testStream = new TestStream(false, true, true)) { new MagickImage(testStream); } }); }
public void ShouldThrowExceptionWhenByteArrayIsEmpty() { using (IMagickImage image = new MagickImage()) { ExceptionAssert.ThrowsArgumentException("data", () => { image.Read(new byte[0]); }); } }
public void ShouldThrowExceptionWhenWidthIsNegative() { ExceptionAssert.ThrowsArgumentException("width", () => { using (IMagickImage image = new MagickImage()) { image.Read(MagickColors.Red, -1, 1); } }); }
public void ShouldThrowExceptionWhenHeightIsNegative() { ExceptionAssert.ThrowsArgumentException("height", () => { using (IMagickImage image = new MagickImage()) { image.Read(MagickColors.Red, 1, -1); } }); }
public void ShouldThrowExceptionWhenCountIsNegative() { ExceptionAssert.ThrowsArgumentException("count", () => { using (IMagickImage image = new MagickImage()) { image.Read(new byte[] { 215 }, 0, -1); } }); }
public void ShouldThrowExceptionWhenHeightIsNull() { ExceptionAssert.ThrowsArgumentException("pixelStorageSettings", () => { var settings = new PixelStorageSettings(1, 1, StorageType.Char, "RGBA"); settings.ReadSettings.Height = null; new MagickImage(Files.CirclePNG, settings); }, "Height"); }
public void ShouldThrowExceptionWhenArrayIsEmpty() { ExceptionAssert.ThrowsArgumentException("data", () => { using (IMagickImage image = new MagickImage()) { image.Ping(new byte[] { }); } }); }
public void ShouldThrowExceptionWhenStreamIsNotReadable() { using (TestStream stream = new TestStream(false, true, true)) { ExceptionAssert.ThrowsArgumentException("stream", () => { StreamWrapper.CreateForReading(stream); }, "readable"); } }
public void ShouldThrowExceptionWhenMappingIsEmpty() { ExceptionAssert.ThrowsArgumentException("pixelStorageSettings", () => { var settings = new PixelStorageSettings(1, 1, StorageType.Char, string.Empty); MagickFactory factory = new MagickFactory(); factory.CreateImage(Files.CirclePNG, settings); }, "mapping"); }
public void LosslessCompress_StreamCannotSeek_ThrowsException() { using (TestStream stream = new TestStream(true, true, false)) { ExceptionAssert.ThrowsArgumentException("stream", () => { Optimizer.LosslessCompress(stream); }); } }
public void ShouldThrowExceptionWhenFileNameIsEmpty() { ExceptionAssert.ThrowsArgumentException("fileName", () => { using (IMagickImage image = new MagickImage()) { image.Ping(string.Empty); } }); }
public void ShouldThrowExceptionWhenByteArrayIsEmptyAndPixelStorageSettingsIsSpecified() { ExceptionAssert.ThrowsArgumentException("data", () => { var pixelStorageSettings = new PixelStorageSettings(); MagickFactory factory = new MagickFactory(); factory.CreateImage(new byte[] { }, pixelStorageSettings); }); }
public void Compress_StreamCannotRead_ThrowsException() { using (TestStream stream = new TestStream(false, true, true)) { ExceptionAssert.ThrowsArgumentException("stream", () => { Optimizer.Compress(stream); }); } }
public void ShouldThrowExceptionWhenTermsIsEmpty() { using (IMagickImageCollection images = new MagickImageCollection(Files.Builtin.Logo)) { ExceptionAssert.ThrowsArgumentException("terms", () => { images.Polynomial(new double[] { }); }); } }
public void ShouldThrowExceptionWhenImagesIsMagickImageCollection() { using (var images = new MagickImageCollection(Files.SnakewarePNG)) { ExceptionAssert.ThrowsArgumentException("images", () => { new MagickImageCollection(images); }); } }
public void ShouldThrowExceptionWhenStreamIsEmptyAndPixelStorageSettingsIsSpecified() { ExceptionAssert.ThrowsArgumentException("stream", () => { var pixelStorageSettings = new PixelStorageSettings(); MagickFactory factory = new MagickFactory(); factory.CreateImage(new MemoryStream(), pixelStorageSettings); }); }
public void ShouldThrowExceptionWhenPercentageHeightIsNegative() { using (IMagickImage image = new MagickImage(Files.MagickNETIconPNG)) { ExceptionAssert.ThrowsArgumentException("percentageHeight", () => { image.LiquidRescale(new Percentage(1), new Percentage(-1), 0.0, 0.0); }); } }
public void ShouldThrowExceptionWhenByteArrayIsEmpty() { ExceptionAssert.ThrowsArgumentException("data", () => { using (IMagickImageCollection images = new MagickImageCollection()) { images.AddRange(new byte[0]); } }); }
public void ShouldThrowExceptionWhenArgumentsIsEmpty() { using (IMagickImage image = new MagickImage()) { ExceptionAssert.ThrowsArgumentException("arguments", () => { image.Evaluate(Channels.Red, EvaluateFunction.Arcsin, new double[] { }); }); } }
public void ShouldThrowAnExceptionWhenArgumentsIsEmptyAndSettingsIsNot() { using (IMagickImage image = new MagickImage()) { ExceptionAssert.ThrowsArgumentException("arguments", () => { image.Distort(DistortMethod.Perspective, new DistortSettings(), new double[] { }); }); } }
public void ShouldThrowExceptionWhenOffsetIsNegative() { ExceptionAssert.ThrowsArgumentException("offset", () => { using (IMagickImageCollection images = new MagickImageCollection()) { images.Read(new byte[] { 215 }, -1, 0); } }); }
public void ShouldThrowExceptionWhenNameToSetIsInvalid() { var document = new XmlDocument(); var scriptVariables = new ScriptVariables(document); ExceptionAssert.ThrowsArgumentException("name", () => { scriptVariables.Set("invalid", "42"); }, "Invalid variable name: invalid"); }
public void ShouldThrowExceptionWhenArrayIsEmpty() { ExceptionAssert.ThrowsArgumentException("data", () => { using (IMagickImageCollection images = new MagickImageCollection()) { images.Read(new byte[] { }, 0, 0); } }); }
public void ShouldThrowExceptionWhenFileNameIsEmpty() { ExceptionAssert.ThrowsArgumentException("fileName", () => { using (IMagickImageCollection images = new MagickImageCollection()) { images.Read(string.Empty); } }); }
public void ShouldThrowExceptionWhenCountIsZero() { ExceptionAssert.ThrowsArgumentException("count", () => { using (IMagickImageCollection images = new MagickImageCollection()) { images.Read(new byte[] { 215 }, 0, 0); } }); }
public void Constructor_StreamCannotRead_ThrowsException() { using (TestStream stream = new TestStream(false, true, true)) { ExceptionAssert.ThrowsArgumentException("stream", () => { new Bytes(stream); }); } }
public void ShouldThrowExceptionWhenCountIsNegative() { ExceptionAssert.ThrowsArgumentException("count", () => { var settings = new MagickReadSettings(); using (IMagickImageCollection images = new MagickImageCollection(new byte[] { 215 }, 0, -1, settings)) { } }); }
public void Test_Image_Exceptions() { ExceptionAssert.ThrowsArgumentException("readSettings", () => { MagickReadSettings settings = new MagickReadSettings { FrameCount = 2, }; new MagickImage(Files.RoseSparkleGIF, settings); }); }
public void Test_Read() { IMagickImageInfo imageInfo = new MagickImageInfo(); ExceptionAssert.ThrowsArgumentException("data", () => { imageInfo.Read(new byte[0]); }); ExceptionAssert.ThrowsArgumentNullException("data", () => { imageInfo.Read((byte[])null); }); ExceptionAssert.ThrowsArgumentNullException("file", () => { imageInfo.Read((FileInfo)null); }); ExceptionAssert.ThrowsArgumentNullException("stream", () => { imageInfo.Read((Stream)null); }); ExceptionAssert.ThrowsArgumentNullException("fileName", () => { imageInfo.Read((string)null); }); ExceptionAssert.Throws <MagickBlobErrorException>(() => { imageInfo.Read(Files.Missing); }, "error/blob.c/OpenBlob"); imageInfo.Read(File.ReadAllBytes(Files.SnakewarePNG)); using (FileStream fs = File.OpenRead(Files.SnakewarePNG)) { imageInfo.Read(fs); } imageInfo.Read(Files.ImageMagickJPG); Assert.AreEqual(ColorSpace.sRGB, imageInfo.ColorSpace); Assert.AreEqual(CompressionMethod.JPEG, imageInfo.Compression); Assert.AreEqual(MagickFormat.Jpeg, imageInfo.Format); Assert.AreEqual(118, imageInfo.Height); Assert.AreEqual(72, imageInfo.Density.X); Assert.AreEqual(72, imageInfo.Density.Y); Assert.AreEqual(DensityUnit.PixelsPerInch, imageInfo.Density.Units); Assert.AreEqual(Interlace.NoInterlace, imageInfo.Interlace); Assert.AreEqual(100, imageInfo.Quality); Assert.AreEqual(123, imageInfo.Width); }
public void ShouldThrowExceptionWhenWidthIsNull() { ExceptionAssert.ThrowsArgumentException("pixelStorageSettings", () => { var settings = new PixelStorageSettings(1, 1, StorageType.Char, "RGBA"); settings.ReadSettings.Width = null; MagickFactory factory = new MagickFactory(); factory.CreateImage(Files.CirclePNG, settings); }, "Width"); }