Browse Source
Merge pull request #570 from SixLabors/af/test-filename-formatting-2
Use FormattableString instead of string in tests
af/merge-core
Anton Firsov
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
23 additions and
2 deletions
-
tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs
-
tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs
-
tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs
|
|
|
@ -49,7 +49,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
|
{ |
|
|
|
SizeF newSize = image.Size() * ratio; |
|
|
|
image.Mutate(x => x.Resize((Size)newSize, sampler, false)); |
|
|
|
string details = $"{name}-{ratio.ToString(System.Globalization.CultureInfo.InvariantCulture)}"; |
|
|
|
FormattableString details = $"{name}-{ratio.ToString(System.Globalization.CultureInfo.InvariantCulture)}"; |
|
|
|
|
|
|
|
image.DebugSave(provider, details); |
|
|
|
image.CompareToReferenceOutput(ImageComparer.TolerantPercentage(0.005f), provider, details); |
|
|
|
|
|
|
|
@ -94,7 +94,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Transforms |
|
|
|
Matrix4x4 m = ProjectiveTransformHelper.CreateTaperMatrix(image.Size(), taperSide, taperCorner, .5F); |
|
|
|
image.Mutate(i => { i.Transform(m); }); |
|
|
|
|
|
|
|
string testOutputDetails = $"{taperSide}-{taperCorner}"; |
|
|
|
FormattableString testOutputDetails = $"{taperSide}-{taperCorner}"; |
|
|
|
image.DebugSave(provider, testOutputDetails); |
|
|
|
image.CompareFirstFrameToReferenceOutput(TolerantComparer, provider, testOutputDetails); |
|
|
|
} |
|
|
|
|
|
|
|
@ -269,6 +269,27 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
return image; |
|
|
|
} |
|
|
|
|
|
|
|
public static Image<TPixel> CompareFirstFrameToReferenceOutput<TPixel>( |
|
|
|
this Image<TPixel> image, |
|
|
|
ImageComparer comparer, |
|
|
|
ITestImageProvider provider, |
|
|
|
FormattableString testOutputDetails, |
|
|
|
string extension = "png", |
|
|
|
bool grayscale = false, |
|
|
|
bool appendPixelTypeToFileName = true, |
|
|
|
bool appendSourceFileOrDescription = true) |
|
|
|
where TPixel : struct, IPixel<TPixel> |
|
|
|
{ |
|
|
|
return image.CompareFirstFrameToReferenceOutput( |
|
|
|
comparer, |
|
|
|
provider, |
|
|
|
(object)testOutputDetails, |
|
|
|
extension, |
|
|
|
grayscale, |
|
|
|
appendPixelTypeToFileName, |
|
|
|
appendSourceFileOrDescription); |
|
|
|
} |
|
|
|
|
|
|
|
public static Image<TPixel> CompareFirstFrameToReferenceOutput<TPixel>( |
|
|
|
this Image<TPixel> image, |
|
|
|
ImageComparer comparer, |
|
|
|
|