Browse Source

Added extra overload for TestFile.CreateImage and used it in the tests.

af/merge-core
Dirk Lemstra 9 years ago
committed by Dirk Lemstra
parent
commit
c56ab2fdab
  1. 6
      tests/ImageSharp.Tests/Formats/Gif/GifDecoderCoreTests.cs
  2. 4
      tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderCoreTests.cs
  3. 6
      tests/ImageSharp.Tests/Formats/Png/PngDecoderCoreTests.cs
  4. 12
      tests/ImageSharp.Tests/TestFile.cs

6
tests/ImageSharp.Tests/Formats/Gif/GifDecoderCoreTests.cs

@ -22,7 +22,7 @@ namespace ImageSharp.Tests
TestFile testFile = TestFile.Create(TestImages.Gif.Rings);
using (Image image = new Image(testFile.FilePath, options))
using (Image image = testFile.CreateImage(options))
{
Assert.Equal(1, image.MetaData.Properties.Count);
Assert.Equal("Comments", image.MetaData.Properties[0].Name);
@ -40,7 +40,7 @@ namespace ImageSharp.Tests
TestFile testFile = TestFile.Create(TestImages.Gif.Rings);
using (Image image = new Image(testFile.FilePath, options))
using (Image image = testFile.CreateImage(options))
{
Assert.Equal(0, image.MetaData.Properties.Count);
}
@ -56,7 +56,7 @@ namespace ImageSharp.Tests
TestFile testFile = TestFile.Create(TestImages.Gif.Rings);
using (Image image = new Image(testFile.FilePath, options))
using (Image image = testFile.CreateImage(options))
{
Assert.Equal(1, image.MetaData.Properties.Count);
Assert.Equal("浉条卥慨灲", image.MetaData.Properties[0].Value);

4
tests/ImageSharp.Tests/Formats/Jpg/JpegDecoderCoreTests.cs

@ -19,7 +19,7 @@ namespace ImageSharp.Tests
TestFile testFile = TestFile.Create(TestImages.Jpeg.Baseline.Floorplan);
using (Image image = new Image(testFile.FilePath, options))
using (Image image = testFile.CreateImage(options))
{
Assert.NotNull(image.MetaData.ExifProfile);
}
@ -35,7 +35,7 @@ namespace ImageSharp.Tests
TestFile testFile = TestFile.Create(TestImages.Jpeg.Baseline.Floorplan);
using (Image image = new Image(testFile.FilePath, options))
using (Image image = testFile.CreateImage(options))
{
Assert.Null(image.MetaData.ExifProfile);
}

6
tests/ImageSharp.Tests/Formats/Png/PngDecoderCoreTests.cs

@ -22,7 +22,7 @@ namespace ImageSharp.Tests
TestFile testFile = TestFile.Create(TestImages.Png.Blur);
using (Image image = new Image(testFile.FilePath, options))
using (Image image = testFile.CreateImage(options))
{
Assert.Equal(1, image.MetaData.Properties.Count);
Assert.Equal("Software", image.MetaData.Properties[0].Name);
@ -40,7 +40,7 @@ namespace ImageSharp.Tests
TestFile testFile = TestFile.Create(TestImages.Png.Blur);
using (Image image = new Image(testFile.FilePath, options))
using (Image image = testFile.CreateImage(options))
{
Assert.Equal(0, image.MetaData.Properties.Count);
}
@ -56,7 +56,7 @@ namespace ImageSharp.Tests
TestFile testFile = TestFile.Create(TestImages.Png.Blur);
using (Image image = new Image(testFile.FilePath, options))
using (Image image = testFile.CreateImage(options))
{
Assert.Equal(1, image.MetaData.Properties.Count);
Assert.Equal("潓瑦慷敲", image.MetaData.Properties[0].Name);

12
tests/ImageSharp.Tests/TestFile.cs

@ -130,6 +130,18 @@ namespace ImageSharp.Tests
return new Image(this.image);
}
/// <summary>
/// Creates a new image.
/// </summary>
/// <param name="options">The options for the decoder.</param>
/// <returns>
/// The <see cref="Image"/>.
/// </returns>
public Image CreateImage(IDecoderOptions options)
{
return new Image(this.Bytes, options);
}
/// <summary>
/// Gets the correct path to the formats directory.
/// </summary>

Loading…
Cancel
Save