public void Initialize_WithPathAndConfigurationFilesIsNull_ThrowsException() { ExceptionAssert.ThrowsArgumentNullException("configFiles", () => { MagickNET.Initialize(null, Path.GetTempPath()); }); }
public void ShouldThrowExceptionWhenXmlFileIsMissing() { string path = Files.Root + @"../../src/Magick.Native/resources/Release"; #if Q8 path += "Q8"; #elif Q16 path += "Q16"; #else path += "Q16-HDRI"; #endif foreach (string fileName in Directory.GetFiles(path, "*.xml")) { string tempFile = fileName + ".tmp"; Cleanup.DeleteFile(tempFile); File.Move(fileName, tempFile); try { var exception = Assert.Throws <ArgumentException>("path", () => { MagickNET.Initialize(path); }); Assert.Contains("Unable to find file: " + Path.GetFullPath(fileName), exception.Message); } finally { File.Move(tempFile, fileName); } } }
public void ShouldThrowExceptionWhenPathIsInvalid() { ExceptionAssert.Throws <ArgumentException>("path", () => { MagickNET.Initialize(ConfigurationFiles.Default, "invalid"); }, "Unable to find directory"); }
public void Initialize_XmlFileIsMissing_ThrowsException() { string path = Files.Root + @"../../src/Magick.Native/resources/Release"; #if Q8 path += "Q8"; #elif Q16 path += "Q16"; #elif Q16HDRI path += "Q16-HDRI"; #else #error Not implemented! #endif foreach (string fileName in Directory.GetFiles(path, "*.xml")) { string tempFile = fileName + ".tmp"; Cleanup.DeleteFile(tempFile); File.Move(fileName, tempFile); try { ExceptionAssert.Throws <ArgumentException>("path", () => { MagickNET.Initialize(path); }, "Unable to find file: " + Path.GetFullPath(fileName)); } finally { File.Move(tempFile, fileName); } } }
public void ShouldThrowExceptionWhenConfigurationFilesIsNull() { ExceptionAssert.Throws <ArgumentNullException>("configFiles", () => { MagickNET.Initialize((ConfigurationFiles)null); }); }
public void Initialize_PathIsInvalid_ThrowsException() { ExceptionAssert.Throws <ArgumentException>(delegate() { MagickNET.Initialize("Invalid"); }); }
public void Initialize_PathIsNull_ThrowsException() { ExceptionAssert.Throws <ArgumentNullException>(delegate() { MagickNET.Initialize(null); }); }
public static bool Initialize() { Ghostscript.Initialize(); var configFiles = ConfigurationFiles.Default; configFiles.Policy.Data = ModifyPolicy(configFiles.Policy.Data); configFiles.Type.Data = CreateTypeData(); var path = Path.Combine(Path.GetTempPath(), "Magick.NET.Tests"); Cleanup.DeleteDirectory(path); Directory.CreateDirectory(path); MagickNET.Initialize(configFiles, path); // OpenCL should be disabled by default this is a hack to check that. if (OpenCL.IsEnabled) { return(false); } OpenCL.IsEnabled = true; return(true); }
public ImageMagickConfiguration() { ConfigurationFiles configFiles = ConfigurationFiles.Default; configFiles.Policy.Data = @" <policymap> <policy domain=""resource"" name=""temporary-path"" value=""/tmp""/> <policy domain=""resource"" name=""memory"" value=""2GiB""/> <policy domain=""resource"" name=""map"" value=""4GiB""/> <policy domain=""resource"" name=""area"" value=""1GB""/> <policy domain=""resource"" name=""disk"" value=""16EB""/> <policy domain=""resource"" name=""file"" value=""768""/> <policy domain=""resource"" name=""thread"" value=""4""/> <policy domain=""resource"" name=""throttle"" value=""0""/> <policy domain=""resource"" name=""time"" value=""unlimited""/> <policy domain=""system"" name=""precision"" value=""6""/> <policy domain=""cache"" name=""shared-secret"" value=""passphrase""/> <policy domain=""coder"" rights=""none"" pattern=""EPHEMERAL"" /> <policy domain=""coder"" rights=""none"" pattern=""URL"" /> <policy domain=""coder"" rights=""none"" pattern=""HTTPS"" /> <policy domain=""coder"" rights=""none"" pattern=""MVG"" /> <policy domain=""coder"" rights=""none"" pattern=""MSL"" /> <policy domain=""coder"" rights=""none"" pattern=""TEXT"" /> <policy domain=""coder"" rights=""none"" pattern=""SHOW"" /> <policy domain=""coder"" rights=""none"" pattern=""WIN"" /> <policy domain=""coder"" rights=""none"" pattern=""PLT"" /> <policy domain=""path"" rights=""none"" pattern=""@*"" /> </policymap> "; MagickNET.Initialize(configFiles, TemporaryImagesFilePath); }
public void Initialize_WithPathAndPathIsNull_ThrowsException() { ExceptionAssert.ThrowsArgumentNullException("path", () => { MagickNET.Initialize(ConfigurationFiles.Default, null); }); }
public void Initialize_ConfigurationFilesIsNull_ThrowsException() { ExceptionAssert.Throws <ArgumentNullException>(delegate() { MagickNET.Initialize((ConfigurationFiles)null); }); }
public void ShouldThrowExceptionWhenConfigurationFilesIsNull() { Assert.Throws <ArgumentNullException>("configFiles", () => { MagickNET.Initialize(null, Path.GetTempPath()); }); }
public void Initialize_PathIsNull_ThrowsException() { ExceptionAssert.ThrowsArgumentNullException("path", () => { MagickNET.Initialize((string)null); }); }
public void Initialize_PathIsInvalid_ThrowsException() { ExceptionAssert.ThrowsArgumentException("path", () => { MagickNET.Initialize("Invalid"); }); }
public void ShouldThrowExceptionWhenPathIsNull() { Assert.Throws <ArgumentNullException>("path", () => { MagickNET.Initialize(ConfigurationFiles.Default, null); }); }
public void Initialize_WithPathAndPathIsInvalid_ThrowsException() { ExceptionAssert.ThrowsArgumentException("path", () => { MagickNET.Initialize(ConfigurationFiles.Default, "invalid"); }, "Unable to find directory"); }
public void ShouldThrowExceptionWhenPathIsNull() { Assert.Throws <ArgumentNullException>("path", () => { MagickNET.Initialize((string)null); }); }
public void ShouldThrowExceptionWhenPathIsInvalid() { Assert.Throws <ArgumentException>("path", () => { MagickNET.Initialize("Invalid"); }); }
public void Test_Initialize() { ExceptionAssert.Throws <ArgumentNullException>(delegate() { MagickNET.Initialize(null); }); ExceptionAssert.Throws <ArgumentException>(delegate() { MagickNET.Initialize("Invalid"); }); string path = Files.Root + @"..\..\Source\Magick.NET.Native\Resources\xml"; foreach (string fileName in Directory.GetFiles(path, "*.xml")) { string tempFile = fileName + ".tmp"; if (File.Exists(tempFile)) { File.Delete(tempFile); } File.Move(fileName, tempFile); ExceptionAssert.Throws <ArgumentException>(delegate() { MagickNET.Initialize(path); }, "MagickNET._ImageMagickFiles does not contain: " + Path.GetFileName(fileName)); File.Move(tempFile, fileName); } }
public void Initialize_ConfigurationFilesIsNull_ThrowsException() { ExceptionAssert.ThrowsArgumentNullException("configFiles", () => { MagickNET.Initialize((ConfigurationFiles)null); }); }
public void Initialize_XmlFileIsMissing_ThrowsException() { string path = Files.Root + @"../../Source/Magick.NET.Native/Resources/xml"; foreach (string fileName in Directory.GetFiles(path, "*.xml")) { string tempFile = fileName + ".tmp"; Cleanup.DeleteFile(tempFile); File.Move(fileName, tempFile); try { ExceptionAssert.ThrowsArgumentException("path", () => { MagickNET.Initialize(path); }, "Unable to find file: " + Path.GetFullPath(fileName)); } finally { File.Move(tempFile, fileName); } } }
public ImageMagickConfiguration(string policyMap, string temporaryImagesFilePath) { ConfigurationFiles configFiles = ConfigurationFiles.Default; configFiles.Policy.Data = policyMap; TemporaryImagesFilePath = temporaryImagesFilePath; MagickNET.Initialize(configFiles, TemporaryImagesFilePath); }
public void Initialize_WithPathAndPathIsNull_ThrowsException() { ArgumentNullException exception = ExceptionAssert.Throws <ArgumentNullException>(() => { MagickNET.Initialize(ConfigurationFiles.Default, null); }); Assert.AreEqual("path", exception.ParamName); }
public void Initialize_WithPathAndConfigurationFilesIsNull_ThrowsException() { ArgumentNullException exception = ExceptionAssert.Throws <ArgumentNullException>(() => { MagickNET.Initialize(null, Path.GetTempPath()); }); Assert.AreEqual("configFiles", exception.ParamName); }
public void ShouldThrowExceptionWhenPathIsInvalid() { var exception = Assert.Throws <ArgumentException>("path", () => { MagickNET.Initialize(ConfigurationFiles.Default, "invalid"); }); Assert.Contains("Unable to find directory", exception.Message); }
public MainWindow() { InitializeComponent(); OpenCL.IsEnabled = false; MagickNET.Initialize(); ImageManager.Initialize(); }
public void OpenPsdUsingImageMagick() { MagickNET.Initialize(); MagickImage img = new MagickImage(_file); img.Resize(new MagickGeometry(100, 100)); img.Write("newFile.png"); }
public void CanBeCalledTwice() { using (var directory = new TemporaryDirectory()) { string path = directory.FullName; MagickNET.Initialize(ConfigurationFiles.Default, path); MagickNET.Initialize(ConfigurationFiles.Default, path); } }
public void Initialize_WithPathAndPathIsInvalid_ThrowsException() { ArgumentException exception = ExceptionAssert.Throws <ArgumentException>(() => { MagickNET.Initialize(ConfigurationFiles.Default, "invalid"); }); Assert.AreEqual("path", exception.ParamName); Assert.IsTrue(exception.Message.Contains("Unable to find directory")); }
public void ShouldWriteAllFilesInTheReturnedPath() { using (var directory = new TemporaryDirectory()) { string path = directory.FullName; MagickNET.Initialize(ConfigurationFiles.Default, path); AssertConfigFiles(path); } }