Browse Source

Add test for #2217

pull/2221/head
Brian Popow 3 years ago
parent
commit
3c2f8bfe33
  1. 16
      tests/ImageSharp.Tests/Processing/Binarization/AdaptiveThresholdTests.cs
  2. 3
      tests/ImageSharp.Tests/TestImages.cs
  3. 3
      tests/Images/Input/Png/issues/Issue_2217_AdaptiveThresholdProcessor.png

16
tests/ImageSharp.Tests/Processing/Binarization/AdaptiveThresholdTests.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Six Labors Split License.
using System;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.ImageSharp.Processing.Processors.Binarization;
@ -125,5 +126,20 @@ namespace SixLabors.ImageSharp.Tests.Processing.Binarization
image.CompareToReferenceOutput(ImageComparer.Exact, provider);
}
}
// https://github.com/SixLabors/ImageSharp/issues/2217
[Theory]
[WithFile(TestImages.Png.Issue2217, PixelTypes.Rgba32)]
public void Issue_2217_AdaptiveThreshold_DoesNotThrowIndexOutOfRangeException<TPixel>(
TestImageProvider<TPixel> provider)
where TPixel : unmanaged, IPixel<TPixel>
{
Exception exception = Record.Exception(() =>
{
using Image<TPixel> image = provider.GetImage();
});
Assert.Null(exception);
}
}
}

3
tests/ImageSharp.Tests/TestImages.cs

@ -125,6 +125,9 @@ namespace SixLabors.ImageSharp.Tests
// Discussion 1875: https://github.com/SixLabors/ImageSharp/discussions/1875
public const string Issue1875 = "Png/raw-profile-type-exif.png";
// Issue 2217: https://github.com/SixLabors/ImageSharp/issues/2217
public const string Issue2217 = "Png/issues/Issue_2217_AdaptiveThresholdProcessor.png";
public static class Bad
{
public const string MissingDataChunk = "Png/xdtn0g01.png";

3
tests/Images/Input/Png/issues/Issue_2217_AdaptiveThresholdProcessor.png

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