Exemple #1
0
        public void Creation_from_matching_color_returns_codel_with_matching_colour()
        {
            var colour = Color.FromArgb(255, 255, 255);
            var codel  = Bitmapping.Colour(colour);

            Assert.AreEqual(Colour.White, codel);
        }
Exemple #2
0
        public void Creation_from_not_matching_colour_returns_null()
        {
            var colour = Color.Brown;
            var codel  = Bitmapping.Colour(colour);

            Assert.Null(codel);
        }
Exemple #3
0
        internal static Program Load(string path, int codelsize = 1)
        {
            using var stream = typeof(Runner).Assembly
                               .GetManifestResourceStream("PietDotNet.Tests.Programs." + path)
                               ?? throw new FileNotFoundException(path);

            return(Bitmapping.Load(stream, codelsize));
        }
Exemple #4
0
        public static void Main(params string[] args)
        {
            if (args is null || args.Length == 0)
            {
                Console.WriteLine("Specify a program.");
                return;
            }
            var file = new FileInfo(args[0]);

            if (!file.Exists)
            {
                Console.WriteLine($"Program {file.FullName} does not exist.");
                return;
            }

            var logLevel = args.Length > 1 && Enum.TryParse <LogLevel>(args[1], true, out var parsed)
                ? parsed
                : LogLevel.Error;

            var program = Bitmapping.Load(file);
            var console = new PietConsole(logLevel);

            program.Run(console, console);
        }