public void TestOperationsCallsOnImageChanged() { var image = new CodedImage { Size = new Size(5, 5) }; var resizer = new ImageSizeManipulator(image); var childManipulator = new ImageManipulatorTest.DummyManipulator(resizer); AssertActionCallsOnImageChanged(childManipulator, () => resizer.Resize(new Size(3, 3), ImageResampler.FilterType.Box, ImageSizeManipulator.SizeLockType.KeepWidthAndHeight)); }
public void TestResize() { var resizer = new ImageSizeManipulator(new CodedImage { Size = new Size(5, 5) }); Assert.AreEqual(new Size(5, 5), resizer.ManipulatedImage.Size); resizer.Resize(new Size(10, 7), ImageResampler.FilterType.Box, ImageSizeManipulator.SizeLockType.None); Assert.AreEqual(new Size(10, 7), resizer.ManipulatedImage.Size); }
void AssertResizeWithLastSettingsOnParentImageChanged(Size initialSize, Size changedSize, ImageSizeManipulator.SizeLockType sizeLockBy, Size newSize, Size expectedSize) { var dummyManipulator = new ImageManipulatorTest.DummyManipulator(new CodedImage { Size = initialSize }); var resizer = new ImageSizeManipulator(dummyManipulator); Assert.AreEqual(initialSize, resizer.ManipulatedImage.Size, "Precondition"); resizer.Resize(changedSize, ImageResampler.FilterType.Box, sizeLockBy); Assert.AreEqual(changedSize, resizer.ManipulatedImage.Size, "Precondition 2"); dummyManipulator.ManipulatedImage.Size = newSize; Assert.AreEqual(changedSize, resizer.ManipulatedImage.Size, "Not changed yet"); dummyManipulator.CallOnImageChanged(); Assert.AreEqual(expectedSize, resizer.ManipulatedImage.Size); }
public ImageSizeController4Test(ImageSizeManipulator manipulator) : base(manipulator) { }