@ -52,6 +52,23 @@ namespace SixLabors.ImageSharp.Tests
} ) ;
}
public static Image < TPixel > DebugSave < TPixel > (
this Image < TPixel > image ,
ITestImageProvider provider ,
FormattableString testOutputDetails ,
string extension = "png" ,
bool appendPixelTypeToFileName = true ,
bool appendSourceFileOrDescription = true )
where TPixel : struct , IPixel < TPixel >
{
return image . DebugSave (
provider ,
( object ) testOutputDetails ,
extension ,
appendPixelTypeToFileName ,
appendSourceFileOrDescription ) ;
}
/// <summary>
/// Saves the image only when not running in the CI server.
/// </summary>
@ -86,6 +103,17 @@ namespace SixLabors.ImageSharp.Tests
return image ;
}
public static Image < TPixel > DebugSave < TPixel > (
this Image < TPixel > image ,
ITestImageProvider provider ,
IImageEncoder encoder ,
FormattableString testOutputDetails ,
bool appendPixelTypeToFileName = true )
where TPixel : struct , IPixel < TPixel >
{
return image . DebugSave ( provider , encoder , ( object ) testOutputDetails , appendPixelTypeToFileName ) ;
}
/// <summary>
/// Saves the image only when not running in the CI server.
/// </summary>
@ -139,6 +167,23 @@ namespace SixLabors.ImageSharp.Tests
return image ;
}
public static Image < TPixel > CompareToReferenceOutput < TPixel > (
this Image < TPixel > image ,
ITestImageProvider provider ,
FormattableString testOutputDetails ,
string extension = "png" ,
bool grayscale = false ,
bool appendPixelTypeToFileName = true )
where TPixel : struct , IPixel < TPixel >
{
return image . CompareToReferenceOutput (
provider ,
( object ) testOutputDetails ,
extension ,
grayscale ,
appendPixelTypeToFileName ) ;
}
/// <summary>
/// Compares the image against the expected Reference output, throws an exception if the images are not similar enough.
/// The output file should be named identically to the output produced by <see cref="DebugSave{TPixel}(Image{TPixel}, ITestImageProvider, object, string, bool)"/>.
@ -150,7 +195,6 @@ namespace SixLabors.ImageSharp.Tests
/// <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="appendPixelTypeToFileName">A boolean indicating whether to append the pixel type to the output file name.</param>
/// <param name="comparer">A custom <see cref="ImageComparer"/> for the verification</param>
/// <returns></returns>
public static Image < TPixel > CompareToReferenceOutput < TPixel > (
this Image < TPixel > image ,
@ -171,6 +215,25 @@ namespace SixLabors.ImageSharp.Tests
appendPixelTypeToFileName ) ;
}
public static Image < TPixel > CompareToReferenceOutput < TPixel > (
this Image < TPixel > image ,
ImageComparer comparer ,
ITestImageProvider provider ,
FormattableString testOutputDetails ,
string extension = "png" ,
bool grayscale = false ,
bool appendPixelTypeToFileName = true )
where TPixel : struct , IPixel < TPixel >
{
return image . CompareToReferenceOutput (
comparer ,
provider ,
( object ) testOutputDetails ,
extension ,
grayscale ,
appendPixelTypeToFileName ) ;
}
/// <summary>
/// Compares the image against the expected Reference output, throws an exception if the images are not similar enough.
/// The output file should be named identically to the output produced by <see cref="DebugSave{TPixel}(Image{TPixel}, ITestImageProvider, object, string, bool)"/>.