diff --git a/tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs b/tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs
new file mode 100644
index 0000000000..f19e6cd0c5
--- /dev/null
+++ b/tests/ImageSharp.Tests/Processing/Convolution/BoxBlurTest.cs
@@ -0,0 +1,53 @@
+//
+// Copyright (c) James Jackson-South and contributors.
+// Licensed under the Apache License, Version 2.0.
+//
+
+namespace ImageSharp.Tests.Processing.Convolution
+{
+ using ImageSharp.PixelFormats;
+
+ using Xunit;
+
+ public class BoxBlurTest : FileTestBase
+ {
+ public static readonly TheoryData BoxBlurValues
+ = new TheoryData
+ {
+ 3,
+ 5
+ };
+
+ [Theory]
+ [WithFileCollection(nameof(AllBmpFiles), nameof(BoxBlurValues), StandardPixelTypes)]
+ public void ImageShouldApplyBoxBlurFilter(TestImageProvider provider, int value)
+ where TPixel : struct, IPixel
+ {
+ using (Image image = provider.GetImage())
+ {
+ image.BoxBlur(value)
+ .DebugSave(provider, value, Extensions.Bmp);
+ }
+ }
+
+ [Theory]
+ [WithFileCollection(nameof(AllBmpFiles), nameof(BoxBlurValues), StandardPixelTypes)]
+ public void ImageShouldApplyBoxBlurFilterInBox(TestImageProvider provider, int value)
+ where TPixel : struct, IPixel
+ {
+ using (Image source = provider.GetImage())
+ using (var image = new Image(source))
+ {
+ var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2);
+
+ image.BoxBlur(value, bounds)
+ .DebugSave(provider, value, Extensions.Bmp);
+
+ // Draw identical shapes over the bounded and compare to ensure changes are constrained.
+ image.Fill(NamedColors.HotPink, bounds);
+ source.Fill(NamedColors.HotPink, bounds);
+ ImageComparer.CheckSimilarity(image, source);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Processors/Filters/GaussianBlurTest.cs b/tests/ImageSharp.Tests/Processing/Convolution/GaussianBlurTest.cs
similarity index 53%
rename from tests/ImageSharp.Tests/Processors/Filters/GaussianBlurTest.cs
rename to tests/ImageSharp.Tests/Processing/Convolution/GaussianBlurTest.cs
index 4b2ac8b7cf..d80daf1d62 100644
--- a/tests/ImageSharp.Tests/Processors/Filters/GaussianBlurTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Convolution/GaussianBlurTest.cs
@@ -3,48 +3,49 @@
// Licensed under the Apache License, Version 2.0.
//
-namespace ImageSharp.Tests
+namespace ImageSharp.Tests.Processing.Convolution
{
- using System.IO;
using ImageSharp.PixelFormats;
+
using Xunit;
- public class GaussianBlurTest
+ public class GaussianBlurTest : FileTestBase
{
public static readonly TheoryData GaussianBlurValues
= new TheoryData
{
- 3 ,
- 5 ,
+ 3,
+ 5
};
[Theory]
- [WithTestPatternImages(nameof(GaussianBlurValues), 320, 240, PixelTypes.StandardImageClass)]
+ [WithFileCollection(nameof(AllBmpFiles), nameof(GaussianBlurValues), StandardPixelTypes)]
public void ImageShouldApplyGaussianBlurFilter(TestImageProvider provider, int value)
where TPixel : struct, IPixel
{
using (Image image = provider.GetImage())
{
image.GaussianBlur(value)
- .DebugSave(provider, value.ToString());
+ .DebugSave(provider, value, Extensions.Bmp);
}
}
[Theory]
- [WithTestPatternImages(nameof(GaussianBlurValues), 320, 240, PixelTypes.StandardImageClass)]
+ [WithFileCollection(nameof(AllBmpFiles), nameof(GaussianBlurValues), StandardPixelTypes)]
public void ImageShouldApplyGaussianBlurFilterInBox(TestImageProvider provider, int value)
where TPixel : struct, IPixel
{
using (Image source = provider.GetImage())
- using (Image image = new Image(source))
+ using (var image = new Image(source))
{
- Rectangle rect = new Rectangle(image.Width / 4, image.Height / 4, image.Width / 2, image.Height / 2);
- image.GaussianBlur(value, rect)
- .DebugSave(provider, value.ToString());
+ var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2);
+
+ image.GaussianBlur(value, bounds)
+ .DebugSave(provider, value, Extensions.Bmp);
- // lets draw identical shapes over the blured areas and ensure that it didn't change the outer area
- image.Fill(NamedColors.HotPink, rect);
- source.Fill(NamedColors.HotPink, rect);
+ // Draw identical shapes over the bounded and compare to ensure changes are constrained.
+ image.Fill(NamedColors.HotPink, bounds);
+ source.Fill(NamedColors.HotPink, bounds);
ImageComparer.CheckSimilarity(image, source);
}
}
diff --git a/tests/ImageSharp.Tests/Processors/Filters/GaussianSharpenTest.cs b/tests/ImageSharp.Tests/Processing/Convolution/GaussianSharpenTest.cs
similarity index 53%
rename from tests/ImageSharp.Tests/Processors/Filters/GaussianSharpenTest.cs
rename to tests/ImageSharp.Tests/Processing/Convolution/GaussianSharpenTest.cs
index 1fa1ae15c1..1632e2c2fb 100644
--- a/tests/ImageSharp.Tests/Processors/Filters/GaussianSharpenTest.cs
+++ b/tests/ImageSharp.Tests/Processing/Convolution/GaussianSharpenTest.cs
@@ -3,10 +3,10 @@
// Licensed under the Apache License, Version 2.0.
//
-namespace ImageSharp.Tests
+namespace ImageSharp.Tests.Processing.Convolution
{
- using System.IO;
using ImageSharp.PixelFormats;
+
using Xunit;
public class GaussianSharpenTest : FileTestBase
@@ -14,37 +14,38 @@ namespace ImageSharp.Tests
public static readonly TheoryData GaussianSharpenValues
= new TheoryData
{
- 3 ,
- 5 ,
+ 3,
+ 5
};
[Theory]
- [WithTestPatternImages(nameof(GaussianSharpenValues), 320, 240, PixelTypes.StandardImageClass)]
+ [WithFileCollection(nameof(AllBmpFiles), nameof(GaussianSharpenValues), StandardPixelTypes)]
public void ImageShouldApplyGaussianSharpenFilter(TestImageProvider provider, int value)
where TPixel : struct, IPixel
{
using (Image image = provider.GetImage())
{
image.GaussianSharpen(value)
- .DebugSave(provider, value.ToString());
+ .DebugSave(provider, value, Extensions.Bmp);
}
}
[Theory]
- [WithTestPatternImages(nameof(GaussianSharpenValues), 320, 240, PixelTypes.StandardImageClass)]
+ [WithFileCollection(nameof(AllBmpFiles), nameof(GaussianSharpenValues), StandardPixelTypes)]
public void ImageShouldApplyGaussianSharpenFilterInBox(TestImageProvider provider, int value)
- where TPixel : struct, IPixel
+ where TPixel : struct, IPixel
{
using (Image source = provider.GetImage())
- using (Image image = new Image(source))
+ using (var image = new Image(source))
{
- Rectangle rect = new Rectangle(image.Width / 4, image.Height / 4, image.Width / 2, image.Height / 2);
- image.GaussianSharpen(value, rect)
- .DebugSave(provider, value.ToString());
+ var bounds = new Rectangle(10, 10, image.Width / 2, image.Height / 2);
+
+ image.GaussianSharpen(value, bounds)
+ .DebugSave(provider, value, Extensions.Bmp);
- // lets draw identical shapes over the Sharpened areas and ensure that it didn't change the outer area
- image.Fill(NamedColors.HotPink, rect);
- source.Fill(NamedColors.HotPink, rect);
+ // Draw identical shapes over the bounded and compare to ensure changes are constrained.
+ image.Fill(NamedColors.HotPink, bounds);
+ source.Fill(NamedColors.HotPink, bounds);
ImageComparer.CheckSimilarity(image, source);
}
}
diff --git a/tests/ImageSharp.Tests/Processors/Filters/BoxBlurTest.cs b/tests/ImageSharp.Tests/Processors/Filters/BoxBlurTest.cs
deleted file mode 100644
index 03226a9615..0000000000
--- a/tests/ImageSharp.Tests/Processors/Filters/BoxBlurTest.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// Copyright (c) James Jackson-South and contributors.
-// Licensed under the Apache License, Version 2.0.
-//
-
-namespace ImageSharp.Tests
-{
- using System.IO;
-
- using ImageSharp.PixelFormats;
-
- using Xunit;
-
- public class BoxBlurTest : FileTestBase
- {
- public static readonly TheoryData BoxBlurValues
- = new TheoryData
- {
- 3 ,
- 5 ,
- };
-
- [Theory]
- [MemberData(nameof(BoxBlurValues))]
- public void ImageShouldApplyBoxBlurFilter(int value)
- {
- string path = this.CreateOutputDirectory("BoxBlur");
-
- foreach (TestFile file in Files)
- {
- string filename = file.GetFileName(value);
- using (Image image = file.CreateImage())
- using (FileStream output = File.OpenWrite($"{path}/{filename}"))
- {
- image.BoxBlur(value).Save(output);
- }
- }
- }
-
- [Theory]
- [MemberData(nameof(BoxBlurValues))]
- public void ImageShouldApplyBoxBlurFilterInBox(int value)
- {
- string path = this.CreateOutputDirectory("BoxBlur");
-
- foreach (TestFile file in Files)
- {
- string filename = file.GetFileName(value + "-InBox");
- using (Image image = file.CreateImage())
- using (FileStream output = File.OpenWrite($"{path}/{filename}"))
- {
- image.BoxBlur(value, new Rectangle(10, 10, image.Width / 2, image.Height / 2)).Save(output);
- }
- }
- }
- }
-}
\ No newline at end of file