コード例 #1
0
        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);
        }
コード例 #2
0
        public IEnumerable <ITestCollection> OrderTestCollections(IEnumerable <ITestCollection> testCollections)
        {
            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);

            return(testCollections);
        }
コード例 #3
0
        public void Test_FitPage()
        {
            Ghostscript.Initialize();

            MagickReadSettings settings = new MagickReadSettings()
            {
                Defines = new PdfReadDefines()
                {
                    FitPage = new MagickGeometry(50, 40)
                }
            };

            using (MagickImage image = new MagickImage())
            {
                image.Read(Files.Coders.CartoonNetworkStudiosLogoAI, settings);

                Assert.IsTrue(image.Width <= 50);
                Assert.IsTrue(image.Height <= 40);
            }
        }