Skip to content

Commit 978aff8

Browse files
committed
Add test case for issue 2679
1 parent e8bbdf7 commit 978aff8

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,23 @@ public void TiffDecoder_CanDecode_TiledWithNonEqualWidthAndHeight<TPixel>(TestIm
671671
public void TiffDecoder_CanDecode_BiColorWithMissingBitsPerSample<TPixel>(TestImageProvider<TPixel> provider)
672672
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider);
673673

674+
// https://github.com/SixLabors/ImageSharp/issues/2679
675+
[Theory]
676+
[WithFile(Issues2679, PixelTypes.Rgba32)]
677+
public void TiffDecoder_CanDecode_JpegCompressedWithIssue2679<TPixel>(TestImageProvider<TPixel> provider)
678+
where TPixel : unmanaged, IPixel<TPixel>
679+
{
680+
using Image<TPixel> image = provider.GetImage(TiffDecoder.Instance);
681+
682+
// The image is handcrafted to simulate issue 2679. ImageMagick will throw an expection here and wont decode,
683+
// so we compare to rererence output instead.
684+
image.DebugSave(provider);
685+
image.CompareToReferenceOutput(
686+
ImageComparer.Exact,
687+
provider,
688+
appendPixelTypeToFileName: false);
689+
}
690+
674691
[Theory]
675692
[WithFile(JpegCompressedGray0000539558, PixelTypes.Rgba32)]
676693
public void TiffDecoder_ThrowsException_WithCircular_IFD_Offsets<TPixel>(TestImageProvider<TPixel> provider)

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,7 @@ public static class Tiff
10321032
public const string Issues2255 = "Tiff/Issues/Issue2255.png";
10331033
public const string Issues2435 = "Tiff/Issues/Issue2435.tiff";
10341034
public const string Issues2587 = "Tiff/Issues/Issue2587.tiff";
1035+
public const string Issues2679 = "Tiff/Issues/Issue2679.tiff";
10351036
public const string JpegCompressedGray0000539558 = "Tiff/Issues/JpegCompressedGray-0000539558.tiff";
10361037
public const string Tiled0000023664 = "Tiff/Issues/tiled-0000023664.tiff";
10371038

Lines changed: 3 additions & 0 deletions
Loading
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:feb938396b9d5b4c258244197ba382937a52c93f72cc91081c7e6810e4a3b94c
3+
size 6136

0 commit comments

Comments
 (0)