public void BorderColorLocation_BeforeLeftTop_ThrowsException() { var script = new UnperspectiveScript(); using (var logo = new MagickImage(Images.Logo)) { script.BorderColorLocation = new PointD(-1, -1); // TODO: Fix this after the next release of Magick.NET // ExceptionAssert.ThrowsArgumentException<ArgumentOutOfRangeException>("x", "Invalid X coordinate: -1", () => ExceptionAssert.Throws <ArgumentOutOfRangeException>(() => { script.Execute(logo); }); } }
public void BorderColorLocation_AfterBottomRight_ThrowsException() { var script = new UnperspectiveScript(); using (var logo = new MagickImage(Images.Logo)) { script.BorderColorLocation = new PointD(logo.Width, logo.Height); // TODO: Fix this after the next release of Magick.NET // ExceptionAssert.ThrowsArgumentException<ArgumentOutOfRangeException>("x", "Invalid X coordinate: " + logo.Width, () => ExceptionAssert.Throws <ArgumentOutOfRangeException>(() => { script.Execute(logo); }); } }
private void AssertExecute(string input, string methodName, UnperspectiveMethod method, Action <UnperspectiveScript> action) { var inputFile = GetInputFile(input); /* LosslessCompress(input); */ using (var image = new MagickImage(inputFile)) { var script = new UnperspectiveScript(method); action(script); using (var scriptOutput = script.Execute(image)) { string outputFile = GetOutputFile(inputFile, methodName); AssertOutput(scriptOutput, outputFile); } } }
private static void AssertMinLength(int rotation, int minLength) { var script = new UnperspectiveScript(); script.MinLength = minLength; var inputFile = GetInputFile("monet2_p30_t30_r30_out.jpg"); using (var image = new MagickImage(inputFile)) { image.Rotate(rotation); ExceptionAssert.Throws <InvalidOperationException>("Unable to continue, the edge length is less than 40.", () => { script.Execute(image); }); } }