Browse Source

reduce toleance values

pull/512/head
Anton Firszov 8 years ago
parent
commit
67c66feb8b
  1. 4
      tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs
  2. 3
      tests/ImageSharp.Tests/Processing/Processors/Filters/BlackWhiteTest.cs
  3. 6
      tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs
  4. 4
      tests/ImageSharp.Tests/TestUtilities/TestUtils.cs

4
tests/ImageSharp.Tests/Processing/Processors/Dithering/DitherTests.cs

@ -75,7 +75,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
}
[Theory]
[WithFile(TestImages.Png.Bike, CommonNonDefaultPixelTypes)]
[WithFile(TestImages.Png.Filter0, CommonNonDefaultPixelTypes)]
public void DitherFilter_ShouldNotDependOnSinglePixelType<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
@ -87,7 +87,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
}
[Theory]
[WithFile(TestImages.Png.Bike, CommonNonDefaultPixelTypes)]
[WithFile(TestImages.Png.Filter0, CommonNonDefaultPixelTypes)]
public void DiffusionFilter_ShouldNotDependOnSinglePixelType<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{

3
tests/ImageSharp.Tests/Processing/Processors/Filters/BlackWhiteTest.cs

@ -8,6 +8,7 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
using SixLabors.ImageSharp.Processing.Filters;
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
[GroupOutput("Filters")]
public class BlackWhiteTest
@ -17,7 +18,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
public void ApplyBlackWhiteFilter<TPixel>(TestImageProvider<TPixel> provider)
where TPixel : struct, IPixel<TPixel>
{
provider.RunValidatingProcessorTest(ctx => ctx.BlackWhite());
provider.RunValidatingProcessorTest(ctx => ctx.BlackWhite(), comparer: ImageComparer.TolerantPercentage(0.002f));
}
}
}

6
tests/ImageSharp.Tests/Processing/Processors/Filters/FilterTest.cs

@ -16,6 +16,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
[GroupOutput("Filters")]
public class FilterTest
{
private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.02f);
// Testing the generic FilterProcessor with more than one pixel type intentionally.
// There is no need to do this with the specialized ones.
[Theory]
@ -25,7 +27,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
Matrix4x4 m = CreateCombinedTestFilterMatrix();
provider.RunValidatingProcessorTest(x => x.Filter(m));
provider.RunValidatingProcessorTest(x => x.Filter(m), comparer: ValidatorComparer);
}
[Theory]
@ -35,7 +37,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Filters
{
Matrix4x4 m = CreateCombinedTestFilterMatrix();
provider.RunRectangleConstrainedValidatingProcessorTest((x, b) => x.Filter(m, b));
provider.RunRectangleConstrainedValidatingProcessorTest((x, b) => x.Filter(m, b), comparer: ValidatorComparer);
}
private static Matrix4x4 CreateCombinedTestFilterMatrix()

4
tests/ImageSharp.Tests/TestUtilities/TestUtils.cs

@ -167,7 +167,7 @@ namespace SixLabors.ImageSharp.Tests
{
if (comparer == null)
{
comparer = ImageComparer.Tolerant(0.5f / 100);
comparer = ImageComparer.TolerantPercentage(0.001f);
}
using (Image<TPixel> image = provider.GetImage())
@ -195,7 +195,7 @@ namespace SixLabors.ImageSharp.Tests
{
if (comparer == null)
{
comparer = ImageComparer.Tolerant(0.5f / 100);
comparer = ImageComparer.TolerantPercentage(0.001f);
}
using (Image<TPixel> image = provider.GetImage())

Loading…
Cancel
Save