|
|
|
@ -6,7 +6,6 @@ using System.Collections.Generic; |
|
|
|
using System.Globalization; |
|
|
|
using System.Linq; |
|
|
|
using System.Text.RegularExpressions; |
|
|
|
using Microsoft.DotNet.RemoteExecutor; |
|
|
|
using SixLabors.ImageSharp.Advanced; |
|
|
|
using SixLabors.ImageSharp.PixelFormats; |
|
|
|
using SixLabors.ImageSharp.Processing; |
|
|
|
@ -44,9 +43,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution |
|
|
|
[InlineData(20, 4, -10f)] |
|
|
|
[InlineData(20, 4, 0f)] |
|
|
|
public void VerifyBokehBlurProcessorArguments_Fail(int radius, int components, float gamma) |
|
|
|
{ |
|
|
|
Assert.Throws<ArgumentOutOfRangeException>(() => new BokehBlurProcessor(radius, components, gamma)); |
|
|
|
} |
|
|
|
=> Assert.Throws<ArgumentOutOfRangeException>( |
|
|
|
() => new BokehBlurProcessor(radius, components, gamma)); |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public void VerifyComplexComponents() |
|
|
|
@ -137,12 +135,10 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution |
|
|
|
[WithTestPatternImages(nameof(BokehBlurValues), 30, 20, PixelTypes.Rgba32)] |
|
|
|
public void BokehBlurFilterProcessor<TPixel>(TestImageProvider<TPixel> provider, BokehBlurInfo value) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
provider.RunValidatingProcessorTest( |
|
|
|
=> provider.RunValidatingProcessorTest( |
|
|
|
x => x.BokehBlur(value.Radius, value.Components, value.Gamma), |
|
|
|
testOutputDetails: value.ToString(), |
|
|
|
appendPixelTypeToFileName: false); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
/* |
|
|
|
@ -152,18 +148,23 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution |
|
|
|
[WithTestPatternImages(200, 200, PixelTypes.Bgr24 | PixelTypes.Bgra32)] |
|
|
|
public void BokehBlurFilterProcessor_WorksWithAllPixelTypes<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
provider.RunValidatingProcessorTest( |
|
|
|
x => x.BokehBlur(8, 2, 3), |
|
|
|
appendSourceFileOrDescription: false); |
|
|
|
} |
|
|
|
=> provider.RunValidatingProcessorTest( |
|
|
|
x => x.BokehBlur(8, 2, 3), |
|
|
|
appendSourceFileOrDescription: false); |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithFileCollection(nameof(TestFiles), nameof(BokehBlurValues), PixelTypes.Rgba32)] |
|
|
|
public void BokehBlurFilterProcessor_Bounded<TPixel>(TestImageProvider<TPixel> provider, BokehBlurInfo value) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
public void BokehBlurFilterProcessor_Bounded(TestImageProvider<Rgba32> provider, BokehBlurInfo value) |
|
|
|
{ |
|
|
|
provider.RunValidatingProcessorTest( |
|
|
|
static void RunTest(string arg1, string arg2) |
|
|
|
{ |
|
|
|
TestImageProvider<Rgba32> provider = |
|
|
|
FeatureTestRunner.DeserializeForXunit<TestImageProvider<Rgba32>>(arg1); |
|
|
|
|
|
|
|
BokehBlurInfo value = |
|
|
|
FeatureTestRunner.DeserializeForXunit<BokehBlurInfo>(arg2); |
|
|
|
|
|
|
|
provider.RunValidatingProcessorTest( |
|
|
|
x => |
|
|
|
{ |
|
|
|
Size size = x.GetCurrentSize(); |
|
|
|
@ -172,6 +173,19 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution |
|
|
|
}, |
|
|
|
testOutputDetails: value.ToString(), |
|
|
|
appendPixelTypeToFileName: false); |
|
|
|
} |
|
|
|
|
|
|
|
FeatureTestRunner.RunWithHwIntrinsicsFeature( |
|
|
|
RunTest, |
|
|
|
HwIntrinsics.DisableSSE41, |
|
|
|
provider, |
|
|
|
value); |
|
|
|
} |
|
|
|
|
|
|
|
[Theory] |
|
|
|
[WithTestPatternImages(100, 300, PixelTypes.Bgr24)] |
|
|
|
public void WorksWithDiscoBuffers<TPixel>(TestImageProvider<TPixel> provider) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
=> provider.RunBufferCapacityLimitProcessorTest(260, c => c.BokehBlur()); |
|
|
|
} |
|
|
|
} |
|
|
|
|