From cc7b24e812ec2dbd98ed2226fba9b7e08d9ace70 Mon Sep 17 00:00:00 2001 From: Thomas Broust Date: Sat, 28 Jun 2014 18:16:34 +0200 Subject: [PATCH] Checks that the image is actually resized Former-commit-id: bdb33a4c6804c88b17fa251ad9e1d33b5fdad1c7 --- .../ImageFactoryUnitTests.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ImageProcessor.UnitTests/ImageFactoryUnitTests.cs b/src/ImageProcessor.UnitTests/ImageFactoryUnitTests.cs index b81cff068..936c32345 100644 --- a/src/ImageProcessor.UnitTests/ImageFactoryUnitTests.cs +++ b/src/ImageProcessor.UnitTests/ImageFactoryUnitTests.cs @@ -83,8 +83,7 @@ namespace ImageProcessor.UnitTests imageFactory.Load(fileName); var original = imageFactory.Image.Clone(); imageFactory.Alpha(50); - var modified = imageFactory.Image.Clone(); - Assert.AreNotEqual(original, modified); + Assert.AreNotEqual(original, imageFactory.Image); } } } @@ -102,8 +101,7 @@ namespace ImageProcessor.UnitTests imageFactory.Load(fileName); var original = imageFactory.Image.Clone(); imageFactory.Brightness(50); - var modified = imageFactory.Image.Clone(); - Assert.AreNotEqual(original, modified); + Assert.AreNotEqual(original, imageFactory.Image); } } } @@ -114,15 +112,17 @@ namespace ImageProcessor.UnitTests [Test] public void ApplyConstraints() { + const int maxSize = 200; foreach (var fileName in ListInputFiles()) { using (var imageFactory = new ImageFactory()) { imageFactory.Load(fileName); var original = imageFactory.Image.Clone(); - imageFactory.Constrain(new System.Drawing.Size(200, 200)); - var modified = imageFactory.Image.Clone(); - Assert.AreNotEqual(original, modified); + imageFactory.Constrain(new System.Drawing.Size(maxSize, maxSize)); + Assert.AreNotEqual(original, imageFactory.Image); + Assert.LessOrEqual(maxSize, imageFactory.Image.Width); + Assert.LessOrEqual(maxSize, imageFactory.Image.Height); } } }