Skip to content

Commit 3f4f078

Browse files
committed
Add tests for fax4 compression
1 parent a11752e commit 3f4f078

File tree

6 files changed

+25
-7
lines changed

6 files changed

+25
-7
lines changed

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ public class TiffDecoderTests
2323
{
2424
public static readonly string[] MultiframeTestImages = Multiframes;
2525

26-
public static readonly string[] NotSupportedImages = NotSupported;
27-
2826
private static TiffDecoder TiffDecoder => new TiffDecoder();
2927

3028
private static MagickReferenceDecoder ReferenceDecoder => new MagickReferenceDecoder();
3129

3230
[Theory]
33-
[WithFileCollection(nameof(NotSupportedImages), PixelTypes.Rgba32)]
31+
[WithFile(Calliphora_RgbJpeg, PixelTypes.Rgba32)]
32+
[WithFile(RgbJpeg, PixelTypes.Rgba32)]
33+
[WithFile(RgbUncompressedTiled, PixelTypes.Rgba32)]
34+
[WithFile(MultiframeDifferentSize, PixelTypes.Rgba32)]
35+
[WithFile(MultiframeDifferentVariants, PixelTypes.Rgba32)]
3436
public void ThrowsNotSupported<TPixel>(TestImageProvider<TPixel> provider)
3537
where TPixel : unmanaged, IPixel<TPixel> => Assert.Throws<NotSupportedException>(() => provider.GetImage(TiffDecoder));
3638

@@ -356,6 +358,13 @@ public void TiffDecoder_CanDecode_HuffmanCompressed<TPixel>(TestImageProvider<TP
356358
public void TiffDecoder_CanDecode_Fax3Compressed<TPixel>(TestImageProvider<TPixel> provider)
357359
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider);
358360

361+
[Theory]
362+
[WithFile(Fax4Compressed, PixelTypes.Rgba32)]
363+
[WithFile(Fax4CompressedLowerOrderBitsFirst, PixelTypes.Rgba32)]
364+
[WithFile(Calliphora_Fax4Compressed, PixelTypes.Rgba32)]
365+
public void TiffDecoder_CanDecode_Fax4Compressed<TPixel>(TestImageProvider<TPixel> provider)
366+
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider);
367+
359368
[Theory]
360369
[WithFile(CcittFax3LowerOrderBitsFirst, PixelTypes.Rgba32)]
361370
public void TiffDecoder_CanDecode_Compressed_LowerOrderBitsFirst<TPixel>(TestImageProvider<TPixel> provider)

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,8 @@ public static class Tiff
534534
public const string Calliphora_Fax4Compressed = "Tiff/Calliphora_ccitt_fax4.tiff";
535535
public const string Calliphora_HuffmanCompressed = "Tiff/Calliphora_huffman_rle.tiff";
536536
public const string Calliphora_BiColorUncompressed = "Tiff/Calliphora_bicolor_uncompressed.tiff";
537+
public const string Fax4Compressed = "Tiff/basi3p02_fax4.tiff";
538+
public const string Fax4CompressedLowerOrderBitsFirst = "Tiff/basi3p02_fax4_lowerOrderBitsFirst.tiff";
537539

538540
public const string CcittFax3AllTermCodes = "Tiff/ccitt_fax3_all_terminating_codes.tiff";
539541
public const string CcittFax3AllMakeupCodes = "Tiff/ccitt_fax3_all_makeup_codes.tiff";
@@ -658,8 +660,6 @@ public static class Tiff
658660
public static readonly string[] Multiframes = { MultiframeDeflateWithPreview, MultiframeLzwPredictor /*, MultiFrameDifferentSize, MultiframeDifferentSizeTiled, MultiFrameDifferentVariants,*/ };
659661

660662
public static readonly string[] Metadata = { SampleMetadata };
661-
662-
public static readonly string[] NotSupported = { Calliphora_RgbJpeg, RgbJpeg, RgbUncompressedTiled, MultiframeDifferentSize, MultiframeDifferentVariants, Calliphora_Fax4Compressed, Fax4_Motorola };
663663
}
664664
}
665665
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:7a2c95aec08b96bca30af344f7d9952a603a951802ce534a5f2c5f563795cbd2
3-
size 117704
2+
oid sha256:b8c7f712f9e7d1feeeb55e7743f6ce7d66bc5292f4786ea8526d95057d73145e
3+
size 4534
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:185ae3c4174b323adcf811d125cd77b71768406845923f50395c0baebff57b7c
3+
size 282
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:a19eb117f194718575681a81a4fbe7fe4a1b82b99113707295194090fb935784
3+
size 282
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:af0d8f3c18f96228aa369bc295201a1bfe1b044c23991ff168401adc5402ebb6
3+
size 308

0 commit comments

Comments
 (0)