From b8519bf0c06e40aeeee8803634e13c3119a739eb Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Fri, 11 May 2018 01:25:03 +0200 Subject: [PATCH] use FormattableString instead of string in tests --- .../Processors/Transforms/ResizeTests.cs | 2 +- .../Transforms/ProjectiveTransformTests.cs | 2 +- .../TestUtilities/TestImageExtensions.cs | 21 +++++++++++++++++++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs index 7214fa5e5..84da154db 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs +++ b/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); diff --git a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs b/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs index 305357201..ece3f1742 100644 --- a/tests/ImageSharp.Tests/Processing/Transforms/ProjectiveTransformTests.cs +++ b/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); } diff --git a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs index 99c696f29..34c93a7c1 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs @@ -269,6 +269,27 @@ namespace SixLabors.ImageSharp.Tests return image; } + public static Image CompareFirstFrameToReferenceOutput( + this Image image, + ImageComparer comparer, + ITestImageProvider provider, + FormattableString testOutputDetails, + string extension = "png", + bool grayscale = false, + bool appendPixelTypeToFileName = true, + bool appendSourceFileOrDescription = true) + where TPixel : struct, IPixel + { + return image.CompareFirstFrameToReferenceOutput( + comparer, + provider, + (object)testOutputDetails, + extension, + grayscale, + appendPixelTypeToFileName, + appendSourceFileOrDescription); + } + public static Image CompareFirstFrameToReferenceOutput( this Image image, ImageComparer comparer,