mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.0 KiB
52 lines
2.0 KiB
// Copyright (c) Six Labors.
|
|
// Licensed under the Six Labors Split License.
|
|
|
|
using SixLabors.ImageSharp.PixelFormats;
|
|
using SixLabors.ImageSharp.Processing;
|
|
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
|
|
|
|
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Effects;
|
|
|
|
[Trait("Category", "Processors")]
|
|
[GroupOutput("Effects")]
|
|
public class OilPaintTest
|
|
{
|
|
public static readonly TheoryData<int, int> OilPaintValues = new TheoryData<int, int>
|
|
{
|
|
{ 15, 10 },
|
|
{ 6, 5 }
|
|
};
|
|
|
|
public static readonly string[] InputImages =
|
|
{
|
|
TestImages.Png.CalliphoraPartial,
|
|
TestImages.Bmp.Car
|
|
};
|
|
|
|
[Theory]
|
|
[WithFileCollection(nameof(InputImages), nameof(OilPaintValues), PixelTypes.Rgba32)]
|
|
public void FullImage<TPixel>(TestImageProvider<TPixel> provider, int levels, int brushSize)
|
|
where TPixel : unmanaged, IPixel<TPixel>
|
|
{
|
|
provider.RunValidatingProcessorTest(
|
|
x =>
|
|
{
|
|
x.OilPaint(levels, brushSize);
|
|
return $"{levels}-{brushSize}";
|
|
},
|
|
ImageComparer.TolerantPercentage(0.01F),
|
|
appendPixelTypeToFileName: false);
|
|
}
|
|
|
|
[Theory]
|
|
[WithFileCollection(nameof(InputImages), nameof(OilPaintValues), PixelTypes.Rgba32)]
|
|
[WithTestPatternImages(nameof(OilPaintValues), 100, 100, PixelTypes.Rgba32)]
|
|
public void InBox<TPixel>(TestImageProvider<TPixel> provider, int levels, int brushSize)
|
|
where TPixel : unmanaged, IPixel<TPixel>
|
|
{
|
|
provider.RunRectangleConstrainedValidatingProcessorTest(
|
|
(x, rect) => x.OilPaint(levels, brushSize, rect),
|
|
$"{levels}-{brushSize}",
|
|
ImageComparer.TolerantPercentage(0.01F));
|
|
}
|
|
}
|
|
|