Browse Source

Adds a few more unit tests

Former-commit-id: 0474a353404f5ed321a49f51172f068afba67cc8
pull/17/head
Thomas Broust 12 years ago
committed by James South
parent
commit
e7316476ee
  1. 62
      src/ImageProcessor.UnitTests/ImageFactoryUnitTests.cs

62
src/ImageProcessor.UnitTests/ImageFactoryUnitTests.cs

@ -124,6 +124,42 @@ namespace ImageProcessor.UnitTests
}
}
/// <summary>
/// Tests that a filter is really applied by checking that the image is modified
/// </summary>
[Test]
public void TestApplyEffectBlur()
{
foreach (var fileName in ListInputFiles())
{
using (var imageFactory = new ImageFactory())
{
imageFactory.Load(fileName);
var original = imageFactory.Image.Clone();
imageFactory.GaussianBlur(5);
Assert.AreNotEqual(original, imageFactory.Image);
}
}
}
/// <summary>
/// Tests that a filter is really applied by checking that the image is modified
/// </summary>
[Test]
public void TestApplyEffectBlurWithLayer()
{
foreach (var fileName in ListInputFiles())
{
using (var imageFactory = new ImageFactory())
{
imageFactory.Load(fileName);
var original = imageFactory.Image.Clone();
imageFactory.GaussianBlur(new Imaging.GaussianLayer() { Sigma = 10, Size = 5, Threshold = 2 });
Assert.AreNotEqual(original, imageFactory.Image);
}
}
}
/// <summary>
/// Tests that all filters can be applied
/// </summary>
@ -242,5 +278,31 @@ namespace ImageProcessor.UnitTests
}
}
}
/// <summary>
/// Tests that the image is flipped
/// </summary>
[Test]
public void TestFlip()
{
foreach (var fileName in ListInputFiles())
{
using (var imageFactory = new ImageFactory())
{
imageFactory.Load(fileName);
var original = (System.Drawing.Image)imageFactory.Image.Clone();
imageFactory.Flip(true);
Assert.AreNotEqual(original, imageFactory.Image);
Assert.AreEqual(original.Width, imageFactory.Image.Width);
Assert.AreEqual(original.Height, imageFactory.Image.Height);
imageFactory.Reset();
imageFactory.Flip(false);
Assert.AreNotEqual(original, imageFactory.Image);
Assert.AreEqual(original.Width, imageFactory.Image.Width);
Assert.AreEqual(original.Height, imageFactory.Image.Height);
}
}
}
}
}
Loading…
Cancel
Save