Beispiel #1
0
 public void ShouldThrowExceptionWhenArrayIsNull()
 {
     ExceptionAssert.ThrowsArgumentNullException("data", () =>
     {
         using (IMagickImageCollection images = new MagickImageCollection())
         {
             images.Ping((byte[])null);
         }
     });
 }
Beispiel #2
0
 public void ShouldThrowExceptionWhenFileNameIsNull()
 {
     ExceptionAssert.ThrowsArgumentNullException("fileName", () =>
     {
         using (IMagickImageCollection images = new MagickImageCollection())
         {
             images.Ping((string)null);
         }
     });
 }
Beispiel #3
0
 public void ShouldThrowExceptionWhenStreamIsNull()
 {
     using (IMagickImage image = new MagickImage())
     {
         ExceptionAssert.ThrowsArgumentNullException("stream", () =>
         {
             image.Read((Stream)null);
         });
     }
 }
Beispiel #4
0
 public void ShouldThrowExceptionWhenEnumerableImagesIsNull()
 {
     ExceptionAssert.ThrowsArgumentNullException("images", () =>
     {
         using (IMagickImageCollection images = new MagickImageCollection())
         {
             images.AddRange((IEnumerable <IMagickImage>)null);
         }
     });
 }
Beispiel #5
0
 public void ShouldThrowExceptionWhenByteArrayIsNull()
 {
     using (IMagickImage image = new MagickImage())
     {
         ExceptionAssert.ThrowsArgumentNullException("data", () =>
         {
             image.Read((byte[])null);
         });
     }
 }
Beispiel #6
0
 public void ShouldThrowExceptionWhenFileNameIsNull()
 {
     using (IMagickImage image = new MagickImage())
     {
         ExceptionAssert.ThrowsArgumentNullException("fileName", () =>
         {
             image.Read((string)null);
         });
     }
 }
Beispiel #7
0
 public void ShouldThrowAnExceptionWhenDifferenceIsNull()
 {
     using (IMagickImage image = new MagickImage())
     {
         ExceptionAssert.ThrowsArgumentNullException("difference", () =>
         {
             image.Compare(image, new CompareSettings(), null);
         });
     }
 }
Beispiel #8
0
            public void ShouldThrowExceptionWhenNameIsNull()
            {
                var document        = new XmlDocument();
                var scriptVariables = new ScriptVariables(document);

                ExceptionAssert.ThrowsArgumentNullException("name", () =>
                {
                    scriptVariables[null] = "42";
                });
            }
Beispiel #9
0
 public void ShouldThrowExceptionWhenPixelStorageSettingsIsNullAndFileInfoIsSpecified()
 {
     ExceptionAssert.ThrowsArgumentNullException("pixelStorageSettings", () =>
     {
         using (IMagickImage image = new MagickImage())
         {
             image.ReadPixels(new FileInfo(Files.CirclePNG), null);
         }
     });
 }
Beispiel #10
0
 public void ShouldThrowAnExceptionWhenImageIsNull()
 {
     using (IMagickImage image = new MagickImage())
     {
         ExceptionAssert.ThrowsArgumentNullException("image", () =>
         {
             image.Compare(null);
         });
     }
 }
Beispiel #11
0
 public void ShouldThrowExceptionWhenPixelStorageSettingsIsNullAndByteArrayIsSpecified()
 {
     ExceptionAssert.ThrowsArgumentNullException("pixelStorageSettings", () =>
     {
         using (IMagickImage image = new MagickImage())
         {
             image.ReadPixels(new byte[] { 215 }, null);
         }
     });
 }
            public void ShouldThrowExceptionWhenStreamIsNullAndPixelReadSettingsIsSpecified()
            {
                ExceptionAssert.ThrowsArgumentNullException("stream", () =>
                {
                    var settings = new PixelReadSettings();

                    MagickFactory factory = new MagickFactory();
                    factory.CreateImage((Stream)null, settings);
                });
            }
            public void ShouldThrowExceptionWhenFileInfoIsNullAndPixelStorageSettingsIsSpecified()
            {
                ExceptionAssert.ThrowsArgumentNullException("file", () =>
                {
                    var pixelStorageSettings = new PixelStorageSettings();

                    MagickFactory factory = new MagickFactory();
                    factory.CreateImage((FileInfo)null, pixelStorageSettings);
                });
            }
            public void ShouldThrowExceptionWhenByteArrayIsNullAndPixelStorageSettingsIsSpecified()
            {
                ExceptionAssert.ThrowsArgumentNullException("data", () =>
                {
                    var pixelStorageSettings = new PixelStorageSettings();

                    MagickFactory factory = new MagickFactory();
                    factory.CreateImage((byte[])null, pixelStorageSettings);
                });
            }
Beispiel #15
0
 public void ShouldThrowExceptionWhenStreamIsNull()
 {
     ExceptionAssert.ThrowsArgumentNullException("stream", () =>
     {
         using (IMagickImageCollection images = new MagickImageCollection())
         {
             images.Ping((Stream)null);
         }
     });
 }
Beispiel #16
0
 public void ShouldThrowExceptionWhenTermsIsNull()
 {
     using (IMagickImageCollection images = new MagickImageCollection(Files.Builtin.Logo))
     {
         ExceptionAssert.ThrowsArgumentNullException("terms", () =>
         {
             images.Polynomial(null);
         });
     }
 }
