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
parent
commit
1d5960f4fa
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs
  2. 2
      tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs
  3. 21
      tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs

2
tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.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);

2
tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs

@ -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);
}

21
tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs

@ -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,

Loading…
Cancel
Save