diff --git a/tests/ImageSharp.Tests/Processing/Effects/InvertTest.cs b/tests/ImageSharp.Tests/Processing/Effects/InvertTest.cs
new file mode 100644
index 000000000..af2ac1edb
--- /dev/null
+++ b/tests/ImageSharp.Tests/Processing/Effects/InvertTest.cs
@@ -0,0 +1,46 @@
+//
+// Copyright (c) James Jackson-South and contributors.
+// Licensed under the Apache License, Version 2.0.
+//
+
+namespace ImageSharp.Tests.Processing.Effects
+{
+ using ImageSharp.PixelFormats;
+
+ using Xunit;
+
+ public class InvertTest : FileTestBase
+ {
+ [Theory]
+ [WithFileCollection(nameof(DefaultFiles), StandardPixelType)]
+ public void ImageShouldApplyInvertFilter(TestImageProvider provider)
+ where TPixel : struct, IPixel
+ {
+ using (Image image = provider.GetImage())
+ {
+ image.Invert()
+ .DebugSave(provider, null, Extensions.Bmp);
+ }
+ }
+
+ [Theory]
+ [WithFileCollection(nameof(DefaultFiles), StandardPixelType)]
+ public void ImageShouldApplyInvertFilterInBox(TestImageProvider provider)
+ 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.Invert(bounds)
+ .DebugSave(provider, null, 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/Processing/Effects/PixelateTest.cs b/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs
new file mode 100644
index 000000000..d52b7a290
--- /dev/null
+++ b/tests/ImageSharp.Tests/Processing/Effects/PixelateTest.cs
@@ -0,0 +1,82 @@
+//
+// Copyright (c) James Jackson-South and contributors.
+// Licensed under the Apache License, Version 2.0.
+//
+
+namespace ImageSharp.Tests.Processing.Effects
+{
+ using ImageSharp.PixelFormats;
+
+ using Xunit;
+
+ public class PixelateTest : FileTestBase
+ {
+ public static readonly TheoryData PixelateValues
+ = new TheoryData
+ {
+ 4 ,
+ 8
+ };
+
+ [Theory]
+ [WithTestPatternImages(nameof(PixelateValues), 320, 240, PixelTypes.StandardImageClass)]
+ public void ImageShouldApplyPixelateFilter(TestImageProvider provider, int value)
+ where TPixel : struct, IPixel
+ {
+ using (Image image = provider.GetImage())
+ {
+ image.Pixelate(value)
+ .DebugSave(provider, value, Extensions.Bmp);
+
+ // Test the neigbouring pixels
+ for (int y = 0; y < image.Height; y += value)
+ {
+ for (int x = 0; x < image.Width; x += value)
+ {
+ TPixel source = image[x, y];
+ for (int pixY = y; pixY < y + value && pixY < image.Height; pixY++)
+ {
+ for (int pixX = x; pixX < x + value && pixX < image.Width; pixX++)
+ {
+ Assert.Equal(source, image[pixX, pixY]);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ [Theory]
+ [WithTestPatternImages(nameof(PixelateValues), 320, 240, PixelTypes.StandardImageClass)]
+ public void ImageShouldApplyPixelateFilterInBox(TestImageProvider provider, int value)
+ where TPixel : struct, IPixel
+ {
+ using (Image source = provider.GetImage())
+ using (var image = new Image(source))
+ {
+ var bounds = new Rectangle(image.Width / 4, image.Height / 4, image.Width / 2, image.Height / 2);
+
+ image.Pixelate(value, bounds)
+ .DebugSave(provider, value, Extensions.Bmp);
+
+ for (int y = 0; y < image.Height; y++)
+ {
+ for (int x = 0; x < image.Width; x++)
+ {
+ int tx = x;
+ int ty = y;
+ TPixel sourceColor = source[tx, ty];
+ if (bounds.Contains(tx, ty))
+ {
+ int sourceX = tx - ((tx - bounds.Left) % value) + (value / 2);
+ int sourceY = ty - ((ty - bounds.Top) % value) + (value / 2);
+
+ sourceColor = image[sourceX, sourceY];
+ }
+ Assert.Equal(sourceColor, image[tx, ty]);
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Processors/Filters/InvertTest.cs b/tests/ImageSharp.Tests/Processors/Filters/InvertTest.cs
deleted file mode 100644
index 6d375d09a..000000000
--- a/tests/ImageSharp.Tests/Processors/Filters/InvertTest.cs
+++ /dev/null
@@ -1,46 +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 InvertTest : FileTestBase
- {
- [Fact]
- public void ImageShouldApplyInvertFilter()
- {
- string path = this.CreateOutputDirectory("Invert");
- foreach (TestFile file in Files)
- {
- using (Image image = file.CreateImage())
- using (FileStream output = File.OpenWrite($"{path}/{file.FileName}"))
- {
- image.Invert().Save(output);
- }
- }
- }
-
- [Fact]
- public void ImageShouldApplyInvertFilterInBox()
- {
- string path = this.CreateOutputDirectory("Invert");
-
- foreach (TestFile file in Files)
- {
- string filename = file.GetFileName("InBox");
- using (Image image = file.CreateImage())
- using (FileStream output = File.OpenWrite($"{path}/{filename}"))
- {
- image.Invert(new Rectangle(10, 10, image.Width / 2, image.Height / 2)).Save(output);
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Processors/Filters/PixelateTest.cs b/tests/ImageSharp.Tests/Processors/Filters/PixelateTest.cs
deleted file mode 100644
index b21a8c969..000000000
--- a/tests/ImageSharp.Tests/Processors/Filters/PixelateTest.cs
+++ /dev/null
@@ -1,94 +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 PixelateTest
- {
- public static readonly TheoryData PixelateValues
- = new TheoryData
- {
- 4 ,
- 8
- };
-
- [Theory]
- [WithTestPatternImages(nameof(PixelateValues), 320, 240, PixelTypes.StandardImageClass)]
- public void ImageShouldApplyPixelateFilter(TestImageProvider provider, int value)
- where TPixel : struct, IPixel
- {
- using (Image image = provider.GetImage())
- {
- image.Pixelate(value)
- .DebugSave(provider, new
- {
- size = value
- });
-
- using (PixelAccessor pixels = image.Lock())
- {
- for (int y = 0; y < pixels.Height; y += value)
- {
- for (int x = 0; x < pixels.Width; x += value)
- {
- TPixel source = pixels[x, y];
- for (int pixY = y; pixY < y + value && pixY < pixels.Height; pixY++)
- {
- for (int pixX = x; pixX < x + value && pixX < pixels.Width; pixX++)
- {
- Assert.Equal(source, pixels[pixX, pixY]);
- }
- }
- }
- }
- }
- }
- }
-
- [Theory]
- [WithTestPatternImages(nameof(PixelateValues), 320, 240, PixelTypes.StandardImageClass)]
- public void ImageShouldApplyPixelateFilterInBox(TestImageProvider provider, int value)
- where TPixel : struct, IPixel
- {
- using (Image source = provider.GetImage())
- using (Image image = new Image(source))
- {
- Rectangle rect = new Rectangle(image.Width/4, image.Height / 4, image.Width / 2, image.Height / 2);
-
- image.Pixelate(value, rect)
- .DebugSave(provider, new
- {
- size = value
- });
-
- using (PixelAccessor pixels = image.Lock())
- using (PixelAccessor sourcePixels = source.Lock())
- {
- for (int y = 0; y < pixels.Height; y++)
- {
- for (int x = 0; x < pixels.Width; x++)
- {
- var tx = x;
- var ty = y;
- TPixel sourceColor = sourcePixels[tx, ty];
- if (rect.Contains(tx, ty))
- {
- var sourceX = tx - ((tx - rect.Left) % value) + (value / 2);
- var sourceY = ty - ((ty - rect.Top) % value) + (value / 2);
-
- sourceColor = pixels[sourceX, sourceY];
- }
- Assert.Equal(sourceColor, pixels[tx, ty]);
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file