public virtual void GhostScriptIsDefaultSpecified() { ImageHandlerUtil imageHandlerUtil = new ImageHandlerUtil(); NUnit.Framework.Assert.IsNotNull(imageHandlerUtil.GetGsExec()); NUnit.Framework.Assert.IsTrue(imageHandlerUtil.IsVersionCommandExecutable(ImageHandlerUtil.GHOSTSCRIPT_KEYWORD )); }
public virtual void RunGhostScriptTest01() { String inputPdf = sourceFolder + "imageHandlerUtilTest.pdf"; ImageHandlerUtil imageHandlerUtil = new ImageHandlerUtil(); imageHandlerUtil.RunGhostScriptImageGeneration(inputPdf, destinationFolder, "outputPageImage.png", "1"); NUnit.Framework.Assert.AreEqual(1, FileUtil.ListFilesInDirectory(destinationFolder, true).Length); NUnit.Framework.Assert.IsTrue(FileUtil.FileExists(destinationFolder + "outputPageImage.png")); }
public virtual void RunImageMagickFuzzParam() { String inputImage = sourceFolder + "Im1_1.jpg"; String cmpImage = sourceFolder + "cmp_Im1_1.jpg"; String diff = destinationFolder + "diff.png"; ImageHandlerUtil imageHandlerUtil = new ImageHandlerUtil(); bool result = imageHandlerUtil.RunImageMagickImageCompare(inputImage, cmpImage, diff, "1.2"); NUnit.Framework.Assert.IsTrue(result); NUnit.Framework.Assert.IsTrue(FileUtil.FileExists(diff)); }
public virtual void RunGhostScriptTest02() { String inputPdf = sourceFolder + "imageHandlerUtilTest.pdf"; ImageHandlerUtil imageHandlerUtil = new ImageHandlerUtil(); String imageFileName = new FileInfo(inputPdf).Name + "-%03d.png"; imageHandlerUtil.RunGhostScriptImageGeneration(inputPdf, destinationFolder, imageFileName); NUnit.Framework.Assert.AreEqual(3, FileUtil.ListFilesInDirectory(destinationFolder, true).Length); NUnit.Framework.Assert.IsTrue(FileUtil.FileExists(destinationFolder + "imageHandlerUtilTest.pdf-001.png")); NUnit.Framework.Assert.IsTrue(FileUtil.FileExists(destinationFolder + "imageHandlerUtilTest.pdf-002.png")); NUnit.Framework.Assert.IsTrue(FileUtil.FileExists(destinationFolder + "imageHandlerUtilTest.pdf-003.png")); }
public virtual void RunGhostScriptIncorrectParams() { String inputPdf = sourceFolder + "imageHandlerUtilTest.pdf"; try { ImageHandlerUtil imageHandlerUtil = new ImageHandlerUtil(); imageHandlerUtil.RunGhostScriptImageGeneration(inputPdf, destinationFolder, "outputPageImage.png", "aaa"); } catch (ImageHandlerUtil.ImageHandlerExecutionException ex) { NUnit.Framework.Assert.IsTrue(ex.Message.Contains("GhostScript failed for")); return; } NUnit.Framework.Assert.Fail("An exception should be thrown!"); }
public virtual void RunGhostScriptIncorrectOutputDirectory() { String inputPdf = sourceFolder + "imageHandlerUtilTest.pdf"; try { ImageHandlerUtil imageHandlerUtil = new ImageHandlerUtil(); imageHandlerUtil.RunGhostScriptImageGeneration(inputPdf, "-", "outputPageImage.png", "1"); } catch (ImageHandlerUtil.ImageHandlerExecutionException ex) { NUnit.Framework.Assert.IsTrue(ex.Message.Contains("Cannot open output directory for")); return; } NUnit.Framework.Assert.Fail("An exception should be thrown!"); }
public virtual void GhostScriptIsExplicitlySpecified() { String gsExec = SystemUtil.GetEnvironmentVariable(ImageHandlerUtil.GHOSTSCRIPT_ENVIRONMENT_VARIABLE); if (gsExec == null) { gsExec = SystemUtil.GetEnvironmentVariable(ImageHandlerUtil.GHOSTSCRIPT_ENVIRONMENT_VARIABLE_LEGACY); } ImageHandlerUtil imageHandlerUtil = new ImageHandlerUtil(); imageHandlerUtil.SetGsExec(gsExec); NUnit.Framework.Assert.IsNotNull(imageHandlerUtil.GetGsExec()); NUnit.Framework.Assert.IsTrue(imageHandlerUtil.IsVersionCommandExecutable(ImageHandlerUtil.GHOSTSCRIPT_KEYWORD )); }
public virtual void ImageMagickIsExplicitlySpecified() { String compareExec = SystemUtil.GetEnvironmentVariable(ImageHandlerUtil.MAGICK_COMPARE_ENVIRONMENT_VARIABLE ); if (compareExec == null) { compareExec = SystemUtil.GetEnvironmentVariable(ImageHandlerUtil.MAGICK_COMPARE_ENVIRONMENT_VARIABLE_LEGACY ); } ImageHandlerUtil imageHandlerUtil = new ImageHandlerUtil(); imageHandlerUtil.SetCompareExec(compareExec); NUnit.Framework.Assert.IsNotNull(imageHandlerUtil.GetCompareExec()); NUnit.Framework.Assert.IsTrue(imageHandlerUtil.IsVersionCommandExecutable(ImageHandlerUtil.MAGICK_COMPARE_KEYWORD )); }
/// <summary> /// Creates a new /// <see cref="ImageHandlerExecutionException"/>. /// </summary> /// <param name="msg">the detail message.</param> public ImageHandlerExecutionException(ImageHandlerUtil _enclosing, String msg) : base(msg) { this._enclosing = _enclosing; }