Browse Source

Added unit test.

pull/582/head
Dirk Lemstra 8 years ago
parent
commit
bbf6b22b83
  1. 16
      tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs
  2. 1
      tests/ImageSharp.Tests/TestImages.cs
  3. BIN
      tests/Images/Input/Jpg/issues/Issue520-InvalidCast.jpg

16
tests/ImageSharp.Tests/MetaData/Profiles/Exif/ExifProfileTests.cs

@ -292,6 +292,22 @@ namespace SixLabors.ImageSharp.Tests
}
}
[Fact]
public void TestArrayValueWithUnspecifiedSize()
{
// This images contains array in the exif profile that has zero components.
Image<Rgba32> image = TestFile.Create(TestImages.Jpeg.Issues.InvalidCast520).CreateImage();
ExifProfile profile = image.MetaData.ExifProfile;
Assert.NotNull(profile);
// Force parsing of the profile.
Assert.Equal(24, profile.Values.Count);
byte[] bytes = profile.ToByteArray();
Assert.Equal(495, bytes.Length);
}
private static ExifProfile GetExifProfile()
{
Image<Rgba32> image = TestFile.Create(TestImages.Jpeg.Baseline.Floorplan).CreateImage();

1
tests/ImageSharp.Tests/TestImages.cs

@ -136,6 +136,7 @@ namespace SixLabors.ImageSharp.Tests
public const string MultiHuffmanBaseline394 = "Jpg/issues/Issue394-MultiHuffmanBaseline-Speakers.jpg";
public const string NoEoiProgressive517 = "Jpg/issues/Issue517-No-EOI-Progressive.jpg";
public const string BadRstProgressive518 = "Jpg/issues/Issue518-Bad-RST-Progressive.jpg";
public const string InvalidCast520 = "Jpg/issues/Issue520-InvalidCast.jpg";
}
public static readonly string[] All = Baseline.All.Concat(Progressive.All).ToArray();

BIN
tests/Images/Input/Jpg/issues/Issue520-InvalidCast.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Loading…
Cancel
Save