Skip to content

Commit cfaf555

Browse files
add test for notSupported 64 bit cmyk, add more tests for Identify (incl 64 bit cmyk)
1 parent 07ca405 commit cfaf555

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class TiffDecoderTests : TiffDecoderBaseTester
2525
[Theory]
2626
[WithFile(MultiframeDifferentSize, PixelTypes.Rgba32)]
2727
[WithFile(MultiframeDifferentVariants, PixelTypes.Rgba32)]
28+
[WithFile(Cmyk64BitDeflate, PixelTypes.Rgba32)]
2829
public void ThrowsNotSupported<TPixel>(TestImageProvider<TPixel> provider)
2930
where TPixel : unmanaged, IPixel<TPixel> => Assert.Throws<NotSupportedException>(() => provider.GetImage(TiffDecoder.Instance));
3031

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ public void Identify_DetectsCorrectByteOrder(string imagePath, ByteOrder expecte
110110
}
111111

112112
[Theory]
113-
[InlineData(Cmyk, 1, TiffPhotometricInterpretation.Separated, TiffInkSet.Cmyk)]
114-
public void Identify_Frames(string imagePath, int framesCount, TiffPhotometricInterpretation photometric, TiffInkSet? inkSet)
113+
[InlineData(Cmyk, 1, TiffBitsPerPixel.Bit32, TiffPhotometricInterpretation.Separated, TiffInkSet.Cmyk)]
114+
[InlineData(Cmyk64BitDeflate, 1, 64, TiffPhotometricInterpretation.Separated, TiffInkSet.Cmyk)]
115+
[InlineData(YCbCrJpegCompressed, 1, TiffBitsPerPixel.Bit24, TiffPhotometricInterpretation.YCbCr, null)]
116+
public void Identify_Frames(string imagePath, int framesCount, TiffBitsPerPixel bitsPerPixel, TiffPhotometricInterpretation photometric, TiffInkSet? inkSet)
115117
{
116118
TestFile testFile = TestFile.Create(imagePath);
117119
using MemoryStream stream = new(testFile.Bytes, false);
@@ -127,6 +129,7 @@ public void Identify_Frames(string imagePath, int framesCount, TiffPhotometricIn
127129
foreach (ImageFrameMetadata metadata in imageInfo.FrameMetadataCollection)
128130
{
129131
TiffFrameMetadata tiffFrameMetadata = metadata.GetTiffMetadata();
132+
Assert.Equal(bitsPerPixel, tiffFrameMetadata.BitsPerPixel);
130133
Assert.Equal(photometric, tiffFrameMetadata.PhotometricInterpretation);
131134
Assert.Equal(inkSet, tiffFrameMetadata.InkSet);
132135
}

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ public static class Tiff
762762
public const string Benchmark_RgbLzw = "medium_rgb_lzw.tiff";
763763
public const string Benchmark_RgbPackbits = "medium_rgb_packbits.tiff";
764764
public const string Benchmark_RgbUncompressed = "medium_rgb_uncompressed.tiff";
765+
public const string Benchmark_CmykUncompressed = "medium_cmyk_uncompressed.tiff";
765766

766767
public const string Calliphora_GrayscaleUncompressed = "Tiff/Calliphora_grayscale_uncompressed.tiff";
767768
public const string Calliphora_GrayscaleDeflate_Predictor = "Tiff/Calliphora_gray_deflate_predictor.tiff";
@@ -957,6 +958,7 @@ public static class Tiff
957958
public const string CieLabLzwPredictor = "Tiff/CieLab_lzwcompressed_predictor.tiff";
958959

959960
public const string Cmyk = "Tiff/Cmyk.tiff";
961+
public const string Cmyk64BitDeflate = "Tiff/cmyk_deflate_64bit.tiff";
960962

961963
public const string Issues1716Rgb161616BitLittleEndian = "Tiff/Issues/Issue1716.tiff";
962964
public const string Issues1891 = "Tiff/Issues/Issue1891.tiff";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:45793bfd1c9e92910b5b38805499859c38bb2fa1a2ae0c22888c16cc88b25d23
3+
size 53002

0 commit comments

Comments
 (0)