Exemplo n.º 1
0
        private void PunchPdfTest(string basename, PunchPrintSettings punchPrintSettings)
        {
            // Get the pages of the printing.
            PunchPrinting punchPrinter = new PunchPrinting(controller.GetEventDB(), controller, punchPrintSettings);
            string        pdfFileName  = TestUtil.GetTestFile(basename + ".pdf");

            punchPrinter.PrintToPdf(pdfFileName, false);
            CheckPdfDump(pdfFileName, TestUtil.GetTestFile(basename + "_baseline_page%d.png"));
        }
Exemplo n.º 2
0
        public void PrintPunchesRelay1()
        {
            controller.LoadInitialFile(TestUtil.GetTestFile("controller\\variations.ppen"), true);
            PunchPrintSettings punchPrintSettings = new PunchPrintSettings();

            punchPrintSettings.BoxSize = 18;

            punchPrintSettings.CourseIds = new Id <Course>[] { CourseId(2), CourseId(0) };
            PunchPrintingTest("punchcards\\relay1", punchPrintSettings);
        }
Exemplo n.º 3
0
        public void PrintPunchesPdf1()
        {
            controller.LoadInitialFile(TestUtil.GetTestFile("punchcards\\sample1.ppen"), true);
            PunchPrintSettings punchPrintSettings = new PunchPrintSettings();

            punchPrintSettings.BoxSize = 18;

            punchPrintSettings.CourseIds = new Id <Course>[] { CourseId(1), CourseId(2), CourseId(3), CourseId(4), CourseId(0) };
            PunchPdfTest("punchcards\\descpdf1", punchPrintSettings);
        }
Exemplo n.º 4
0
        public void PrintPunchesPdf2()
        {
            controller.LoadInitialFile(TestUtil.GetTestFile("punchcards\\sample1.ppen"), true);
            PunchPrintSettings punchPrintSettings = new PunchPrintSettings();

            punchPrintSettings.PageSettings.Landscape = true;
            punchPrintSettings.PageSettings.Margins   = new Margins(50, 50, 200, 200);
            punchPrintSettings.BoxSize = 9;

            punchPrintSettings.CourseIds = new Id <Course>[] { CourseId(0), CourseId(1), CourseId(2), CourseId(3), CourseId(4), CourseId(5), CourseId(6), CourseId(7) };
            PunchPdfTest("punchcards\\descpdf2", punchPrintSettings);
        }
Exemplo n.º 5
0
        private void PunchPrintingTest(string basename, PunchPrintSettings punchPrintSettings)
        {
            // Get the pages of the printing.
            PunchPrinting punchPrinter = new PunchPrinting(controller.GetEventDB(), controller, punchPrintSettings);

            Bitmap[] bitmaps = punchPrinter.PrintBitmaps();

            // Check all the pages against the baseline.
            for (int page = 0; page < bitmaps.Length; ++page)
            {
                Bitmap bm           = bitmaps[page];
                string baseFileName = basename + "_page" + (page + 1).ToString();
                TestUtil.CheckBitmapsBase(bm, baseFileName);
            }
        }
Exemplo n.º 6
0
        public void PrintPunchesRelay3()
        {
            controller.LoadInitialFile(TestUtil.GetTestFile("controller\\variations.ppen"), true);
            PunchPrintSettings punchPrintSettings = new PunchPrintSettings();

            punchPrintSettings.BoxSize = 18;
            punchPrintSettings.VariationChoicesPerCourse[CourseId(2)] =
                new VariationChoices()
            {
                Kind = VariationChoices.VariationChoicesKind.Combined
            };

            punchPrintSettings.CourseIds = new Id <Course>[] { CourseId(2) };
            PunchPrintingTest("punchcards\\relay3", punchPrintSettings);
        }
