Skip to content

Commit 93790ba

Browse files
committed
Add test for #2435
1 parent 8756c32 commit 93790ba

File tree

3 files changed

+17
-35
lines changed

3 files changed

+17
-35
lines changed

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

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,7 @@ public void TiffDecoder_CanDecode_12Bit_WithUnassociatedAlpha<TPixel>(TestImageP
200200
[Theory]
201201
[WithFile(Rgba3BitAssociatedAlpha, PixelTypes.Rgba32)]
202202
public void TiffDecoder_CanDecode_12Bit_WithAssociatedAlpha<TPixel>(TestImageProvider<TPixel> provider)
203-
where TPixel : unmanaged, IPixel<TPixel>
204-
{
205-
206-
TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.264F);
207-
}
203+
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.264F);
208204

209205
[Theory]
210206
[WithFile(Flower14BitGray, PixelTypes.Rgba32)]
@@ -249,11 +245,7 @@ public void TiffDecoder_CanDecode_20Bit_WithUnassociatedAlpha<TPixel>(TestImageP
249245
[WithFile(Rgba5BitAssociatedAlpha, PixelTypes.Rgba32)]
250246
public void TiffDecoder_CanDecode_20Bit_WithAssociatedAlpha<TPixel>(TestImageProvider<TPixel> provider)
251247

252-
where TPixel : unmanaged, IPixel<TPixel>
253-
{
254-
255-
TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.376F);
256-
}
248+
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.376F);
257249

258250
[Theory]
259251
[WithFile(FlowerRgb888Contiguous, PixelTypes.Rgba32)]
@@ -268,11 +260,7 @@ public void TiffDecoder_CanDecode_24Bit_WithUnassociatedAlpha<TPixel>(TestImageP
268260
[Theory]
269261
[WithFile(Rgba6BitAssociatedAlpha, PixelTypes.Rgba32)]
270262
public void TiffDecoder_CanDecode_24Bit_WithAssociatedAlpha<TPixel>(TestImageProvider<TPixel> provider)
271-
where TPixel : unmanaged, IPixel<TPixel>
272-
{
273-
274-
TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.405F);
275-
}
263+
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.405F);
276264

277265
[Theory]
278266
[WithFile(Flower24BitGray, PixelTypes.Rgba32)]
@@ -362,12 +350,8 @@ public void TiffDecoder_CanDecode_32Bit_WithUnassociatedAlpha<TPixel>(TestImageP
362350
[Theory]
363351
[WithFile(Rgba8BitAssociatedAlpha, PixelTypes.Rgba32)]
364352
public void TiffDecoder_CanDecode_32Bit_WithAssociatedAlpha<TPixel>(TestImageProvider<TPixel> provider)
365-
where TPixel : unmanaged, IPixel<TPixel>
366-
{
367-
368353
// Note: Using tolerant comparer here, because there is a small difference to the reference decoder probably due to floating point rounding issues.
369-
TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.004F);
370-
}
354+
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.004F);
371355

372356
[Theory]
373357
[WithFile(Flower32BitGrayPredictorBigEndian, PixelTypes.Rgba32)]
@@ -395,11 +379,7 @@ public void TiffDecoder_CanDecode_40Bit_WithUnassociatedAlpha<TPixel>(TestImageP
395379
[WithFile(Rgba10BitAssociatedAlphaBigEndian, PixelTypes.Rgba32)]
396380
[WithFile(Rgba10BitAssociatedAlphaLittleEndian, PixelTypes.Rgba32)]
397381
public void TiffDecoder_CanDecode_40Bit_WithAssociatedAlpha<TPixel>(TestImageProvider<TPixel> provider)
398-
where TPixel : unmanaged, IPixel<TPixel>
399-
{
400-
401-
TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.247F);
402-
}
382+
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.247F);
403383

404384
[Theory]
405385
[WithFile(FlowerRgb141414Contiguous, PixelTypes.Rgba32)]
@@ -426,11 +406,7 @@ public void TiffDecoder_CanDecode_48Bit_WithUnassociatedAlpha<TPixel>(TestImageP
426406
[WithFile(Rgba12BitAssociatedAlphaBigEndian, PixelTypes.Rgba32)]
427407
[WithFile(Rgba12BitAssociatedAlphaLittleEndian, PixelTypes.Rgba32)]
428408
public void TiffDecoder_CanDecode_48Bit_WithAssociatedAlpha<TPixel>(TestImageProvider<TPixel> provider)
429-
where TPixel : unmanaged, IPixel<TPixel>
430-
{
431-
432-
TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.118F);
433-
}
409+
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.118F);
434410

435411
[Theory]
436412
[WithFile(FlowerRgb161616PredictorBigEndian, PixelTypes.Rgba32)]
@@ -448,11 +424,7 @@ public void TiffDecoder_CanDecode_56Bit_WithUnassociatedAlpha<TPixel>(TestImageP
448424
[WithFile(Rgba14BitAssociatedAlphaBigEndian, PixelTypes.Rgba32)]
449425
[WithFile(Rgba14BitAssociatedAlphaLittleEndian, PixelTypes.Rgba32)]
450426
public void TiffDecoder_CanDecode_56Bit_WithAssociatedAlpha<TPixel>(TestImageProvider<TPixel> provider)
451-
where TPixel : unmanaged, IPixel<TPixel>
452-
{
453-
454-
TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.075F);
455-
}
427+
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider, useExactComparer: false, compareTolerance: 0.075F);
456428

457429
[Theory]
458430
[WithFile(FlowerRgb242424Contiguous, PixelTypes.Rgba32)]
@@ -686,6 +658,12 @@ public void TiffDecoder_ThrowsException_WithTooManyDirectories<TPixel>(TestImage
686658
public void TiffDecoder_CanDecode_Fax4CompressedWithStrips<TPixel>(TestImageProvider<TPixel> provider)
687659
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider);
688660

661+
// https://github.com/SixLabors/ImageSharp/issues/2435
662+
[Theory]
663+
[WithFile(Issues2435, PixelTypes.Rgba32)]
664+
public void TiffDecoder_CanDecode_TiledWithNonEqualWidthAndHeight<TPixel>(TestImageProvider<TPixel> provider)
665+
where TPixel : unmanaged, IPixel<TPixel> => TestTiffDecoder(provider);
666+
689667
[Theory]
690668
[WithFileCollection(nameof(MultiframeTestImages), PixelTypes.Rgba32)]
691669
public void DecodeMultiframe<TPixel>(TestImageProvider<TPixel> provider)

tests/ImageSharp.Tests/TestImages.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ public static class Tiff
964964
public const string Issues2123 = "Tiff/Issues/Issue2123.tiff";
965965
public const string Issues2149 = "Tiff/Issues/Group4CompressionWithStrips.tiff";
966966
public const string Issues2255 = "Tiff/Issues/Issue2255.png";
967+
public const string Issues2435 = "Tiff/Issues/Issue2435.tiff";
967968

968969
public const string SmallRgbDeflate = "Tiff/rgb_small_deflate.tiff";
969970
public const string SmallRgbLzw = "Tiff/rgb_small_lzw.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:e5c90d6d90f1cf090562d7d70df858b83513e5d7d78fb7b7c4d7992cb620030e
3+
size 258540

0 commit comments

Comments
 (0)