Skip to content

Commit

Permalink
Adds failing tests for negative angle
Browse files Browse the repository at this point in the history
Former-commit-id: 3274579
  • Loading branch information
cosmo0 committed Feb 26, 2015
1 parent 169f2a9 commit b1df032
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ImageMathsUnitTests
[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);
Expand All @@ -44,11 +45,16 @@ public void BoundingRotatedRectangleIsCalculated(int width, int height, float an
[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");
}
}
}

0 comments on commit b1df032

Please sign in to comment.