From c7dc9523b6a8582f1bb8124e3ddefb132dd0e820 Mon Sep 17 00:00:00 2001 From: Thomas Broust Date: Thu, 26 Feb 2015 14:25:32 +0100 Subject: [PATCH] Adds failing tests for negative angle Former-commit-id: 68d80544153a5baa6b61d41716f5c7e4a11a2c3e Former-commit-id: f2bb2e2df8e7b47bfede287328cf64c66fdf7542 --- .../Imaging/Helpers/ImageMathsUnitTests.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ImageProcessor.UnitTests/Imaging/Helpers/ImageMathsUnitTests.cs b/src/ImageProcessor.UnitTests/Imaging/Helpers/ImageMathsUnitTests.cs index 3e1ffdfb36..f8d56fd545 100644 --- a/src/ImageProcessor.UnitTests/Imaging/Helpers/ImageMathsUnitTests.cs +++ b/src/ImageProcessor.UnitTests/Imaging/Helpers/ImageMathsUnitTests.cs @@ -22,6 +22,7 @@ [TestCase(100, 100, 45, 141, 141)] [TestCase(100, 100, 30, 137, 137)] [TestCase(100, 200, 50, 217, 205)] + [TestCase(100, 200, -50, 217, 205)] public void BoundingRotatedRectangleIsCalculated(int width, int height, float angle, int expectedWidth, int expectedHeight) { Rectangle result = ImageMaths.GetBoundingRotatedRectangle(width, height, angle); @@ -44,11 +45,16 @@ [TestCase(200, 100, 45, 2.12f)] [TestCase(600, 450, 20, 1.39f)] [TestCase(600, 450, 45, 1.64f)] + [TestCase(100, 200, -45, 1.22f)] public void RotationZoomIsCalculated(int imageWidth, int imageHeight, float angle, float expected) { float result = ImageMaths.ZoomAfterRotation(imageWidth, imageHeight, angle); result.Should().BeApproximately(expected, 0.01f, "because the zoom level after rotation should have been calculated"); + + result.Should().BePositive("because we're always zooming in so the zoom level should always be positive"); + + result.Should().BeGreaterOrEqualTo(1, "because the zoom should always increase the size and not reduce it"); } } } \ No newline at end of file