Exemplo n.º 7
0
        public void PrintingException()
        {
            controller.LoadInitialFile(TestUtil.GetTestFile("punchcards\\sample1.ppen"), true);
            PunchPrintSettings punchPrintSettings = new PunchPrintSettings();

            punchPrintSettings.CourseIds = new Id <Course>[] { CourseId(1), CourseId(2), CourseId(3) };
            punchPrintSettings.PageSettings.PrinterSettings.PrinterName = "foobar";

            bool success = controller.PrintPunches(punchPrintSettings, false);

            Assert.IsFalse(success);
            string expected =
                @"ERROR: 'Cannot print 'Marymoor WIOL 2' for the following reason:

Settings to access printer 'foobar' are not valid.'
";

            Assert.AreEqual(expected, ui.output.ToString());
        }
        public void PrintingException()
        {
            controller.LoadInitialFile(TestUtil.GetTestFile("punchcards\\sample1.ppen"), true);
            PunchPrintSettings punchPrintSettings = new PunchPrintSettings();

            punchPrintSettings.CourseIds = new Id<Course>[] { CourseId(1), CourseId(2), CourseId(3) };
            punchPrintSettings.PageSettings.PrinterSettings.PrinterName = "foobar";

            bool success = controller.PrintPunches(punchPrintSettings, false);

            Assert.IsFalse(success);
            string expected =
            @"ERROR: 'Cannot print 'Marymoor WIOL 2' for the following reason:

            Settings to access printer 'foobar' are not valid.'
            ";

            Assert.AreEqual(expected, ui.output.ToString());
        }
        public void PrintPunches2()
        {
            controller.LoadInitialFile(TestUtil.GetTestFile("punchcards\\sample1.ppen"), true);
            PunchPrintSettings punchPrintSettings = new PunchPrintSettings();
            punchPrintSettings.PageSettings.Landscape = true;
            punchPrintSettings.PageSettings.Margins = new Margins(50, 50, 200, 200);
            punchPrintSettings.BoxSize = 9;

            punchPrintSettings.CourseIds = new Id<Course>[] { CourseId(0), CourseId(1), CourseId(2), CourseId(3), CourseId(4), CourseId(5), CourseId(6), CourseId(7) };
            PunchPrintingTest("punchcards\\desc2", punchPrintSettings);
        }
Exemplo n.º 10
0
        public void PrintPunches1()
        {
            controller.LoadInitialFile(TestUtil.GetTestFile("punchcards\\sample1.ppen"), true);
            PunchPrintSettings punchPrintSettings = new PunchPrintSettings();
            punchPrintSettings.BoxSize = 18;

            punchPrintSettings.CourseIds = new Id<Course>[] { CourseId(1), CourseId(2), CourseId(3), CourseId(4), CourseId(0) };
            PunchPrintingTest("punchcards\\desc1", punchPrintSettings);
        }
Exemplo n.º 11
0
        private void PunchPrintingTest(string basename, PunchPrintSettings punchPrintSettings)
        {
            // Get the pages of the printing.
            PunchPrinting punchPrinter = new PunchPrinting(controller.GetEventDB(), controller, punchPrintSettings);
            Bitmap[] bitmaps = punchPrinter.PrintBitmaps();

            // Check all the pages against the baseline.
            for (int page = 0; page < bitmaps.Length; ++page) {
                Bitmap bm = bitmaps[page];
                string baseFileName = basename + "_page" + (page + 1).ToString();
                TestUtil.CheckBitmapsBase(bm, baseFileName);
            }
        }
Exemplo n.º 12
0
        public void PrintPunchesRelay3()
        {
            controller.LoadInitialFile(TestUtil.GetTestFile("controller\\variations.ppen"), true);
            PunchPrintSettings punchPrintSettings = new PunchPrintSettings();
            punchPrintSettings.BoxSize = 18;
            punchPrintSettings.VariationChoicesPerCourse[CourseId(2)] =
                new VariationChoices() {
                    Kind = VariationChoices.VariationChoicesKind.Combined
                };

            punchPrintSettings.CourseIds = new Id<Course>[] { CourseId(2) };
            PunchPrintingTest("punchcards\\relay3", punchPrintSettings);
        }
Exemplo n.º 13
0
        public void PrintPunchesRelay1()
        {
            controller.LoadInitialFile(TestUtil.GetTestFile("controller\\variations.ppen"), true);
            PunchPrintSettings punchPrintSettings = new PunchPrintSettings();
            punchPrintSettings.BoxSize = 18;

            punchPrintSettings.CourseIds = new Id<Course>[] { CourseId(2), CourseId(0) };
            PunchPrintingTest("punchcards\\relay1", punchPrintSettings);
        }