Browse Source

Add tests for fax4 compression

pull/1747/head
Brian Popow 5 years ago
parent
commit
3f4f07835c
  1. 15
      tests/ImageSharp.Tests/Formats/Tiff/TiffDecoderTests.cs
  2. 4
      tests/ImageSharp.Tests/TestImages.cs
  3. 4
      tests/Images/Input/Tiff/Calliphora_ccitt_fax4.tiff
  4. 3
      tests/Images/Input/Tiff/basi3p02_fax4.tiff
  5. 3
      tests/Images/Input/Tiff/basi3p02_fax4_lowerOrderBitsFirst.tiff
  6. 3
      tests/Images/Input/Tiff/basi3p02_fax4_minisblack.tiff

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

@ -23,14 +23,16 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
{
public static readonly string[] MultiframeTestImages = Multiframes;
public static readonly string[] NotSupportedImages = NotSupported;
private static TiffDecoder TiffDecoder => new TiffDecoder();
private static MagickReferenceDecoder ReferenceDecoder => new MagickReferenceDecoder();
[Theory]
[WithFileCollection(nameof(NotSupportedImages), PixelTypes.Rgba32)]
[WithFile(Calliphora_RgbJpeg, PixelTypes.Rgba32)]
[WithFile(RgbJpeg, PixelTypes.Rgba32)]
[WithFile(RgbUncompressedTiled, PixelTypes.Rgba32)]
[WithFile(MultiframeDifferentSize, PixelTypes.Rgba32)]
[WithFile(MultiframeDifferentVariants, PixelTypes.Rgba32)]
public void ThrowsNotSupported<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => Assert.Throws<NotSupportedException>(() => provider.GetImage(TiffDecoder));
@ -356,6 +358,13 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
public void TiffDecoder_CanDecode_Fax3Compressed<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider);
[Theory]
[WithFile(Fax4Compressed, PixelTypes.Rgba32)]
[WithFile(Fax4CompressedLowerOrderBitsFirst, PixelTypes.Rgba32)]
[WithFile(Calliphora_Fax4Compressed, PixelTypes.Rgba32)]
public void TiffDecoder_CanDecode_Fax4Compressed<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider);
[Theory]
[WithFile(CcittFax3LowerOrderBitsFirst, PixelTypes.Rgba32)]
public void TiffDecoder_CanDecode_Compressed_LowerOrderBitsFirst<TPixel>(TestImageProvider<TPixel> provider)

4
tests/ImageSharp.Tests/TestImages.cs

@ -534,6 +534,8 @@ namespace SixLabors.ImageSharp.Tests
public const string Calliphora_Fax4Compressed = "Tiff/Calliphora_ccitt_fax4.tiff";
public const string Calliphora_HuffmanCompressed = "Tiff/Calliphora_huffman_rle.tiff";
public const string Calliphora_BiColorUncompressed = "Tiff/Calliphora_bicolor_uncompressed.tiff";
public const string Fax4Compressed = "Tiff/basi3p02_fax4.tiff";
public const string Fax4CompressedLowerOrderBitsFirst = "Tiff/basi3p02_fax4_lowerOrderBitsFirst.tiff";
public const string CcittFax3AllTermCodes = "Tiff/ccitt_fax3_all_terminating_codes.tiff";
public const string CcittFax3AllMakeupCodes = "Tiff/ccitt_fax3_all_makeup_codes.tiff";
@ -658,8 +660,6 @@ namespace SixLabors.ImageSharp.Tests
public static readonly string[] Multiframes = { MultiframeDeflateWithPreview, MultiframeLzwPredictor /*, MultiFrameDifferentSize, MultiframeDifferentSizeTiled, MultiFrameDifferentVariants,*/ };
public static readonly string[] Metadata = { SampleMetadata };
public static readonly string[] NotSupported = { Calliphora_RgbJpeg, RgbJpeg, RgbUncompressedTiled, MultiframeDifferentSize, MultiframeDifferentVariants, Calliphora_Fax4Compressed, Fax4_Motorola };
}
}
}

4
tests/Images/Input/Tiff/Calliphora_ccitt_fax4.tiff

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7a2c95aec08b96bca30af344f7d9952a603a951802ce534a5f2c5f563795cbd2
size 117704
oid sha256:b8c7f712f9e7d1feeeb55e7743f6ce7d66bc5292f4786ea8526d95057d73145e
size 4534

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

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

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

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

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

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