|
|
@ -12,11 +12,14 @@ using Xunit; |
|
|
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
{ |
|
|
{ |
|
|
using SixLabors.ImageSharp.Processing.Transforms; |
|
|
using SixLabors.ImageSharp.Processing.Transforms; |
|
|
|
|
|
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison; |
|
|
|
|
|
|
|
|
public class ResizeTests : FileTestBase |
|
|
public class ResizeTests : FileTestBase |
|
|
{ |
|
|
{ |
|
|
public static readonly string[] CommonTestImages = { TestImages.Png.CalliphoraPartial }; |
|
|
public static readonly string[] CommonTestImages = { TestImages.Png.CalliphoraPartial }; |
|
|
|
|
|
|
|
|
|
|
|
private static readonly ImageComparer ResizeValidatorComparer = ImageComparer.Tolerant(0.01f / 100); |
|
|
|
|
|
|
|
|
public static readonly TheoryData<string, IResampler> AllReSamplers = |
|
|
public static readonly TheoryData<string, IResampler> AllReSamplers = |
|
|
new TheoryData<string, IResampler> |
|
|
new TheoryData<string, IResampler> |
|
|
{ |
|
|
{ |
|
|
@ -50,7 +53,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
string details = $"{name}-{ratio.ToString(System.Globalization.CultureInfo.InvariantCulture)}"; |
|
|
string details = $"{name}-{ratio.ToString(System.Globalization.CultureInfo.InvariantCulture)}"; |
|
|
|
|
|
|
|
|
image.DebugSave(provider, details); |
|
|
image.DebugSave(provider, details); |
|
|
image.CompareToReferenceOutput(provider, details); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider, details); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -64,7 +67,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(image.Size() / 2, true)); |
|
|
image.Mutate(x => x.Resize(image.Size() / 2, true)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -78,7 +81,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(image.Width / 2, image.Height / 2, true)); |
|
|
image.Mutate(x => x.Resize(image.Width / 2, image.Height / 2, true)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -91,7 +94,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
{ |
|
|
{ |
|
|
image.Mutate(x => x.Resize(image.Width / 2, image.Height / 2)); |
|
|
image.Mutate(x => x.Resize(image.Width / 2, image.Height / 2)); |
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -122,7 +125,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(image.Width, image.Height, KnownResamplers.Bicubic, sourceRectangle, destRectangle, false)); |
|
|
image.Mutate(x => x.Resize(image.Width, image.Height, KnownResamplers.Bicubic, sourceRectangle, destRectangle, false)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -136,7 +139,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(image.Width / 3, 0, false)); |
|
|
image.Mutate(x => x.Resize(image.Width / 3, 0, false)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -150,7 +153,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(0, image.Height / 3, false)); |
|
|
image.Mutate(x => x.Resize(0, image.Height / 3, false)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -169,7 +172,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -188,7 +191,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -208,7 +211,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -228,7 +231,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -248,7 +251,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -268,7 +271,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -288,7 +291,7 @@ namespace SixLabors.ImageSharp.Tests.Processing.Processors.Transforms |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
image.Mutate(x => x.Resize(options)); |
|
|
|
|
|
|
|
|
image.DebugSave(provider); |
|
|
image.DebugSave(provider); |
|
|
image.CompareToReferenceOutput(provider); |
|
|
image.CompareToReferenceOutput(ResizeValidatorComparer, provider); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|