diff --git a/src/ImageSharp/Common/Helpers/Vector4Utils.cs b/src/ImageSharp/Common/Helpers/Vector4Utils.cs
index 5c122217d..a4e0921d0 100644
--- a/src/ImageSharp/Common/Helpers/Vector4Utils.cs
+++ b/src/ImageSharp/Common/Helpers/Vector4Utils.cs
@@ -92,7 +92,7 @@ namespace SixLabors.ImageSharp
}
///
- /// Bulk variant of
+ /// Bulk variant of .
///
/// The span of vectors
/// The transformation matrix.
diff --git a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor.cs b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor.cs
index d2e9630dc..83746952c 100644
--- a/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor.cs
+++ b/src/ImageSharp/Processing/Processors/Convolution/EdgeDetector2DProcessor.cs
@@ -40,7 +40,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Convolution
public DenseMatrix KernelY { get; }
///
- public bool Grayscale { get; set; }
+ public bool Grayscale { get; }
///
protected override void OnFrameApply(ImageFrame source, Rectangle sourceRectangle, Configuration configuration)
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs
new file mode 100644
index 000000000..1f939a281
--- /dev/null
+++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/Basic1ParameterConvolutionTests.cs
@@ -0,0 +1,56 @@
+// // Copyright (c) Six Labors and contributors.
+// // Licensed under the Apache License, Version 2.0.
+
+using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Processing;
+using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
+using SixLabors.Primitives;
+
+using Xunit;
+
+namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
+{
+ [GroupOutput("Convolution")]
+ public abstract class Basic1ParameterConvolutionTests
+ {
+ private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.05F);
+
+ public static readonly TheoryData Values = new TheoryData { 3, 5 };
+
+ public static readonly string[] InputImages =
+ {
+ TestImages.Bmp.Car,
+ TestImages.Png.CalliphoraPartial
+ };
+
+ [Theory]
+ [WithFileCollection(nameof(InputImages), nameof(Values), PixelTypes.Rgba32)]
+ public void OnFullImage(TestImageProvider provider, int value)
+ where TPixel : struct, IPixel
+ {
+ provider.Utility.TestGroupName = this.GetType().Name;
+ provider.RunValidatingProcessorTest(
+ x => this.Apply(x, value),
+ value,
+ ValidatorComparer);
+ }
+
+ [Theory]
+ [WithFileCollection(nameof(InputImages), nameof(Values), PixelTypes.Rgba32)]
+ public void InBox(TestImageProvider provider, int value)
+ where TPixel : struct, IPixel
+ {
+ provider.Utility.TestGroupName = this.GetType().Name;
+ provider.RunRectangleConstrainedValidatingProcessorTest(
+ (x, rect) => this.Apply(x, value, rect),
+ value,
+ ValidatorComparer);
+ }
+
+ protected abstract void Apply(IImageProcessingContext ctx, int value)
+ where TPixel : struct, IPixel;
+
+ protected abstract void Apply(IImageProcessingContext ctx, int value, Rectangle bounds)
+ where TPixel : struct, IPixel;
+ }
+}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs
index 1f0d12cf7..923f9d616 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/BoxBlurTest.cs
@@ -1,51 +1,17 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
-using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
-using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-
using SixLabors.Primitives;
-using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
{
- public class BoxBlurTest : FileTestBase
+ [GroupOutput("Convolution")]
+ public class BoxBlurTest : Basic1ParameterConvolutionTests
{
- public static readonly TheoryData BoxBlurValues
- = new TheoryData
- {
- 3,
- 5
- };
-
- [Theory]
- [WithFileCollection(nameof(DefaultFiles), nameof(BoxBlurValues), DefaultPixelType)]
- public void ImageShouldApplyBoxBlurFilter(TestImageProvider provider, int value)
- where TPixel : struct, IPixel
- {
- using (Image image = provider.GetImage())
- {
- image.Mutate(x => x.BoxBlur(value));
- image.DebugSave(provider, value);
- }
- }
-
- [Theory]
- [WithFileCollection(nameof(DefaultFiles), nameof(BoxBlurValues), DefaultPixelType)]
- public void ImageShouldApplyBoxBlurFilterInBox(TestImageProvider provider, int value)
- where TPixel : struct, IPixel
- {
- using (Image source = provider.GetImage())
- using (Image image = source.Clone())
- {
- var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2);
-
- image.Mutate(x => x.BoxBlur(value, bounds));
- image.DebugSave(provider, value);
+ protected override void Apply(IImageProcessingContext ctx, int value) => ctx.BoxBlur(value);
- ImageComparer.Tolerant().VerifySimilarityIgnoreRegion(source, image, bounds);
- }
- }
+ protected override void Apply(IImageProcessingContext ctx, int value, Rectangle bounds) =>
+ ctx.BoxBlur(value, bounds);
}
}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs
index b6a7741b3..05524b20b 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/DetectEdgesTest.cs
@@ -10,13 +10,16 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
{
- public class DetectEdgesTest : FileTestBase
+ [GroupOutput("Convolution")]
+ public class DetectEdgesTest
{
// I think our comparison is not accurate enough (nor can be) for RgbaVector.
// The image pixels are identical according to BeyondCompare.
private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.0456F);
- public static readonly string[] CommonTestImages = { TestImages.Png.Bike };
+ public static readonly string[] TestImages = { Tests.TestImages.Png.Bike };
+
+ public const PixelTypes CommonNonDefaultPixelTypes = PixelTypes.Rgba32 | PixelTypes.Bgra32 | PixelTypes.RgbaVector;
public static readonly TheoryData DetectEdgesFilters = new TheoryData
{
@@ -33,7 +36,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
};
[Theory]
- [WithFileCollection(nameof(CommonTestImages), DefaultPixelType)]
+ [WithFileCollection(nameof(TestImages), PixelTypes.Rgba32)]
public void DetectEdges_WorksOnWrappedMemoryImage(TestImageProvider provider)
where TPixel : struct, IPixel
{
@@ -49,8 +52,8 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
}
[Theory]
- [WithTestPatternImages(nameof(DetectEdgesFilters), 100, 100, DefaultPixelType)]
- [WithFileCollection(nameof(CommonTestImages), nameof(DetectEdgesFilters), DefaultPixelType)]
+ [WithTestPatternImages(nameof(DetectEdgesFilters), 100, 100, PixelTypes.Rgba32)]
+ [WithFileCollection(nameof(TestImages), nameof(DetectEdgesFilters), PixelTypes.Rgba32)]
public void DetectEdges_WorksWithAllFilters(TestImageProvider provider, EdgeDetectionOperators detector)
where TPixel : struct, IPixel
{
@@ -63,7 +66,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
}
[Theory]
- [WithFileCollection(nameof(CommonTestImages), CommonNonDefaultPixelTypes)]
+ [WithFileCollection(nameof(TestImages), CommonNonDefaultPixelTypes)]
public void DetectEdges_IsNotBoundToSinglePixelType(TestImageProvider provider)
where TPixel : struct, IPixel
{
@@ -76,7 +79,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
}
[Theory]
- [WithFile(TestImages.Gif.Giphy, DefaultPixelType)]
+ [WithFile(Tests.TestImages.Gif.Giphy, PixelTypes.Rgba32)]
public void DetectEdges_IsAppliedToAllFrames(TestImageProvider provider)
where TPixel : struct, IPixel
{
@@ -88,7 +91,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
}
[Theory]
- [WithFileCollection(nameof(CommonTestImages), DefaultPixelType)]
+ [WithFileCollection(nameof(TestImages), PixelTypes.Rgba32)]
public void DetectEdges_InBox(TestImageProvider provider)
where TPixel : struct, IPixel
{
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs
index 6bd3b34bb..6307a1c51 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianBlurTest.cs
@@ -10,37 +10,12 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
{
- public class GaussianBlurTest : FileTestBase
+ [GroupOutput("Convolution")]
+ public class GaussianBlurTest : Basic1ParameterConvolutionTests
{
- public static readonly TheoryData GaussianBlurValues = new TheoryData { 3, 5 };
+ protected override void Apply(IImageProcessingContext ctx, int value) => ctx.GaussianBlur(value);
- [Theory]
- [WithFileCollection(nameof(DefaultFiles), nameof(GaussianBlurValues), DefaultPixelType)]
- public void ImageShouldApplyGaussianBlurFilter(TestImageProvider provider, int value)
- where TPixel : struct, IPixel
- {
- using (Image image = provider.GetImage())
- {
- image.Mutate(x => x.GaussianBlur(value));
- image.DebugSave(provider, value);
- }
- }
-
- [Theory]
- [WithFileCollection(nameof(DefaultFiles), nameof(GaussianBlurValues), DefaultPixelType)]
- public void ImageShouldApplyGaussianBlurFilterInBox(TestImageProvider provider, int value)
- where TPixel : struct, IPixel
- {
- using (Image source = provider.GetImage())
- using (Image image = source.Clone())
- {
- var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2);
-
- image.Mutate(x => x.GaussianBlur(value, bounds));
- image.DebugSave(provider, value);
-
- ImageComparer.Tolerant().VerifySimilarityIgnoreRegion(source, image, bounds);
- }
- }
+ protected override void Apply(IImageProcessingContext ctx, int value, Rectangle bounds) =>
+ ctx.GaussianBlur(value, bounds);
}
}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs
index 8eb1f85eb..29a1643b0 100644
--- a/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Processors/Convolution/GaussianSharpenTest.cs
@@ -9,42 +9,12 @@ using Xunit;
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Convolution
{
- public class GaussianSharpenTest : FileTestBase
+ [GroupOutput("Convolution")]
+ public class GaussianSharpenTest : Basic1ParameterConvolutionTests
{
- public static readonly TheoryData GaussianSharpenValues
- = new TheoryData
- {
- 3,
- 5
- };
+ protected override void Apply(IImageProcessingContext ctx, int value) => ctx.GaussianSharpen(value);
- [Theory]
- [WithFileCollection(nameof(DefaultFiles), nameof(GaussianSharpenValues), DefaultPixelType)]
- public void ImageShouldApplyGaussianSharpenFilter(TestImageProvider provider, int value)
- where TPixel : struct, IPixel
- {
- using (Image image = provider.GetImage())
- {
- image.Mutate(x => x.GaussianSharpen(value));
- image.DebugSave(provider, value);
- }
- }
-
- [Theory]
- [WithFileCollection(nameof(DefaultFiles), nameof(GaussianSharpenValues), DefaultPixelType)]
- public void ImageShouldApplyGaussianSharpenFilterInBox(TestImageProvider provider, int value)
- where TPixel : struct, IPixel
- {
- using (Image source = provider.GetImage())
- using (var image = source.Clone())
- {
- var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2);
-
- image.Mutate(x => x.GaussianSharpen(value, bounds));
- image.DebugSave(provider, value);
-
- ImageComparer.Tolerant().VerifySimilarityIgnoreRegion(source, image, bounds);
- }
- }
+ protected override void Apply(IImageProcessingContext ctx, int value, Rectangle bounds) =>
+ ctx.GaussianSharpen(value, bounds);
}
}
\ No newline at end of file
diff --git a/tests/Images/External b/tests/Images/External
index 1ca515499..2a3247c6d 160000
--- a/tests/Images/External
+++ b/tests/Images/External
@@ -1 +1 @@
-Subproject commit 1ca515499663e8b0b7c924a49b8d212f7447bdb0
+Subproject commit 2a3247c6da18b8a96cc71e1f2862ac03f2a42315