Esempio n. 1
0
 public void ShouldNotThrowExceptionWhenSettingsIsNull()
 {
     using (var image = new MagickImage())
     {
         image.Read(FileHelper.ReadAllBytes(Files.CirclePNG), null);
     }
 }
Esempio n. 2
0
                public void ShouldNotThrowExceptionWhenSettingsIsNull()
                {
                    var factory = new MagickImageCollectionFactory();

                    using (var images = factory.Create(FileHelper.ReadAllBytes(Files.CirclePNG), null))
                    {
                    }
                }
Esempio n. 3
0
                public void ShouldNotThrowExceptionWhenSettingsIsNull()
                {
                    var bytes = FileHelper.ReadAllBytes(Files.CirclePNG);

                    using (var image = new MagickImage(bytes, 0, bytes.Length, (MagickReadSettings)null))
                    {
                    }
                }
Esempio n. 4
0
                public void ShouldThrowExceptionWhenSettingsIsNull()
                {
                    var factory = new MagickImageFactory();

                    Assert.Throws <ArgumentNullException>("settings", () =>
                    {
                        factory.Create(FileHelper.ReadAllBytes(Files.CirclePNG), (PixelReadSettings)null);
                    });
                }
Esempio n. 5
0
                public void ShouldNotThrowExceptionWhenSettingsIsNull()
                {
                    var bytes = FileHelper.ReadAllBytes(Files.CirclePNG);

                    using (var image = new MagickImageCollection())
                    {
                        image.Read(bytes, 0, bytes.Length, null);
                    }
                }
Esempio n. 6
0
 public void ShouldReadImage()
 {
     using (var image = new MagickImage())
     {
         image.Read(FileHelper.ReadAllBytes(Files.SnakewarePNG));
         Assert.Equal(286, image.Width);
         Assert.Equal(67, image.Height);
     }
 }
Esempio n. 7
0
                public void ShouldNotThrowExceptionWhenSettingsIsNull()
                {
                    var bytes = FileHelper.ReadAllBytes(Files.SnakewarePNG);

                    using (var images = new MagickImageCollection(bytes, null))
                    {
                        Assert.Single(images);
                    }
                }
Esempio n. 8
0
                public void ShouldCreateMagickImageCollection()
                {
                    var factory = new MagickImageCollectionFactory();
                    var data    = FileHelper.ReadAllBytes(Files.ImageMagickJPG);

                    using (var images = factory.Create(data))
                    {
                        Assert.IsType <MagickImageCollection>(images);
                    }
                }
Esempio n. 9
0
                public void ShouldCreateMagickImage()
                {
                    var factory = new MagickImageInfoFactory();
                    var data    = FileHelper.ReadAllBytes(Files.ImageMagickJPG);

                    var info = factory.Create(data);

                    Assert.IsType <MagickImageInfo>(info);
                    Assert.Equal(123, info.Width);
                }
Esempio n. 10
0
                public void ShouldCreateMagickImage()
                {
                    var factory = new MagickImageFactory();
                    var data    = FileHelper.ReadAllBytes(Files.ImageMagickJPG);

                    using (var image = factory.Create(data))
                    {
                        Assert.IsType <MagickImage>(image);
                        Assert.Equal(123, image.Width);
                    }
                }
Esempio n. 11
0
                public void ShouldResetTheFormatAfterReadingBytes()
                {
                    var bytes = FileHelper.ReadAllBytes(Files.CirclePNG);

                    using (var image = new MagickImage())
                    {
                        image.Read(bytes, MagickFormat.Png);

                        Assert.Equal(MagickFormat.Unknown, image.Settings.Format);
                    }
                }
Esempio n. 12
0
                public void ShouldReadImage()
                {
                    using (var images = new MagickImageCollection())
                    {
                        var fileBytes = FileHelper.ReadAllBytes(Files.SnakewarePNG);
                        var bytes     = new byte[fileBytes.Length + 10];
                        fileBytes.CopyTo(bytes, 10);

                        images.Read(bytes, 10, bytes.Length - 10);
                        Assert.Single(images);
                    }
                }
Esempio n. 13
0
                public void ShouldReadImage()
                {
                    var factory   = new MagickImageCollectionFactory();
                    var fileBytes = FileHelper.ReadAllBytes(Files.SnakewarePNG);
                    var bytes     = new byte[fileBytes.Length + 10];

                    fileBytes.CopyTo(bytes, 10);

                    using (var images = factory.Create(bytes, 10, bytes.Length - 10))
                    {
                        Assert.Single(images);
                    }
                }
Esempio n. 14
0
                public void ShouldReadImage()
                {
                    using (var image = new MagickImage())
                    {
                        var fileBytes = FileHelper.ReadAllBytes(Files.SnakewarePNG);
                        var bytes     = new byte[fileBytes.Length + 10];
                        fileBytes.CopyTo(bytes, 10);

                        image.Read(bytes, 10, bytes.Length - 10);
                        Assert.Equal(286, image.Width);
                        Assert.Equal(67, image.Height);
                    }
                }
Esempio n. 15
0
                public void ShouldCreateMagickImageCollection()
                {
                    var factory      = new MagickImageCollectionFactory();
                    var data         = FileHelper.ReadAllBytes(Files.ImageMagickJPG);
                    var readSettings = new MagickReadSettings
                    {
                        BackgroundColor = MagickColors.Goldenrod,
                    };

                    using (var image = factory.Create(data, readSettings))
                    {
                        Assert.IsType <MagickImageCollection>(image);
                    }
                }
Esempio n. 16
0
                public void ShouldResetTheFormatAfterReading()
                {
                    var readSettings = new MagickReadSettings
                    {
                        Format = MagickFormat.Png,
                    };

                    var bytes = FileHelper.ReadAllBytes(Files.CirclePNG);

                    using (var input = new MagickImageCollection(bytes, readSettings))
                    {
                        Assert.Equal(MagickFormat.Unknown, input[0].Settings.Format);
                    }
                }
Esempio n. 17
0
                public void ShouldReadImage()
                {
                    var fileBytes = FileHelper.ReadAllBytes(Files.ImageMagickICO);
                    var bytes     = new byte[fileBytes.Length + 10];

                    fileBytes.CopyTo(bytes, 10);

                    using (var image = new MagickImage())
                    {
                        image.Read(bytes, 10, bytes.Length - 10, MagickFormat.Ico);
                        Assert.Equal(64, image.Width);
                        Assert.Equal(64, image.Height);
                    }
                }
Esempio n. 18
0
                public void ShouldCreateMagickImage()
                {
                    var factory      = new MagickImageFactory();
                    var data         = FileHelper.ReadAllBytes(Files.ImageMagickJPG);
                    var readSettings = new MagickReadSettings
                    {
                        BackgroundColor = MagickColors.Goldenrod,
                    };

                    using (var image = factory.Create(data, readSettings))
                    {
                        Assert.IsType <MagickImage>(image);
                        Assert.Equal(123, image.Width);
                        Assert.Equal(MagickColors.Goldenrod, image.Settings.BackgroundColor);
                    }
                }