diff --git a/tests/ImageProcessorCore.Benchmarks/Samplers/Resize.cs b/tests/ImageProcessorCore.Benchmarks/Samplers/Resize.cs index 1312a91ad3..cbf972184d 100644 --- a/tests/ImageProcessorCore.Benchmarks/Samplers/Resize.cs +++ b/tests/ImageProcessorCore.Benchmarks/Samplers/Resize.cs @@ -38,7 +38,7 @@ } [Benchmark(Description = "ImageProcessorCore Compand Resize")] - public CoreSize ResizeCore() + public CoreSize ResizeCoreCompand() { CoreImage image = new CoreImage(2000, 2000); image.Resize(400, 400, true); diff --git a/tests/ImageProcessorCore.Tests/Processors/Samplers/ResizeTests.cs b/tests/ImageProcessorCore.Tests/Processors/Samplers/ResizeTests.cs index cdf5ae8b90..c905fb51ce 100644 --- a/tests/ImageProcessorCore.Tests/Processors/Samplers/ResizeTests.cs +++ b/tests/ImageProcessorCore.Tests/Processors/Samplers/ResizeTests.cs @@ -58,10 +58,11 @@ namespace ImageProcessorCore.Tests } } - [Fact] - public void ImageShouldResizeWidthAndKeepAspect() + [Theory] + [MemberData("ReSamplers")] + public void ImageShouldResizeWidthAndKeepAspect(string name, IResampler sampler) { - const string name = "FixedWidth"; + name = name + "-FixedWidth"; if (!Directory.Exists(path)) { @@ -77,17 +78,18 @@ namespace ImageProcessorCore.Tests Image image = new Image(stream); using (FileStream output = File.OpenWrite($"{path}/{filename}")) { - image.Resize(image.Width / 3, 0, new TriangleResampler(), false, this.ProgressUpdate) + image.Resize(image.Width / 3, 0, sampler, false, this.ProgressUpdate) .Save(output); } } } } - [Fact] - public void ImageShouldResizeHeightAndKeepAspect() + [Theory] + [MemberData("ReSamplers")] + public void ImageShouldResizeHeightAndKeepAspect(string name, IResampler sampler) { - const string name = "FixedHeight"; + name = name + "-FixedHeight"; if (!Directory.Exists(path)) { @@ -103,17 +105,18 @@ namespace ImageProcessorCore.Tests Image image = new Image(stream); using (FileStream output = File.OpenWrite($"{path}/{filename}")) { - image.Resize(0, image.Height / 3, new TriangleResampler(), false, this.ProgressUpdate) + image.Resize(0, image.Height / 3, sampler, false, this.ProgressUpdate) .Save(output); } } } } - [Fact] - public void ImageShouldResizeWithCropMode() + [Theory] + [MemberData("ReSamplers")] + public void ImageShouldResizeWithCropMode(string name, IResampler sampler) { - const string name = "Crop"; + name = name + "-Crop"; if (!Directory.Exists(path)) { @@ -131,6 +134,7 @@ namespace ImageProcessorCore.Tests { ResizeOptions options = new ResizeOptions() { + Sampler = sampler, Size = new Size(image.Width / 2, image.Height) }; @@ -141,10 +145,11 @@ namespace ImageProcessorCore.Tests } } - [Fact] - public void ImageShouldResizeWithPadMode() + [Theory] + [MemberData("ReSamplers")] + public void ImageShouldResizeWithPadMode(string name, IResampler sampler) { - const string name = "Pad"; + name = name + "-Pad"; if (!Directory.Exists(path)) { @@ -173,10 +178,11 @@ namespace ImageProcessorCore.Tests } } - [Fact] - public void ImageShouldResizeWithBoxPadMode() + [Theory] + [MemberData("ReSamplers")] + public void ImageShouldResizeWithBoxPadMode(string name, IResampler sampler) { - const string name = "BoxPad"; + name = name + "-BoxPad"; if (!Directory.Exists(path)) { @@ -194,6 +200,7 @@ namespace ImageProcessorCore.Tests { ResizeOptions options = new ResizeOptions() { + Sampler = sampler, Size = new Size(image.Width + 200, image.Height + 200), Mode = ResizeMode.BoxPad }; @@ -205,10 +212,11 @@ namespace ImageProcessorCore.Tests } } - [Fact] - public void ImageShouldResizeWithMaxMode() + [Theory] + [MemberData("ReSamplers")] + public void ImageShouldResizeWithMaxMode(string name, IResampler sampler) { - const string name = "Max"; + name = name + "Max"; if (!Directory.Exists(path)) { @@ -226,6 +234,7 @@ namespace ImageProcessorCore.Tests { ResizeOptions options = new ResizeOptions() { + Sampler = sampler, Size = new Size(300, 300), Mode = ResizeMode.Max }; @@ -237,10 +246,11 @@ namespace ImageProcessorCore.Tests } } - [Fact] - public void ImageShouldResizeWithMinMode() + [Theory] + [MemberData("ReSamplers")] + public void ImageShouldResizeWithMinMode(string name, IResampler sampler) { - const string name = "Min"; + name = name + "-Min"; if (!Directory.Exists(path)) { @@ -258,6 +268,7 @@ namespace ImageProcessorCore.Tests { ResizeOptions options = new ResizeOptions() { + Sampler = sampler, Size = new Size(image.Width - 50, image.Height - 25), Mode = ResizeMode.Min }; @@ -269,10 +280,11 @@ namespace ImageProcessorCore.Tests } } - [Fact] - public void ImageShouldResizeWithStretchMode() + [Theory] + [MemberData("ReSamplers")] + public void ImageShouldResizeWithStretchMode(string name, IResampler sampler) { - const string name = "Stretch"; + name = name + "Stretch"; if (!Directory.Exists(path)) { @@ -290,6 +302,7 @@ namespace ImageProcessorCore.Tests { ResizeOptions options = new ResizeOptions() { + Sampler = sampler, Size = new Size(image.Width - 200, image.Height), Mode = ResizeMode.Stretch };