diff --git a/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs
index d4e8534a7..924903039 100644
--- a/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Png/PngSmokeTests.cs
@@ -32,7 +32,7 @@ namespace ImageSharp.Tests.Formats.Png
using (Image img2 = new Image(ms, new Configuration(new PngFormat())))
{
// img2.Save(provider.Utility.GetTestOutputFileName("bmp", "_loaded"), new BmpEncoder());
- ImageComparer.VisualComparer(image, img2);
+ ImageComparer.CheckSimilarity(image, img2);
}
}
}
@@ -53,7 +53,7 @@ namespace ImageSharp.Tests.Formats.Png
using (Image img2 = new Image(ms, new Configuration(new PngFormat())))
{
// img2.Save(provider.Utility.GetTestOutputFileName("bmp", "_loaded"), new BmpEncoder());
- ImageComparer.VisualComparer(image, img2);
+ ImageComparer.CheckSimilarity(image, img2);
}
}
}
@@ -75,7 +75,7 @@ namespace ImageSharp.Tests.Formats.Png
ms.Position = 0;
using (Image img2 = new Image(ms, new Configuration(new PngFormat())))
{
- ImageComparer.VisualComparer(image, img2);
+ ImageComparer.CheckSimilarity(image, img2);
}
}
}
diff --git a/tests/ImageSharp.Tests/ImageComparer.cs b/tests/ImageSharp.Tests/ImageComparer.cs
index 0462506a6..41b884dd4 100644
--- a/tests/ImageSharp.Tests/ImageComparer.cs
+++ b/tests/ImageSharp.Tests/ImageComparer.cs
@@ -32,7 +32,7 @@
/// This is a sampling factor we sample a grid of average pixels width by high
/// The default undefined value is
///
- public static void VisualComparer(Image expected, Image actual, float imageTheshold = DefaultImageThreshold, byte segmentThreshold = DefaultSegmentThreshold, int scalingFactor = DefaultScalingFactor)
+ public static void CheckSimilarity(Image expected, Image actual, float imageTheshold = DefaultImageThreshold, byte segmentThreshold = DefaultSegmentThreshold, int scalingFactor = DefaultScalingFactor)
where TColorA : struct, IPixel
where TColorB : struct, IPixel
{
diff --git a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs
index 7e4401635..89f46a947 100644
--- a/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs
+++ b/tests/ImageSharp.Tests/TestUtilities/ImageProviders/TestPatternProvider.cs
@@ -12,6 +12,11 @@ namespace ImageSharp.Tests
public abstract partial class TestImageProvider
where TColor : struct, IPixel
{
+
+ ///
+ /// A test image provider that produces test patterns.
+ ///
+ ///
private class TestPatternProvider : TestImageProvider
{
static Dictionary> testImages = new Dictionary>();
@@ -43,19 +48,26 @@ namespace ImageSharp.Tests
}
}
+ ///
+ /// Draws the test pattern on an image by drawing 4 other patterns in the for quadrants of the image.
+ ///
+ ///
private static void DrawTestPattern(Image image)
{
// first lets split the image into 4 quadrants
using (PixelAccessor pixels = image.Lock())
{
BlackWhiteChecker(pixels); // top left
- HorizontalLines(pixels); // top right
+ VirticalBars(pixels); // top right
TransparentGradients(pixels); // bottom left
- Raninbow(pixels); // bottom right
+ Rainbow(pixels); // bottom right
}
}
-
- private static void HorizontalLines(PixelAccessor pixels)
+ ///
+ /// Fills the top right quadrant with alternating solid vertical bars.
+ ///
+ ///
+ private static void VirticalBars(PixelAccessor pixels)
{
// topLeft
int left = pixels.Width / 2;
@@ -82,6 +94,10 @@ namespace ImageSharp.Tests
}
}
+ ///
+ /// fills the top left quadrant with a black and white checker board.
+ ///
+ ///
private static void BlackWhiteChecker(PixelAccessor pixels)
{
// topLeft
@@ -116,7 +132,11 @@ namespace ImageSharp.Tests
p = pstart;
}
}
-
+
+ ///
+ /// Fills the bottom left quadrent with 3 horizental bars in Red, Green and Blue with a alpha gradient from left (transparent) to right (solid).
+ ///
+ ///
private static void TransparentGradients(PixelAccessor pixels)
{
// topLeft
@@ -155,9 +175,14 @@ namespace ImageSharp.Tests
pixels[x, y] = c;
}
}
-
}
- private static void Raninbow(PixelAccessor pixels)
+
+ ///
+ /// Fills the bottom right quadrant with all the colors producable by converting itterating over a uint and unpacking it.
+ /// A better algorithm could be used but it works
+ ///
+ ///
+ private static void Rainbow(PixelAccessor pixels)
{
int left = pixels.Width / 2;
int right = pixels.Width;