diff --git a/tests/ImageSharp.Tests/FileTestBase.cs b/tests/ImageSharp.Tests/FileTestBase.cs
index 13a94a8b8..933cfa86b 100644
--- a/tests/ImageSharp.Tests/FileTestBase.cs
+++ b/tests/ImageSharp.Tests/FileTestBase.cs
@@ -11,6 +11,7 @@ namespace SixLabors.ImageSharp.Tests
public abstract class FileTestBase : TestBase
{
///
+ /// TODO: We really should not depend on this! Let's use well defined, test-case specific inputs everywhere!
/// A collection made up of one file for each image format
///
public static IEnumerable DefaultFiles =
diff --git a/tests/ImageSharp.Tests/Processing/Binarization/DitherTest.cs b/tests/ImageSharp.Tests/Processing/Binarization/DitherTests.cs
similarity index 100%
rename from tests/ImageSharp.Tests/Processing/Binarization/DitherTest.cs
rename to tests/ImageSharp.Tests/Processing/Binarization/DitherTests.cs
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Binarization/DitherTest.cs b/tests/ImageSharp.Tests/Processing/Processors/Binarization/DitherTest.cs
deleted file mode 100644
index 4b5c8fb09..000000000
--- a/tests/ImageSharp.Tests/Processing/Processors/Binarization/DitherTest.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (c) Six Labors and contributors.
-// Licensed under the Apache License, Version 2.0.
-
-using SixLabors.ImageSharp.Dithering;
-using SixLabors.ImageSharp.Dithering.Ordered;
-using SixLabors.ImageSharp.PixelFormats;
-using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
-
-using SixLabors.Primitives;
-using Xunit;
-
-namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
-{
- public class DitherTest : FileTestBase
- {
- public static readonly TheoryData Ditherers = new TheoryData
- {
- { "Ordered", new Ordered() },
- { "Bayer", new Bayer() }
- };
-
- public static readonly TheoryData ErrorDiffusers = new TheoryData
- {
- { "Atkinson", new Atkinson() },
- { "Burks", new Burks() },
- { "FloydSteinberg", new FloydSteinberg() },
- { "JarvisJudiceNinke", new JarvisJudiceNinke() },
- { "Sierra2", new Sierra2() },
- { "Sierra3", new Sierra3() },
- { "SierraLite", new SierraLite() },
- { "Stucki", new Stucki() },
- };
-
- [Theory]
- [WithFileCollection(nameof(DefaultFiles), nameof(Ditherers), DefaultPixelType)]
- public void ImageShouldApplyDitherFilter(TestImageProvider provider, string name, IOrderedDither ditherer)
- where TPixel : struct, IPixel
- {
- using (Image image = provider.GetImage())
- {
- image.Mutate(x => x.Dither(ditherer));
- image.DebugSave(provider, name);
- }
- }
-
- [Theory]
- [WithFileCollection(nameof(DefaultFiles), nameof(Ditherers), DefaultPixelType)]
- public void ImageShouldApplyDitherFilterInBox(TestImageProvider provider, string name, IOrderedDither ditherer)
- 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.Dither(ditherer, bounds));
- image.DebugSave(provider, name);
-
- ImageComparer.Tolerant().EnsureProcessorChangesAreConstrained(source, image, bounds);
- }
- }
-
- [Theory]
- [WithFileCollection(nameof(DefaultFiles), nameof(ErrorDiffusers), DefaultPixelType)]
- public void ImageShouldApplyDiffusionFilter(TestImageProvider provider, string name, IErrorDiffuser diffuser)
- where TPixel : struct, IPixel
- {
- using (Image image = provider.GetImage())
- {
- image.Mutate(x => x.Dither(diffuser, .5F));
- image.DebugSave(provider, name);
- }
- }
-
- [Theory]
- [WithFileCollection(nameof(DefaultFiles), nameof(ErrorDiffusers), DefaultPixelType)]
- public void ImageShouldApplyDiffusionFilterInBox(TestImageProvider provider, string name, IErrorDiffuser diffuser)
- 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.Dither(diffuser, .5F, bounds));
- image.DebugSave(provider, name);
-
- ImageComparer.Tolerant().EnsureProcessorChangesAreConstrained(source, image, bounds);
- }
- }
- }
-}
\ No newline at end of file
diff --git a/tests/ImageSharp.Tests/Processing/Processors/Binarization/DitherTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Binarization/DitherTests.cs
new file mode 100644
index 000000000..75fd32fc8
--- /dev/null
+++ b/tests/ImageSharp.Tests/Processing/Processors/Binarization/DitherTests.cs
@@ -0,0 +1,132 @@
+// Copyright (c) Six Labors and contributors.
+// Licensed under the Apache License, Version 2.0.
+
+using SixLabors.ImageSharp.Dithering;
+using SixLabors.ImageSharp.Dithering.Ordered;
+using SixLabors.ImageSharp.PixelFormats;
+using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
+
+using SixLabors.Primitives;
+using Xunit;
+// ReSharper disable InconsistentNaming
+
+namespace SixLabors.ImageSharp.Tests.Processing.Processors.Binarization
+{
+ using System.Linq;
+
+ public class DitherTests : FileTestBase
+ {
+ public static readonly string[] CommonTestImages =
+ {
+ TestImages.Png.CalliphoraPartial, TestImages.Png.Bike
+ };
+
+ public static readonly TheoryData Ditherers = new TheoryData
+ {
+ { "Ordered", new Ordered() },
+ { "Bayer", new Bayer() }
+ };
+
+ public static readonly TheoryData ErrorDiffusers = new TheoryData
+ {
+ { "Atkinson", new Atkinson() },
+ { "Burks", new Burks() },
+ { "FloydSteinberg", new FloydSteinberg() },
+ { "JarvisJudiceNinke", new JarvisJudiceNinke() },
+ { "Sierra2", new Sierra2() },
+ { "Sierra3", new Sierra3() },
+ { "SierraLite", new SierraLite() },
+ { "Stucki", new Stucki() },
+ };
+
+
+ private static IOrderedDither DefaultDitherer => new Ordered();
+
+ private static IErrorDiffuser DefaultErrorDiffuser => new Atkinson();
+
+ [Theory]
+ [WithFileCollection(nameof(CommonTestImages), nameof(Ditherers), DefaultPixelType)]
+ [WithTestPatternImages(nameof(Ditherers), 100, 100, DefaultPixelType)]
+ public void DitherFilter_WorksWithAllDitherers(TestImageProvider provider, string name, IOrderedDither ditherer)
+ where TPixel : struct, IPixel
+ {
+ using (Image image = provider.GetImage())
+ {
+ image.Mutate(x => x.Dither(ditherer));
+ image.DebugSave(provider, name);
+ }
+ }
+
+ [Theory]
+ [WithFileCollection(nameof(CommonTestImages), nameof(ErrorDiffusers), DefaultPixelType)]
+ [WithTestPatternImages(nameof(ErrorDiffusers), 100, 100, DefaultPixelType)]
+ public void DiffusionFilter_WorksWithAllErrorDiffusers(TestImageProvider provider, string name, IErrorDiffuser diffuser)
+ where TPixel : struct, IPixel
+ {
+ using (Image image = provider.GetImage())
+ {
+ image.Mutate(x => x.Dither(diffuser, .5F));
+ image.DebugSave(provider, name);
+ }
+ }
+
+ [Theory]
+ [WithFile(TestImages.Png.Bike, CommonNonDefaultPixelTypes)]
+ public void DitherFilter_ShouldNotDependOnSinglePixelType(TestImageProvider provider)
+ where TPixel : struct, IPixel
+ {
+ using (Image image = provider.GetImage())
+ {
+ image.Mutate(x => x.Dither(DefaultDitherer));
+ image.DebugSave(provider);
+ }
+ }
+
+ [Theory]
+ [WithFile(TestImages.Png.Bike, CommonNonDefaultPixelTypes)]
+ public void DiffusionFilter_ShouldNotDependOnSinglePixelType(TestImageProvider provider)
+ where TPixel : struct, IPixel
+ {
+ using (Image image = provider.GetImage())
+ {
+ image.Mutate(x => x.Dither(DefaultErrorDiffuser, 0.5f));
+ image.DebugSave(provider);
+ }
+ }
+
+ [Theory]
+ [WithFile(TestImages.Png.CalliphoraPartial, DefaultPixelType)]
+ public void ApplyDitherFilterInBox(TestImageProvider provider)
+ 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.Dither(DefaultDitherer, bounds));
+ image.DebugSave(provider);
+
+ ImageComparer.Tolerant().EnsureProcessorChangesAreConstrained(source, image, bounds);
+ }
+ }
+
+ // TODO: Does not work because of a bug! Fix it!
+ [Theory(Skip = "TODO: Does not work because of a bug! Fix it!")]
+ [WithFile(TestImages.Png.CalliphoraPartial, DefaultPixelType)]
+ public void ApplyDiffusionFilterInBox(TestImageProvider provider)
+ 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.Dither(DefaultErrorDiffuser, .5F, bounds));
+ image.DebugSave(provider);
+
+ ImageComparer.Tolerant().EnsureProcessorChangesAreConstrained(source, image, bounds);
+ }
+ }
+ }
+}
\ No newline at end of file