From 801e026322dbebab7d769f6fb7054334591a087b Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Fri, 20 Nov 2020 21:44:38 +0000 Subject: [PATCH 1/5] Enable resize tests --- .gitignore | 1 + .../Processing/Processors/Transforms/ResizeTests.cs | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index a89cfcf104..475d6e76b0 100644 --- a/.gitignore +++ b/.gitignore @@ -221,3 +221,4 @@ artifacts/ # Tests **/Images/ActualOutput **/Images/ReferenceOutput +.DS_Store diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs index 47d951837d..f40b8d11a0 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs @@ -355,7 +355,6 @@ public void Resize_WorksWithAllResamplers( } [Theory] - [PlatformSpecific(~TestPlatforms.OSX)] [WithFileCollection(nameof(CommonTestImages), DefaultPixelType)] public void ResizeFromSourceRectangle(TestImageProvider provider) where TPixel : unmanaged, IPixel @@ -438,7 +437,6 @@ public void ResizeWidthCannotKeepAspectKeepsOnePixel(TestImageProvider(TestImageProvider provider) where TPixel : unmanaged, IPixel @@ -549,7 +547,6 @@ public void ResizeWithMinMode(TestImageProvider provider) } [Theory] - [PlatformSpecific(~TestPlatforms.OSX)] [WithFileCollection(nameof(CommonTestImages), DefaultPixelType)] public void ResizeWithPadMode(TestImageProvider provider) where TPixel : unmanaged, IPixel From 2e3f3c1e390df3be2fe547b524fa6ea9200b2d0b Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 21 Nov 2020 00:14:40 +0000 Subject: [PATCH 2/5] Use doubles in ResizeHelper --- .../Transforms/Resize/ResizeHelper.cs | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs index 5ff82a096f..2414305b85 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs @@ -47,12 +47,12 @@ public static (Size, Rectangle) CalculateTargetLocationAndBounds(Size sourceSize const int Min = 1; if (width == 0 && height > 0) { - width = (int)MathF.Max(Min, MathF.Round(sourceSize.Width * height / (float)sourceSize.Height)); + width = (int)Math.Max(Min, Math.Round(sourceSize.Width * height / (double)sourceSize.Height)); } if (height == 0 && width > 0) { - height = (int)MathF.Max(Min, MathF.Round(sourceSize.Height * width / (float)sourceSize.Width)); + height = (int)Math.Max(Min, Math.Round(sourceSize.Height * width / (double)sourceSize.Width)); } switch (options.Mode) @@ -86,11 +86,11 @@ private static (Size, Rectangle) CalculateBoxPadRectangle( int sourceHeight = source.Height; // Fractional variants for preserving aspect ratio. - float percentHeight = MathF.Abs(height / (float)sourceHeight); - float percentWidth = MathF.Abs(width / (float)sourceWidth); + double percentHeight = Math.Abs(height / (double)sourceHeight); + double percentWidth = Math.Abs(width / (double)sourceWidth); - int boxPadHeight = height > 0 ? height : (int)MathF.Round(sourceHeight * percentWidth); - int boxPadWidth = width > 0 ? width : (int)MathF.Round(sourceWidth * percentHeight); + int boxPadHeight = height > 0 ? height : (int)Math.Round(sourceHeight * percentWidth); + int boxPadWidth = width > 0 ? width : (int)Math.Round(sourceWidth * percentHeight); // Only calculate if upscaling. if (sourceWidth < boxPadWidth && sourceHeight < boxPadHeight) @@ -156,7 +156,7 @@ private static (Size, Rectangle) CalculateCropRectangle( int width, int height) { - float ratio; + double ratio; int sourceWidth = source.Width; int sourceHeight = source.Height; @@ -166,8 +166,8 @@ private static (Size, Rectangle) CalculateCropRectangle( int targetHeight = height; // Fractional variants for preserving aspect ratio. - float percentHeight = MathF.Abs(height / (float)sourceHeight); - float percentWidth = MathF.Abs(width / (float)sourceWidth); + double percentHeight = Math.Abs(height / (double)sourceHeight); + double percentWidth = Math.Abs(width / (double)sourceWidth); if (percentHeight < percentWidth) { @@ -175,17 +175,17 @@ private static (Size, Rectangle) CalculateCropRectangle( if (options.CenterCoordinates.HasValue) { - float center = -(ratio * sourceHeight) * options.CenterCoordinates.Value.Y; - targetY = (int)MathF.Round(center + (height / 2F)); + double center = -(ratio * sourceHeight) * options.CenterCoordinates.Value.Y; + targetY = (int)Math.Round(center + (height / 2F)); if (targetY > 0) { targetY = 0; } - if (targetY < (int)MathF.Round(height - (sourceHeight * ratio))) + if (targetY < (int)Math.Round(height - (sourceHeight * ratio))) { - targetY = (int)MathF.Round(height - (sourceHeight * ratio)); + targetY = (int)Math.Round(height - (sourceHeight * ratio)); } } else @@ -200,15 +200,15 @@ private static (Size, Rectangle) CalculateCropRectangle( case AnchorPositionMode.Bottom: case AnchorPositionMode.BottomLeft: case AnchorPositionMode.BottomRight: - targetY = (int)MathF.Round(height - (sourceHeight * ratio)); + targetY = (int)Math.Round(height - (sourceHeight * ratio)); break; default: - targetY = (int)MathF.Round((height - (sourceHeight * ratio)) / 2F); + targetY = (int)Math.Round((height - (sourceHeight * ratio)) / 2F); break; } } - targetHeight = (int)MathF.Ceiling(sourceHeight * percentWidth); + targetHeight = (int)Math.Ceiling(sourceHeight * percentWidth); } else { @@ -216,17 +216,17 @@ private static (Size, Rectangle) CalculateCropRectangle( if (options.CenterCoordinates.HasValue) { - float center = -(ratio * sourceWidth) * options.CenterCoordinates.Value.X; - targetX = (int)MathF.Round(center + (width / 2F)); + double center = -(ratio * sourceWidth) * options.CenterCoordinates.Value.X; + targetX = (int)Math.Round(center + (width / 2F)); if (targetX > 0) { targetX = 0; } - if (targetX < (int)MathF.Round(width - (sourceWidth * ratio))) + if (targetX < (int)Math.Round(width - (sourceWidth * ratio))) { - targetX = (int)MathF.Round(width - (sourceWidth * ratio)); + targetX = (int)Math.Round(width - (sourceWidth * ratio)); } } else @@ -241,15 +241,15 @@ private static (Size, Rectangle) CalculateCropRectangle( case AnchorPositionMode.Right: case AnchorPositionMode.TopRight: case AnchorPositionMode.BottomRight: - targetX = (int)MathF.Round(width - (sourceWidth * ratio)); + targetX = (int)Math.Round(width - (sourceWidth * ratio)); break; default: - targetX = (int)MathF.Round((width - (sourceWidth * ratio)) / 2F); + targetX = (int)Math.Round((width - (sourceWidth * ratio)) / 2F); break; } } - targetWidth = (int)MathF.Ceiling(sourceWidth * percentHeight); + targetWidth = (int)Math.Ceiling(sourceWidth * percentHeight); } // Target image width and height can be different to the rectangle width and height. @@ -265,20 +265,20 @@ private static (Size, Rectangle) CalculateMaxRectangle( int targetHeight = height; // Fractional variants for preserving aspect ratio. - float percentHeight = MathF.Abs(height / (float)source.Height); - float percentWidth = MathF.Abs(width / (float)source.Width); + double percentHeight = Math.Abs(height / (double)source.Height); + double percentWidth = Math.Abs(width / (double)source.Width); - // Integers must be cast to floats to get needed precision - float ratio = height / (float)width; - float sourceRatio = source.Height / (float)source.Width; + // Integers must be cast to doubles to get needed precision + double ratio = height / (double)width; + double sourceRatio = source.Height / (double)source.Width; if (sourceRatio < ratio) { - targetHeight = (int)MathF.Round(source.Height * percentWidth); + targetHeight = (int)Math.Round(source.Height * percentWidth); } else { - targetWidth = (int)MathF.Round(source.Width * percentHeight); + targetWidth = (int)Math.Round(source.Width * percentHeight); } // Replace the size to match the rectangle. @@ -307,25 +307,25 @@ private static (Size, Rectangle) CalculateMinRectangle( if (widthDiff < heightDiff) { - float sourceRatio = (float)sourceHeight / sourceWidth; - targetHeight = (int)MathF.Round(width * sourceRatio); + double sourceRatio = (double)sourceHeight / sourceWidth; + targetHeight = (int)Math.Round(width * sourceRatio); } else if (widthDiff > heightDiff) { - float sourceRatioInverse = (float)sourceWidth / sourceHeight; - targetWidth = (int)MathF.Round(height * sourceRatioInverse); + double sourceRatioInverse = (double)sourceWidth / sourceHeight; + targetWidth = (int)Math.Round(height * sourceRatioInverse); } else { if (height > width) { - float percentWidth = MathF.Abs(width / (float)sourceWidth); - targetHeight = (int)MathF.Round(sourceHeight * percentWidth); + double percentWidth = Math.Abs(width / (double)sourceWidth); + targetHeight = (int)Math.Round(sourceHeight * percentWidth); } else { - float percentHeight = MathF.Abs(height / (float)sourceHeight); - targetWidth = (int)MathF.Round(sourceWidth * percentHeight); + double percentHeight = Math.Abs(height / (double)sourceHeight); + targetWidth = (int)Math.Round(sourceWidth * percentHeight); } } @@ -339,7 +339,7 @@ private static (Size, Rectangle) CalculatePadRectangle( int width, int height) { - float ratio; + double ratio; int sourceWidth = sourceSize.Width; int sourceHeight = sourceSize.Height; @@ -349,13 +349,13 @@ private static (Size, Rectangle) CalculatePadRectangle( int targetHeight = height; // Fractional variants for preserving aspect ratio. - float percentHeight = MathF.Abs(height / (float)sourceHeight); - float percentWidth = MathF.Abs(width / (float)sourceWidth); + double percentHeight = Math.Abs(height / (double)sourceHeight); + double percentWidth = Math.Abs(width / (double)sourceWidth); if (percentHeight < percentWidth) { ratio = percentHeight; - targetWidth = (int)MathF.Round(sourceWidth * percentHeight); + targetWidth = (int)Math.Round(sourceWidth * percentHeight); switch (options.Position) { @@ -367,17 +367,17 @@ private static (Size, Rectangle) CalculatePadRectangle( case AnchorPositionMode.Right: case AnchorPositionMode.TopRight: case AnchorPositionMode.BottomRight: - targetX = (int)MathF.Round(width - (sourceWidth * ratio)); + targetX = (int)Math.Round(width - (sourceWidth * ratio)); break; default: - targetX = (int)MathF.Round((width - (sourceWidth * ratio)) / 2F); + targetX = (int)Math.Round((width - (sourceWidth * ratio)) / 2F); break; } } else { ratio = percentWidth; - targetHeight = (int)MathF.Round(sourceHeight * percentWidth); + targetHeight = (int)Math.Round(sourceHeight * percentWidth); switch (options.Position) { @@ -389,10 +389,10 @@ private static (Size, Rectangle) CalculatePadRectangle( case AnchorPositionMode.Bottom: case AnchorPositionMode.BottomLeft: case AnchorPositionMode.BottomRight: - targetY = (int)MathF.Round(height - (sourceHeight * ratio)); + targetY = (int)Math.Round(height - (sourceHeight * ratio)); break; default: - targetY = (int)MathF.Round((height - (sourceHeight * ratio)) / 2F); + targetY = (int)Math.Round((height - (sourceHeight * ratio)) / 2F); break; } } From 25d5e4818bf507b8b3940a4b58ab76b9a71a89e9 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 21 Nov 2020 00:21:44 +0000 Subject: [PATCH 3/5] Revert "Use doubles in ResizeHelper" This reverts commit 2e3f3c1e390df3be2fe547b524fa6ea9200b2d0b. --- .../Transforms/Resize/ResizeHelper.cs | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs index 2414305b85..5ff82a096f 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeHelper.cs @@ -47,12 +47,12 @@ public static (Size, Rectangle) CalculateTargetLocationAndBounds(Size sourceSize const int Min = 1; if (width == 0 && height > 0) { - width = (int)Math.Max(Min, Math.Round(sourceSize.Width * height / (double)sourceSize.Height)); + width = (int)MathF.Max(Min, MathF.Round(sourceSize.Width * height / (float)sourceSize.Height)); } if (height == 0 && width > 0) { - height = (int)Math.Max(Min, Math.Round(sourceSize.Height * width / (double)sourceSize.Width)); + height = (int)MathF.Max(Min, MathF.Round(sourceSize.Height * width / (float)sourceSize.Width)); } switch (options.Mode) @@ -86,11 +86,11 @@ private static (Size, Rectangle) CalculateBoxPadRectangle( int sourceHeight = source.Height; // Fractional variants for preserving aspect ratio. - double percentHeight = Math.Abs(height / (double)sourceHeight); - double percentWidth = Math.Abs(width / (double)sourceWidth); + float percentHeight = MathF.Abs(height / (float)sourceHeight); + float percentWidth = MathF.Abs(width / (float)sourceWidth); - int boxPadHeight = height > 0 ? height : (int)Math.Round(sourceHeight * percentWidth); - int boxPadWidth = width > 0 ? width : (int)Math.Round(sourceWidth * percentHeight); + int boxPadHeight = height > 0 ? height : (int)MathF.Round(sourceHeight * percentWidth); + int boxPadWidth = width > 0 ? width : (int)MathF.Round(sourceWidth * percentHeight); // Only calculate if upscaling. if (sourceWidth < boxPadWidth && sourceHeight < boxPadHeight) @@ -156,7 +156,7 @@ private static (Size, Rectangle) CalculateCropRectangle( int width, int height) { - double ratio; + float ratio; int sourceWidth = source.Width; int sourceHeight = source.Height; @@ -166,8 +166,8 @@ private static (Size, Rectangle) CalculateCropRectangle( int targetHeight = height; // Fractional variants for preserving aspect ratio. - double percentHeight = Math.Abs(height / (double)sourceHeight); - double percentWidth = Math.Abs(width / (double)sourceWidth); + float percentHeight = MathF.Abs(height / (float)sourceHeight); + float percentWidth = MathF.Abs(width / (float)sourceWidth); if (percentHeight < percentWidth) { @@ -175,17 +175,17 @@ private static (Size, Rectangle) CalculateCropRectangle( if (options.CenterCoordinates.HasValue) { - double center = -(ratio * sourceHeight) * options.CenterCoordinates.Value.Y; - targetY = (int)Math.Round(center + (height / 2F)); + float center = -(ratio * sourceHeight) * options.CenterCoordinates.Value.Y; + targetY = (int)MathF.Round(center + (height / 2F)); if (targetY > 0) { targetY = 0; } - if (targetY < (int)Math.Round(height - (sourceHeight * ratio))) + if (targetY < (int)MathF.Round(height - (sourceHeight * ratio))) { - targetY = (int)Math.Round(height - (sourceHeight * ratio)); + targetY = (int)MathF.Round(height - (sourceHeight * ratio)); } } else @@ -200,15 +200,15 @@ private static (Size, Rectangle) CalculateCropRectangle( case AnchorPositionMode.Bottom: case AnchorPositionMode.BottomLeft: case AnchorPositionMode.BottomRight: - targetY = (int)Math.Round(height - (sourceHeight * ratio)); + targetY = (int)MathF.Round(height - (sourceHeight * ratio)); break; default: - targetY = (int)Math.Round((height - (sourceHeight * ratio)) / 2F); + targetY = (int)MathF.Round((height - (sourceHeight * ratio)) / 2F); break; } } - targetHeight = (int)Math.Ceiling(sourceHeight * percentWidth); + targetHeight = (int)MathF.Ceiling(sourceHeight * percentWidth); } else { @@ -216,17 +216,17 @@ private static (Size, Rectangle) CalculateCropRectangle( if (options.CenterCoordinates.HasValue) { - double center = -(ratio * sourceWidth) * options.CenterCoordinates.Value.X; - targetX = (int)Math.Round(center + (width / 2F)); + float center = -(ratio * sourceWidth) * options.CenterCoordinates.Value.X; + targetX = (int)MathF.Round(center + (width / 2F)); if (targetX > 0) { targetX = 0; } - if (targetX < (int)Math.Round(width - (sourceWidth * ratio))) + if (targetX < (int)MathF.Round(width - (sourceWidth * ratio))) { - targetX = (int)Math.Round(width - (sourceWidth * ratio)); + targetX = (int)MathF.Round(width - (sourceWidth * ratio)); } } else @@ -241,15 +241,15 @@ private static (Size, Rectangle) CalculateCropRectangle( case AnchorPositionMode.Right: case AnchorPositionMode.TopRight: case AnchorPositionMode.BottomRight: - targetX = (int)Math.Round(width - (sourceWidth * ratio)); + targetX = (int)MathF.Round(width - (sourceWidth * ratio)); break; default: - targetX = (int)Math.Round((width - (sourceWidth * ratio)) / 2F); + targetX = (int)MathF.Round((width - (sourceWidth * ratio)) / 2F); break; } } - targetWidth = (int)Math.Ceiling(sourceWidth * percentHeight); + targetWidth = (int)MathF.Ceiling(sourceWidth * percentHeight); } // Target image width and height can be different to the rectangle width and height. @@ -265,20 +265,20 @@ private static (Size, Rectangle) CalculateMaxRectangle( int targetHeight = height; // Fractional variants for preserving aspect ratio. - double percentHeight = Math.Abs(height / (double)source.Height); - double percentWidth = Math.Abs(width / (double)source.Width); + float percentHeight = MathF.Abs(height / (float)source.Height); + float percentWidth = MathF.Abs(width / (float)source.Width); - // Integers must be cast to doubles to get needed precision - double ratio = height / (double)width; - double sourceRatio = source.Height / (double)source.Width; + // Integers must be cast to floats to get needed precision + float ratio = height / (float)width; + float sourceRatio = source.Height / (float)source.Width; if (sourceRatio < ratio) { - targetHeight = (int)Math.Round(source.Height * percentWidth); + targetHeight = (int)MathF.Round(source.Height * percentWidth); } else { - targetWidth = (int)Math.Round(source.Width * percentHeight); + targetWidth = (int)MathF.Round(source.Width * percentHeight); } // Replace the size to match the rectangle. @@ -307,25 +307,25 @@ private static (Size, Rectangle) CalculateMinRectangle( if (widthDiff < heightDiff) { - double sourceRatio = (double)sourceHeight / sourceWidth; - targetHeight = (int)Math.Round(width * sourceRatio); + float sourceRatio = (float)sourceHeight / sourceWidth; + targetHeight = (int)MathF.Round(width * sourceRatio); } else if (widthDiff > heightDiff) { - double sourceRatioInverse = (double)sourceWidth / sourceHeight; - targetWidth = (int)Math.Round(height * sourceRatioInverse); + float sourceRatioInverse = (float)sourceWidth / sourceHeight; + targetWidth = (int)MathF.Round(height * sourceRatioInverse); } else { if (height > width) { - double percentWidth = Math.Abs(width / (double)sourceWidth); - targetHeight = (int)Math.Round(sourceHeight * percentWidth); + float percentWidth = MathF.Abs(width / (float)sourceWidth); + targetHeight = (int)MathF.Round(sourceHeight * percentWidth); } else { - double percentHeight = Math.Abs(height / (double)sourceHeight); - targetWidth = (int)Math.Round(sourceWidth * percentHeight); + float percentHeight = MathF.Abs(height / (float)sourceHeight); + targetWidth = (int)MathF.Round(sourceWidth * percentHeight); } } @@ -339,7 +339,7 @@ private static (Size, Rectangle) CalculatePadRectangle( int width, int height) { - double ratio; + float ratio; int sourceWidth = sourceSize.Width; int sourceHeight = sourceSize.Height; @@ -349,13 +349,13 @@ private static (Size, Rectangle) CalculatePadRectangle( int targetHeight = height; // Fractional variants for preserving aspect ratio. - double percentHeight = Math.Abs(height / (double)sourceHeight); - double percentWidth = Math.Abs(width / (double)sourceWidth); + float percentHeight = MathF.Abs(height / (float)sourceHeight); + float percentWidth = MathF.Abs(width / (float)sourceWidth); if (percentHeight < percentWidth) { ratio = percentHeight; - targetWidth = (int)Math.Round(sourceWidth * percentHeight); + targetWidth = (int)MathF.Round(sourceWidth * percentHeight); switch (options.Position) { @@ -367,17 +367,17 @@ private static (Size, Rectangle) CalculatePadRectangle( case AnchorPositionMode.Right: case AnchorPositionMode.TopRight: case AnchorPositionMode.BottomRight: - targetX = (int)Math.Round(width - (sourceWidth * ratio)); + targetX = (int)MathF.Round(width - (sourceWidth * ratio)); break; default: - targetX = (int)Math.Round((width - (sourceWidth * ratio)) / 2F); + targetX = (int)MathF.Round((width - (sourceWidth * ratio)) / 2F); break; } } else { ratio = percentWidth; - targetHeight = (int)Math.Round(sourceHeight * percentWidth); + targetHeight = (int)MathF.Round(sourceHeight * percentWidth); switch (options.Position) { @@ -389,10 +389,10 @@ private static (Size, Rectangle) CalculatePadRectangle( case AnchorPositionMode.Bottom: case AnchorPositionMode.BottomLeft: case AnchorPositionMode.BottomRight: - targetY = (int)Math.Round(height - (sourceHeight * ratio)); + targetY = (int)MathF.Round(height - (sourceHeight * ratio)); break; default: - targetY = (int)Math.Round((height - (sourceHeight * ratio)) / 2F); + targetY = (int)MathF.Round((height - (sourceHeight * ratio)) / 2F); break; } } From 6e589e8d8e82b812b2b948e6e254575e63638b63 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 21 Nov 2020 00:26:38 +0000 Subject: [PATCH 4/5] Use higher tolerance on macOS CI runs --- .../Processing/Processors/Transforms/ResizeTests.cs | 3 ++- tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs index f40b8d11a0..daf217a5ae 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs @@ -35,7 +35,8 @@ public class ResizeTests nameof(KnownResamplers.Lanczos5), }; - private static readonly ImageComparer ValidatorComparer = ImageComparer.TolerantPercentage(0.07F); + private static readonly ImageComparer ValidatorComparer = + ImageComparer.TolerantPercentage(TestEnvironment.IsOSX && TestEnvironment.RunsOnCI ? 0.2595F : 0.07F); [Fact] public void Resize_PixelAgnostic() diff --git a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs index 48728faf0e..b80a29646c 100644 --- a/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs +++ b/tests/ImageSharp.Tests/TestUtilities/TestEnvironment.cs @@ -108,6 +108,8 @@ internal static string GetReferenceOutputFileName(string actualOutputFileName) = internal static bool IsLinux => RuntimeInformation.IsOSPlatform(OSPlatform.Linux); + internal static bool IsOSX => RuntimeInformation.IsOSPlatform(OSPlatform.OSX); + internal static bool IsMono => Type.GetType("Mono.Runtime") != null; // https://stackoverflow.com/a/721194 internal static bool IsWindows => RuntimeInformation.IsOSPlatform(OSPlatform.Windows); From ecf05e2ff9057d4a42a1d57cc76008d707ca18db Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sat, 21 Nov 2020 00:31:52 +0000 Subject: [PATCH 5/5] Bump tolerance --- .../Processing/Processors/Transforms/ResizeTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs index daf217a5ae..4a20f4e568 100644 --- a/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs +++ b/tests/ImageSharp.Tests/Processing/Processors/Transforms/ResizeTests.cs @@ -36,7 +36,7 @@ public class ResizeTests }; private static readonly ImageComparer ValidatorComparer = - ImageComparer.TolerantPercentage(TestEnvironment.IsOSX && TestEnvironment.RunsOnCI ? 0.2595F : 0.07F); + ImageComparer.TolerantPercentage(TestEnvironment.IsOSX && TestEnvironment.RunsOnCI ? 0.26F : 0.07F); [Fact] public void Resize_PixelAgnostic()