Browse Source

add 1-bit test files, renaming

pull/1760/head
Ildar Khayrutdinov 5 years ago
parent
commit
04884d56a9
  1. 25
      tests/ImageSharp.Tests/Formats/Tiff/BigTiffDecoderTests.cs
  2. 8
      tests/ImageSharp.Tests/TestImages.cs
  3. 3
      tests/Images/Input/Tiff/BigTiff/BigTIFF_MinIsBlack.tif
  4. 3
      tests/Images/Input/Tiff/BigTiff/BigTIFF_MinIsBlack_Fax3.tif
  5. 3
      tests/Images/Input/Tiff/BigTiff/BigTIFF_MinIsWhite.tif

25
tests/ImageSharp.Tests/Formats/Tiff/BigTiffDecoderTests.cs

@ -31,6 +31,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
[WithFile(BigTIFFSubIFD8, PixelTypes.Rgba32)] [WithFile(BigTIFFSubIFD8, PixelTypes.Rgba32)]
[WithFile(Indexed4_Deflate, PixelTypes.Rgba32)] [WithFile(Indexed4_Deflate, PixelTypes.Rgba32)]
[WithFile(Indexed8_LZW, PixelTypes.Rgba32)] [WithFile(Indexed8_LZW, PixelTypes.Rgba32)]
[WithFile(MinIsBlack, PixelTypes.Rgba32)]
[WithFile(MinIsWhite, PixelTypes.Rgba32)]
public void TiffDecoder_CanDecode<TPixel>(TestImageProvider<TPixel> provider) public void TiffDecoder_CanDecode<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider); where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider);
@ -40,11 +42,19 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
where TPixel : unmanaged, IPixel<TPixel> => Assert.Throws<NotSupportedException>(() => provider.GetImage(TiffDecoder)); where TPixel : unmanaged, IPixel<TPixel> => Assert.Throws<NotSupportedException>(() => provider.GetImage(TiffDecoder));
[Theory] [Theory]
[WithFile(MinIsWhite_RLE, PixelTypes.Rgba32)] [WithFile(Damaged_MinIsWhite_RLE, PixelTypes.Rgba32)]
[WithFile(MinIsBlack_RLE, PixelTypes.Rgba32)] [WithFile(Damaged_MinIsBlack_RLE, PixelTypes.Rgba32)]
[WithFile(MinIsBlack_Fax3, PixelTypes.Rgba32)] public void DamagedFiles<TPixel>(TestImageProvider<TPixel> provider)
public void ProblemFiles<TPixel>(TestImageProvider<TPixel> provider) where TPixel : unmanaged, IPixel<TPixel>
where TPixel : unmanaged, IPixel<TPixel> => Assert.Throws<ImageDifferenceIsOverThresholdException>(() => TestTiffDecoder(provider)); {
Assert.Throws<ImageDifferenceIsOverThresholdException>(() => TestTiffDecoder(provider));
using Image<TPixel> image = provider.GetImage(TiffDecoder);
ExifProfile exif = image.Frames.RootFrame.Metadata.ExifProfile;
// PhotometricInterpretation is required tag: https://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html
Assert.Null(exif.GetValueInternal(ExifTag.PhotometricInterpretation));
}
[Theory] [Theory]
[InlineData(BigTIFF, 24, 64, 64, 96, 96, PixelResolutionUnit.PixelsPerInch)] [InlineData(BigTIFF, 24, 64, 64, 96, 96, PixelResolutionUnit.PixelsPerInch)]
@ -56,9 +66,8 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
[InlineData(BigTIFFSubIFD8, 24, 64, 64, 96, 96, PixelResolutionUnit.PixelsPerInch)] [InlineData(BigTIFFSubIFD8, 24, 64, 64, 96, 96, PixelResolutionUnit.PixelsPerInch)]
[InlineData(Indexed4_Deflate, 4, 64, 64, 96, 96, PixelResolutionUnit.PixelsPerInch)] [InlineData(Indexed4_Deflate, 4, 64, 64, 96, 96, PixelResolutionUnit.PixelsPerInch)]
[InlineData(Indexed8_LZW, 8, 64, 64, 96, 96, PixelResolutionUnit.PixelsPerInch)] [InlineData(Indexed8_LZW, 8, 64, 64, 96, 96, PixelResolutionUnit.PixelsPerInch)]
[InlineData(MinIsWhite_RLE, 1, 32, 32, 96, 96, PixelResolutionUnit.PixelsPerInch)] [InlineData(MinIsWhite, 1, 32, 32, 96, 96, PixelResolutionUnit.PixelsPerInch)]
[InlineData(MinIsBlack_RLE, 1, 32, 32, 96, 96, PixelResolutionUnit.PixelsPerInch)] [InlineData(MinIsBlack, 1, 32, 32, 96, 96, PixelResolutionUnit.PixelsPerInch)]
[InlineData(MinIsBlack_Fax3, 1, 32, 32, 96, 96, PixelResolutionUnit.PixelsPerInch)]
public void Identify(string imagePath, int expectedPixelSize, int expectedWidth, int expectedHeight, double expectedHResolution, double expectedVResolution, PixelResolutionUnit expectedResolutionUnit) public void Identify(string imagePath, int expectedPixelSize, int expectedWidth, int expectedHeight, double expectedHResolution, double expectedVResolution, PixelResolutionUnit expectedResolutionUnit)
{ {
var testFile = TestFile.Create(imagePath); var testFile = TestFile.Create(imagePath);

8
tests/ImageSharp.Tests/TestImages.cs

@ -689,9 +689,11 @@ namespace SixLabors.ImageSharp.Tests
public const string Indexed4_Deflate = Base + "BigTIFF_Indexed4_Deflate.tif"; public const string Indexed4_Deflate = Base + "BigTIFF_Indexed4_Deflate.tif";
public const string Indexed8_LZW = Base + "BigTIFF_Indexed8_LZW.tif"; public const string Indexed8_LZW = Base + "BigTIFF_Indexed8_LZW.tif";
public const string MinIsWhite_RLE = Base + "BigTIFF_MinIsWhite_RLE.tif"; public const string MinIsBlack = Base + "BigTIFF_MinIsBlack.tif";
public const string MinIsBlack_RLE = Base + "BigTIFF_MinIsBlack_RLE.tif"; public const string MinIsWhite = Base + "BigTIFF_MinIsWhite.tif";
public const string MinIsBlack_Fax3 = Base + "BigTIFF_MinIsBlack_Fax3.tif";
public const string Damaged_MinIsWhite_RLE = Base + "BigTIFF_MinIsWhite_RLE.tif";
public const string Damaged_MinIsBlack_RLE = Base + "BigTIFF_MinIsBlack_RLE.tif";
} }
} }
} }

3
tests/Images/Input/Tiff/BigTiff/BigTIFF_MinIsBlack.tif

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

3
tests/Images/Input/Tiff/BigTiff/BigTIFF_MinIsBlack_Fax3.tif

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

3
tests/Images/Input/Tiff/BigTiff/BigTIFF_MinIsWhite.tif

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