Browse Source

add test for notSupported 64 bit cmyk, add more tests for Identify (incl 64 bit cmyk)

pull/2363/head
Ildar Khayrutdinov 3 years ago
parent
commit
cfaf555c1f
  1. 1
      tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
  2. 7
      tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs
  3. 2
      tests/ImageSharp.Tests/TestImages.cs
  4. 3
      tests/Images/Input/Tiff/cmyk_deflate_64bit.tiff

1
tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs

@ -25,6 +25,7 @@ public class TiffDecoderTests : TiffDecoderBaseTester
[Theory]
[WithFile(MultiframeDifferentSize, PixelTypes.Rgba32)]
[WithFile(MultiframeDifferentVariants, PixelTypes.Rgba32)]
[WithFile(Cmyk64BitDeflate, PixelTypes.Rgba32)]
public void ThrowsNotSupported<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => Assert.Throws<NotSupportedException>(() => provider.GetImage(TiffDecoder.Instance));

7
tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs

@ -110,8 +110,10 @@ public class TiffMetadataTests
}
[Theory]
[InlineData(Cmyk, 1, TiffPhotometricInterpretation.Separated, TiffInkSet.Cmyk)]
public void Identify_Frames(string imagePath, int framesCount, TiffPhotometricInterpretation photometric, TiffInkSet? inkSet)
[InlineData(Cmyk, 1, TiffBitsPerPixel.Bit32, TiffPhotometricInterpretation.Separated, TiffInkSet.Cmyk)]
[InlineData(Cmyk64BitDeflate, 1, 64, TiffPhotometricInterpretation.Separated, TiffInkSet.Cmyk)]
[InlineData(YCbCrJpegCompressed, 1, TiffBitsPerPixel.Bit24, TiffPhotometricInterpretation.YCbCr, null)]
public void Identify_Frames(string imagePath, int framesCount, TiffBitsPerPixel bitsPerPixel, TiffPhotometricInterpretation photometric, TiffInkSet? inkSet)
{
TestFile testFile = TestFile.Create(imagePath);
using MemoryStream stream = new(testFile.Bytes, false);
@ -127,6 +129,7 @@ public class TiffMetadataTests
foreach (ImageFrameMetadata metadata in imageInfo.FrameMetadataCollection)
{
TiffFrameMetadata tiffFrameMetadata = metadata.GetTiffMetadata();
Assert.Equal(bitsPerPixel, tiffFrameMetadata.BitsPerPixel);
Assert.Equal(photometric, tiffFrameMetadata.PhotometricInterpretation);
Assert.Equal(inkSet, tiffFrameMetadata.InkSet);
}

2
tests/ImageSharp.Tests/TestImages.cs

@ -762,6 +762,7 @@ public static class TestImages
public const string Benchmark_RgbLzw = "medium_rgb_lzw.tiff";
public const string Benchmark_RgbPackbits = "medium_rgb_packbits.tiff";
public const string Benchmark_RgbUncompressed = "medium_rgb_uncompressed.tiff";
public const string Benchmark_CmykUncompressed = "medium_cmyk_uncompressed.tiff";
public const string Calliphora_GrayscaleUncompressed = "Tiff/Calliphora_grayscale_uncompressed.tiff";
public const string Calliphora_GrayscaleDeflate_Predictor = "Tiff/Calliphora_gray_deflate_predictor.tiff";
@ -957,6 +958,7 @@ public static class TestImages
public const string CieLabLzwPredictor = "Tiff/CieLab_lzwcompressed_predictor.tiff";
public const string Cmyk = "Tiff/Cmyk.tiff";
public const string Cmyk64BitDeflate = "Tiff/cmyk_deflate_64bit.tiff";
public const string Issues1716Rgb161616BitLittleEndian = "Tiff/Issues/Issue1716.tiff";
public const string Issues1891 = "Tiff/Issues/Issue1891.tiff";

3
tests/Images/Input/Tiff/cmyk_deflate_64bit.tiff

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