Browse Source

Add test for lossy with exif which does not contain enough data

pull/2077/head
Brian Popow 4 years ago
parent
commit
853b222af5
  1. 12
      tests/ImageSharp.Tests/Formats/WebP/WebpMetaDataTests.cs
  2. 1
      tests/ImageSharp.Tests/TestImages.cs
  3. 3
      tests/Images/Input/Webp/exif_lossy_not_enough_data.webp

12
tests/ImageSharp.Tests/Formats/WebP/WebpMetaDataTests.cs

@ -150,5 +150,17 @@ namespace SixLabors.ImageSharp.Tests.Formats.Webp
Assert.NotNull(actualExif);
Assert.Equal(expectedExif.Values.Count, actualExif.Values.Count);
}
[Theory]
[WithFile(TestImages.Webp.Lossy.WithExifNotEnoughData, PixelTypes.Rgba32)]
public void WebpDecoder_ThrowInvalidImageContentException_OnWithInvalidExifData<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> =>
Assert.Throws<InvalidImageContentException>(
() =>
{
using (provider.GetImage(WebpDecoder))
{
}
});
}
}

1
tests/ImageSharp.Tests/TestImages.cs

@ -635,6 +635,7 @@ namespace SixLabors.ImageSharp.Tests
{
public const string Earth = "Webp/earth_lossy.webp";
public const string WithExif = "Webp/exif_lossy.webp";
public const string WithExifNotEnoughData = "Webp/exif_lossy_not_enough_data.webp";
public const string WithIccp = "Webp/lossy_with_iccp.webp";
public const string WithXmp = "Webp/xmp_lossy.webp";
public const string BikeSmall = "Webp/bike_lossless_small.webp";

3
tests/Images/Input/Webp/exif_lossy_not_enough_data.webp

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fdf4e9b20af4168f4177d33f7f502906343bbaaae2af9b90e1531bd4452b317b
size 40765
Loading…
Cancel
Save