Browse Source

Add tests for tiff encoder discontiguous buffers

pull/1654/head
Brian Popow 5 years ago
parent
commit
eb69eb7d17
  1. 14
      tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs

14
tests/ImageSharp.Tests/Formats/Tiff/TiffEncoderTests.cs

@ -437,6 +437,20 @@ namespace SixLabors.ImageSharp.Tests.Formats.Tiff
//// CcittGroup3Fax compressed data length can be larger than the original length.
Assert.Throws<Xunit.Sdk.TrueException>(() => TestStripLength(provider, photometricInterpretation, compression));
[Theory]
[WithTestPatternImages(287, 321, PixelTypes.Rgba32, TiffPhotometricInterpretation.Rgb)]
[WithTestPatternImages(287, 321, PixelTypes.Rgba32, TiffPhotometricInterpretation.PaletteColor)]
[WithTestPatternImages(287, 321, PixelTypes.Rgba32, TiffPhotometricInterpretation.BlackIsZero)]
public void TiffEncode_WorksWithDiscontiguousBuffers<TPixel>(TestImageProvider<TPixel> provider, TiffPhotometricInterpretation photometricInterpretation)
where TPixel : unmanaged, IPixel<TPixel>
{
provider.LimitAllocatorBufferCapacity().InPixelsSqrt(200);
using Image<TPixel> image = provider.GetImage();
var encoder = new TiffEncoder { PhotometricInterpretation = photometricInterpretation };
image.DebugSave(provider, encoder);
}
private static void TestStripLength<TPixel>(
TestImageProvider<TPixel> provider,
TiffPhotometricInterpretation photometricInterpretation,

Loading…
Cancel
Save