Beispiel #17
0
        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);
        }
Beispiel #18
0
            public void ShouldThrowExceptionWhenSettingsIsNull()
            {
                using (IMagickImageCollection images = new MagickImageCollection())
                {
                    images.Read(Files.RoseSparkleGIF);

                    ExceptionAssert.ThrowsArgumentNullException("settings", () =>
                    {
                        images.Map(images[0], null);
                    });
                }
            }
        public void Quantize_SettingsAreNull_ThrowsException()
        {
            using (IMagickImageCollection collection = new MagickImageCollection())
            {
                collection.Add(Files.FujiFilmFinePixS1ProJPG);

                ExceptionAssert.ThrowsArgumentNullException("settings", () =>
                {
                    collection.Quantize(null);
                });
            }
        }
Beispiel #20
0
                public void ShouldThrowExceptionWhenArrayIsNull()
                {
                    ExceptionAssert.ThrowsArgumentNullException("data", () =>
                    {
                        var settings = new MagickReadSettings();

                        using (IMagickImageCollection images = new MagickImageCollection())
                        {
                            images.Read(null, 0, 0, settings);
                        }
                    });
                }
Beispiel #21
0
            public void ShouldThrowExceptionWhenSettingsIsNull()
            {
                using (IMagickImageCollection images = new MagickImageCollection())
                {
                    images.Add(Files.FujiFilmFinePixS1ProJPG);

                    ExceptionAssert.ThrowsArgumentNullException("settings", () =>
                    {
                        images.Quantize(null);
                    });
                }
            }
Beispiel #22
0
            public void ShouldThrowExceptionWhenVariableNotSet()
            {
                MagickScript script = new MagickScript(Files.Scripts.Variables);

                using (IMagickImage image = new MagickImage(Files.MagickNETIconPNG))
                {
                    ExceptionAssert.ThrowsArgumentNullException("attribute", () =>
                    {
                        script.Execute(image);
                    });
                }
            }
Beispiel #23
0
                public void ShouldThrowExceptionWhenFileNameIsNull()
                {
                    ExceptionAssert.ThrowsArgumentNullException("fileName", () =>
                    {
                        var settings = new MagickReadSettings();

                        using (IMagickImage image = new MagickImage())
                        {
                            image.Read((string)null, settings);
                        }
                    });
                }
Beispiel #24
0
                public void ShouldThrowExceptionWhenStreamIsNull()
                {
                    ExceptionAssert.ThrowsArgumentNullException("stream", () =>
                    {
                        var settings = new MagickReadSettings();

                        using (IMagickImage image = new MagickImage())
                        {
                            image.Read((Stream)null, settings);
                        }
                    });
                }
Beispiel #25
0
                public void ShouldThrowExceptionWhenArrayIsNull()
                {
                    ExceptionAssert.ThrowsArgumentNullException("data", () =>
                    {
                        var settings = new MagickReadSettings();

                        using (IMagickImage image = new MagickImage())
                        {
                            image.Read((byte[])null, settings);
                        }
                    });
                }
                public void ShouldThrowExceptionWhenFileInfoIsNull()
                {
                    ExceptionAssert.ThrowsArgumentNullException("file", () =>
                    {
                        var settings = new PixelReadSettings();

                        using (IMagickImage image = new MagickImage())
                        {
                            image.ReadPixels((FileInfo)null, settings);
                        }
                    });
                }
Beispiel #27
0
            public void ShouldThrowExceptionWhenStreamIsNullAndPixelStorageSettingsIsSpecified()
            {
                ExceptionAssert.ThrowsArgumentNullException("stream", () =>
                {
                    var pixelStorageSettings = new PixelStorageSettings();

                    using (IMagickImage image = new MagickImage())
                    {
                        image.ReadPixels((Stream)null, pixelStorageSettings);
                    }
                });
            }
Beispiel #28
0
            public void ShouldThrowExceptionWhenImageIsNull()
            {
                using (IMagickImageCollection collection = new MagickImageCollection())
                {
                    collection.Read(Files.RoseSparkleGIF);

                    ExceptionAssert.ThrowsArgumentNullException("image", () =>
                    {
                        collection.Map(null);
                    });
                }
            }
Beispiel #29
0
            public void ShouldThrowExceptionWhenByteArrayIsNullAndPixelReadSettingsIsSpecified()
            {
                ExceptionAssert.ThrowsArgumentNullException("data", () =>
                {
                    var settings = new PixelReadSettings();

                    using (IMagickImage image = new MagickImage())
                    {
                        image.ReadPixels((byte[])null, settings);
                    }
                });
            }
 public void ShouldThrowExceptionWhenGeometryIsSpecifiedAndMappingIsNull()
 {
     using (IMagickImage image = new MagickImage(Files.ImageMagickJPG))
     {
         using (IPixelCollection pixels = image.GetPixels())
         {
             ExceptionAssert.ThrowsArgumentNullException("mapping", () =>
             {
                 pixels.ToShortArray(new MagickGeometry(1, 2, 3, 4), null);
             });
         }
     }
 }