Skip to content

Commit

Permalink
add test for notSupported 64 bit cmyk, add more tests for Identify (i…
Browse files Browse the repository at this point in the history
…ncl 64 bit cmyk)
  • Loading branch information
IldarKhayrutdinov committed Feb 28, 2023
1 parent 07ca405 commit cfaf555
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
7 changes: 5 additions & 2 deletions tests/ImageSharp.Tests/Formats/Tiff/TiffMetadataTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@ public void Identify_DetectsCorrectByteOrder(string imagePath, ByteOrder expecte
}

[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);
Expand All @@ -127,6 +129,7 @@ public void Identify_Frames(string imagePath, int framesCount, TiffPhotometricIn
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);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/ImageSharp.Tests/TestImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ public static class Tiff
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";
Expand Down Expand Up @@ -957,6 +958,7 @@ public static class Tiff
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";
Expand Down
3 changes: 3 additions & 0 deletions tests/Images/Input/Tiff/cmyk_deflate_64bit.tiff
Git LFS file not shown

0 comments on commit cfaf555

Please sign in to comment.