Skip to content

Commit 5012861

Browse files
authored
Merge pull request #570 from SixLabors/af/test-filename-formatting-2
Use FormattableString instead of string in tests
2 parents 597f02f + 6d94fd8 commit 5012861

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void Resize_WorksWithAllResamplers<TPixel>(TestImageProvider<TPixel> prov
4949
{
5050
SizeF newSize = image.Size() * ratio;
5151
image.Mutate(x => x.Resize((Size)newSize, sampler, false));
52-
string details = $"{name}-{ratio.ToString(System.Globalization.CultureInfo.InvariantCulture)}";
52+
FormattableString details = $"{name}-{ratio.ToString(System.Globalization.CultureInfo.InvariantCulture)}";
5353

5454
image.DebugSave(provider, details);
5555
image.CompareToReferenceOutput(ImageComparer.TolerantPercentage(0.005f), provider, details);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public void Transform_WithTaperMatrix<TPixel>(TestImageProvider<TPixel> provider
9494
Matrix4x4 m = ProjectiveTransformHelper.CreateTaperMatrix(image.Size(), taperSide, taperCorner, .5F);
9595
image.Mutate(i => { i.Transform(m); });
9696

97-
string testOutputDetails = $"{taperSide}-{taperCorner}";
97+
FormattableString testOutputDetails = $"{taperSide}-{taperCorner}";
9898
image.DebugSave(provider, testOutputDetails);
9999
image.CompareFirstFrameToReferenceOutput(TolerantComparer, provider, testOutputDetails);
100100
}

tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,27 @@ public static Image<TPixel> CompareToReferenceOutput<TPixel>(
269269
return image;
270270
}
271271

272+
public static Image<TPixel> CompareFirstFrameToReferenceOutput<TPixel>(
273+
this Image<TPixel> image,
274+
ImageComparer comparer,
275+
ITestImageProvider provider,
276+
FormattableString testOutputDetails,
277+
string extension = "png",
278+
bool grayscale = false,
279+
bool appendPixelTypeToFileName = true,
280+
bool appendSourceFileOrDescription = true)
281+
where TPixel : struct, IPixel<TPixel>
282+
{
283+
return image.CompareFirstFrameToReferenceOutput(
284+
comparer,
285+
provider,
286+
(object)testOutputDetails,
287+
extension,
288+
grayscale,
289+
appendPixelTypeToFileName,
290+
appendSourceFileOrDescription);
291+
}
292+
272293
public static Image<TPixel> CompareFirstFrameToReferenceOutput<TPixel>(
273294
this Image<TPixel> image,
274295
ImageComparer comparer,

0 commit comments

Comments
 (0)