|
|
@ -90,7 +90,6 @@ namespace SixLabors.ImageSharp.Tests |
|
|
/// <param name="extension">The extension</param>
|
|
|
/// <param name="extension">The extension</param>
|
|
|
/// <param name="grayscale">A boolean indicating whether we should debug save + compare against a grayscale image, smaller in size.</param>
|
|
|
/// <param name="grayscale">A boolean indicating whether we should debug save + compare against a grayscale image, smaller in size.</param>
|
|
|
/// <param name="appendPixelTypeToFileName">A boolean indicating whether to append the pixel type to the output file name.</param>
|
|
|
/// <param name="appendPixelTypeToFileName">A boolean indicating whether to append the pixel type to the output file name.</param>
|
|
|
/// <param name="decoder">Custom decoder</param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
/// <returns></returns>
|
|
|
public static Image<TPixel> CompareToReferenceOutput<TPixel>( |
|
|
public static Image<TPixel> CompareToReferenceOutput<TPixel>( |
|
|
this Image<TPixel> image, |
|
|
this Image<TPixel> image, |
|
|
@ -99,16 +98,14 @@ namespace SixLabors.ImageSharp.Tests |
|
|
object testOutputDetails = null, |
|
|
object testOutputDetails = null, |
|
|
string extension = "png", |
|
|
string extension = "png", |
|
|
bool grayscale = false, |
|
|
bool grayscale = false, |
|
|
bool appendPixelTypeToFileName = true, |
|
|
bool appendPixelTypeToFileName = true) |
|
|
IImageDecoder decoder = null) |
|
|
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
{ |
|
|
{ |
|
|
using (Image<TPixel> referenceImage = GetReferenceOutputImage<TPixel>( |
|
|
using (Image<TPixel> referenceImage = GetReferenceOutputImage<TPixel>( |
|
|
provider, |
|
|
provider, |
|
|
testOutputDetails, |
|
|
testOutputDetails, |
|
|
extension, |
|
|
extension, |
|
|
appendPixelTypeToFileName, |
|
|
appendPixelTypeToFileName)) |
|
|
decoder)) |
|
|
|
|
|
{ |
|
|
{ |
|
|
comparer.VerifySimilarity(referenceImage, image); |
|
|
comparer.VerifySimilarity(referenceImage, image); |
|
|
} |
|
|
} |
|
|
@ -119,8 +116,7 @@ namespace SixLabors.ImageSharp.Tests |
|
|
public static Image<TPixel> GetReferenceOutputImage<TPixel>(this ITestImageProvider provider, |
|
|
public static Image<TPixel> GetReferenceOutputImage<TPixel>(this ITestImageProvider provider, |
|
|
object testOutputDetails = null, |
|
|
object testOutputDetails = null, |
|
|
string extension = "png", |
|
|
string extension = "png", |
|
|
bool appendPixelTypeToFileName = true, |
|
|
bool appendPixelTypeToFileName = true) |
|
|
IImageDecoder decoder = null) |
|
|
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
{ |
|
|
{ |
|
|
string referenceOutputFile = provider.Utility.GetReferenceOutputFileName(extension, testOutputDetails, appendPixelTypeToFileName); |
|
|
string referenceOutputFile = provider.Utility.GetReferenceOutputFileName(extension, testOutputDetails, appendPixelTypeToFileName); |
|
|
@ -130,7 +126,7 @@ namespace SixLabors.ImageSharp.Tests |
|
|
throw new Exception("Reference output file missing: " + referenceOutputFile); |
|
|
throw new Exception("Reference output file missing: " + referenceOutputFile); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
decoder = decoder ?? TestEnvironment.GetReferenceDecoder(referenceOutputFile); |
|
|
IImageDecoder decoder = TestEnvironment.GetReferenceDecoder(referenceOutputFile); |
|
|
|
|
|
|
|
|
return Image.Load<TPixel>(referenceOutputFile, decoder); |
|
|
return Image.Load<TPixel>(referenceOutputFile, decoder); |
|
|
} |
|
|
} |
|
|
@ -141,15 +137,13 @@ namespace SixLabors.ImageSharp.Tests |
|
|
ImageComparer comparer, |
|
|
ImageComparer comparer, |
|
|
object testOutputDetails = null, |
|
|
object testOutputDetails = null, |
|
|
string extension = "png", |
|
|
string extension = "png", |
|
|
bool appendPixelTypeToFileName = true, |
|
|
bool appendPixelTypeToFileName = true) |
|
|
IImageDecoder decoder = null) |
|
|
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
{ |
|
|
{ |
|
|
using (Image<TPixel> referenceImage = provider.GetReferenceOutputImage<TPixel>( |
|
|
using (Image<TPixel> referenceImage = provider.GetReferenceOutputImage<TPixel>( |
|
|
testOutputDetails, |
|
|
testOutputDetails, |
|
|
extension, |
|
|
extension, |
|
|
appendPixelTypeToFileName, |
|
|
appendPixelTypeToFileName)) |
|
|
decoder)) |
|
|
|
|
|
{ |
|
|
{ |
|
|
return comparer.CompareImages(referenceImage, image); |
|
|
return comparer.CompareImages(referenceImage, image); |
|
|
} |
|
|
} |
|
|
|