Browse Source

Checks that the image is actually resized

Former-commit-id: cf8a8931b6b28c4825283f3a6af4e8c4d087ca9e
af/merge-core
Thomas Broust 12 years ago
parent
commit
12e8fbca6c
  1. 14
      src/ImageProcessor.UnitTests/ImageFactoryUnitTests.cs

14
src/ImageProcessor.UnitTests/ImageFactoryUnitTests.cs

@ -83,8 +83,7 @@ namespace ImageProcessor.UnitTests
imageFactory.Load(fileName); imageFactory.Load(fileName);
var original = imageFactory.Image.Clone(); var original = imageFactory.Image.Clone();
imageFactory.Alpha(50); imageFactory.Alpha(50);
var modified = imageFactory.Image.Clone(); Assert.AreNotEqual(original, imageFactory.Image);
Assert.AreNotEqual(original, modified);
} }
} }
} }
@ -102,8 +101,7 @@ namespace ImageProcessor.UnitTests
imageFactory.Load(fileName); imageFactory.Load(fileName);
var original = imageFactory.Image.Clone(); var original = imageFactory.Image.Clone();
imageFactory.Brightness(50); imageFactory.Brightness(50);
var modified = imageFactory.Image.Clone(); Assert.AreNotEqual(original, imageFactory.Image);
Assert.AreNotEqual(original, modified);
} }
} }
} }
@ -114,15 +112,17 @@ namespace ImageProcessor.UnitTests
[Test] [Test]
public void ApplyConstraints() public void ApplyConstraints()
{ {
const int maxSize = 200;
foreach (var fileName in ListInputFiles()) foreach (var fileName in ListInputFiles())
{ {
using (var imageFactory = new ImageFactory()) using (var imageFactory = new ImageFactory())
{ {
imageFactory.Load(fileName); imageFactory.Load(fileName);
var original = imageFactory.Image.Clone(); var original = imageFactory.Image.Clone();
imageFactory.Constrain(new System.Drawing.Size(200, 200)); imageFactory.Constrain(new System.Drawing.Size(maxSize, maxSize));
var modified = imageFactory.Image.Clone(); Assert.AreNotEqual(original, imageFactory.Image);
Assert.AreNotEqual(original, modified); Assert.LessOrEqual(maxSize, imageFactory.Image.Width);
Assert.LessOrEqual(maxSize, imageFactory.Image.Height);
} }
} }
} }

Loading…
Cancel
Save