Browse Source

Add regression test for Issue984

af/merge-core
Brian Popow 7 years ago
parent
commit
d15022007f
  1. 26
      tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs

26
tests/ImageSharp.Tests/Processing/Normalization/HistogramEqualizationTests.cs

@ -9,6 +9,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Normalization
{
// ReSharper disable InconsistentNaming
public class HistogramEqualizationTests
{
private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.0456F);
@ -113,5 +114,30 @@ namespace SixLabors.ImageSharp.Tests.Processing.Normalization
image.CompareToReferenceOutput(ValidatorComparer, provider);
}
}
/// <summary>
/// This is regression test for a bug with the calculation of the y-start positions,
/// where it could happen that one too much start position was calculated in some cases.
/// See: https://github.com/SixLabors/ImageSharp/pull/984
/// </summary>
[Theory]
[WithTestPatternImages(110, 110, PixelTypes.Rgba32)]
[WithTestPatternImages(170, 170, PixelTypes.Rgba32)]
public void Issue984_DoesNotThrowException<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
using (Image<TPixel> image = provider.GetImage())
{
var options = new HistogramEqualizationOptions()
{
Method = HistogramEqualizationMethod.AdaptiveTileInterpolation,
LuminanceLevels = 256,
ClipHistogram = true,
NumberOfTiles = 10
};
System.Exception ex = Record.Exception(() => image.Mutate(x => x.HistogramEqualization(options)));
Assert.Null(ex);
}
}
}
}

Loading…
Cancel
Save