Browse Source

Add tests to check if PngDecoder apply ICC profile

pull/3028/head
Socolin 5 months ago
parent
commit
bd532d6696
  1. 14
      tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs
  2. 7
      tests/ImageSharp.Tests/TestImages.cs
  3. 3
      tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual-cLUT-only.png
  4. 3
      tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual.png
  5. 3
      tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_sRGB_Gray.png
  6. 3
      tests/Images/Input/Png/icc-profiles/Perceptual-cLUT-only.png
  7. 3
      tests/Images/Input/Png/icc-profiles/Perceptual.png
  8. 3
      tests/Images/Input/Png/icc-profiles/sRGB_Gray.png

14
tests/ImageSharp.Tests/Formats/Png/PngDecoderTests.cs

@ -206,6 +206,20 @@ public partial class PngDecoderTests
image.CompareToOriginal(provider, ImageComparer.Exact);
}
[Theory]
[WithFile(TestImages.Png.Icc.Perceptual, PixelTypes.Rgba32)]
[WithFile(TestImages.Png.Icc.PerceptualcLUTOnly, PixelTypes.Rgba32)]
[WithFile(TestImages.Png.Icc.SRgbGray, PixelTypes.Rgba32)]
public void Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
using Image<TPixel> image = provider.GetImage(PngDecoder.Instance, new DecoderOptions { ColorProfileHandling = ColorProfileHandling.Convert });
image.DebugSave(provider);
image.CompareToReferenceOutput(provider);
Assert.Null(image.Metadata.IccProfile);
}
[Theory]
[WithFile(TestImages.Png.SubFilter3BytesPerPixel, PixelTypes.Rgba32)]
[WithFile(TestImages.Png.SubFilter4BytesPerPixel, PixelTypes.Rgba32)]

7
tests/ImageSharp.Tests/TestImages.cs

@ -166,6 +166,13 @@ public static class TestImages
// Issue 3000: https://github.com/SixLabors/ImageSharp/issues/3000
public const string Issue3000 = "Png/issues/issue_3000.png";
public static class Icc
{
public const string SRgbGray = "Png/icc-profiles/sRGB_Gray.png";
public const string Perceptual = "Png/icc-profiles/Perceptual.png";
public const string PerceptualcLUTOnly = "Png/icc-profiles/Perceptual-cLUT-only.png";
}
public static class Bad
{
public const string MissingDataChunk = "Png/xdtn0g01.png";

3
tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual-cLUT-only.png

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

3
tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_Perceptual.png

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

3
tests/Images/External/ReferenceOutput/PngDecoderTests/Decode_WhenColorProfileHandlingIsConvert_ApplyIccProfile_Rgba32_sRGB_Gray.png

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

3
tests/Images/Input/Png/icc-profiles/Perceptual-cLUT-only.png

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

3
tests/Images/Input/Png/icc-profiles/Perceptual.png

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

3
tests/Images/Input/Png/icc-profiles/sRGB_Gray.png

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