Browse Source

Add tests for decode RGB and gray exr files

pull/3096/head
Brian Popow 2 months ago
parent
commit
e4c22d8f67
  1. 24
      tests/ImageSharp.Tests/Formats/Exr/ExrDecoderTests.cs
  2. 2
      tests/ImageSharp.Tests/TestImages.cs
  3. 3
      tests/Images/Input/Exr/Calliphora_gray.exr
  4. 3
      tests/Images/Input/Exr/Calliphora_rgb.exr

24
tests/ImageSharp.Tests/Formats/Exr/ExrDecoderTests.cs

@ -14,7 +14,7 @@ public class ExrDecoderTests
private static MagickReferenceDecoder ReferenceDecoder => MagickReferenceDecoder.Exr;
[Theory]
[InlineData(TestImages.Exr.Uncompressed, 803, 1197)]
[InlineData(TestImages.Exr.Uncompressed, 199, 297)]
public void ExrDecoder_Identify_DetectsCorrectWidthAndHeight<TPixel>(string imagePath, int expectedWidth, int expectedHeight)
{
TestFile testFile = TestFile.Create(imagePath);
@ -27,7 +27,27 @@ public class ExrDecoderTests
[Theory]
[WithFile(TestImages.Exr.Uncompressed, PixelTypes.Rgba32)]
public void ExrDecoder_CanDecode_Uncompressed<TPixel>(TestImageProvider<TPixel> provider)
public void ExrDecoder_CanDecode_Uncompressed_RGBA<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using Image<TPixel> image = provider.GetImage(ExrDecoder.Instance);
image.DebugSave(provider);
image.CompareToOriginal(provider, ReferenceDecoder);
}
[Theory]
[WithFile(TestImages.Exr.Rgb, PixelTypes.Rgba32)]
public void ExrDecoder_CanDecode_Rgb<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using Image<TPixel> image = provider.GetImage(ExrDecoder.Instance);
image.DebugSave(provider);
image.CompareToOriginal(provider, ReferenceDecoder);
}
[Theory]
[WithFile(TestImages.Exr.Gray, PixelTypes.Rgba32)]
public void ExrDecoder_CanDecode_Gray<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using Image<TPixel> image = provider.GetImage(ExrDecoder.Instance);

2
tests/ImageSharp.Tests/TestImages.cs

@ -1388,5 +1388,7 @@ public static class TestImages
public const string Zips = "Exr/Calliphora_zips.exr";
public const string Rle = "Exr/Calliphora_rle.exr";
public const string B44 = "Exr/Calliphora_b44.exr";
public const string Rgb = "Exr/Calliphora_rgb.exr";
public const string Gray = "Exr/Calliphora_gray.exr";
}
}

3
tests/Images/Input/Exr/Calliphora_gray.exr

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0a5daadcfd4ff0e45282d39d6c54f9a13651da3fd8841abda580e76661555470
size 124245

3
tests/Images/Input/Exr/Calliphora_rgb.exr

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