Ejemplo n.º 1
0
        public void Files_Relay_SingleFile()
        {
            EventDB  eventDB  = controller.GetEventDB();
            SymbolDB symbolDB = ui.symbolDB;

            CoursePdfSettings settings = new CoursePdfSettings();

            settings.mapDirectory              = settings.fileDirectory = false;
            settings.outputDirectory           = TestUtil.GetTestFile("controller\\pdf_create1");
            settings.CourseIds                 = new Id <Course>[] { CourseId(2), Id <Course> .None };
            settings.ColorModel                = ColorModel.CMYK;
            settings.CropLargePrintArea        = true;
            settings.FileCreation              = CoursePdfSettings.PdfFileCreation.SingleFile;
            settings.PrintMapExchangesOnOneMap = false;

            bool success = controller.LoadInitialFile(TestUtil.GetTestFile("controller\\variations.ppen"), true);

            Assert.IsTrue(success);

            var coursePdf     = new CoursePdf(eventDB, symbolDB, controller, controller.MapDisplay, settings, new CourseAppearance());
            var filesToCreate = coursePdf.GetFilesToCreate();

            VariationInfo[] relayVariations = QueryEvent.GetAllVariations(eventDB, CourseId(2)).ToArray();

            Assert.AreEqual(1, filesToCreate.Count);

            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\variations.pdf"), filesToCreate[0].First);
            CollectionAssert.AreEqual(new CourseDesignator[] {
                new CourseDesignator(CourseId(2), relayVariations[0]),
                new CourseDesignator(CourseId(2), relayVariations[1]),
                new CourseDesignator(CourseId(2), relayVariations[2]),
                new CourseDesignator(CourseId(2), relayVariations[3]),
                CourseDesignator.AllControls
            }, filesToCreate[0].Second.ToList());
        }
Ejemplo n.º 2
0
        public void Files_OnePerCoursePart()
        {
            EventDB  eventDB  = controller.GetEventDB();
            SymbolDB symbolDB = ui.symbolDB;

            CoursePdfSettings settings = new CoursePdfSettings();

            settings.mapDirectory              = settings.fileDirectory = false;
            settings.outputDirectory           = TestUtil.GetTestFile("controller\\pdf_create1");
            settings.CourseIds                 = new Id <Course>[] { CourseId(1), CourseId(6), Id <Course> .None };
            settings.ColorModel                = ColorModel.CMYK;
            settings.CropLargePrintArea        = true;
            settings.FileCreation              = CoursePdfSettings.PdfFileCreation.FilePerCoursePart;
            settings.PrintMapExchangesOnOneMap = false;

            bool success = controller.LoadInitialFile(TestUtil.GetTestFile("controller\\mapexchange1.ppen"), true);

            Assert.IsTrue(success);

            var coursePdf     = new CoursePdf(eventDB, symbolDB, controller, controller.MapDisplay, settings, new CourseAppearance());
            var filesToCreate = coursePdf.GetFilesToCreate();

            Assert.AreEqual(6, filesToCreate.Count);
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\Course 1.pdf"), filesToCreate[0].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { Designator(1) }, filesToCreate[0].Second.ToList());
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\Course 5-1.pdf"), filesToCreate[1].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { new CourseDesignator(CourseId(6), 0) }, filesToCreate[1].Second.ToList());
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\Course 5-2.pdf"), filesToCreate[2].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { new CourseDesignator(CourseId(6), 1) }, filesToCreate[2].Second.ToList());
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\Course 5-3.pdf"), filesToCreate[3].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { new CourseDesignator(CourseId(6), 2) }, filesToCreate[3].Second.ToList());
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\Course 5-4.pdf"), filesToCreate[4].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { new CourseDesignator(CourseId(6), 3) }, filesToCreate[4].Second.ToList());
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\All controls.pdf"), filesToCreate[5].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { CourseDesignator.AllControls }, filesToCreate[5].Second.ToList());

            settings.PrintMapExchangesOnOneMap = true;

            coursePdf     = new CoursePdf(eventDB, symbolDB, controller, controller.MapDisplay, settings, new CourseAppearance());
            filesToCreate = coursePdf.GetFilesToCreate();

            Assert.AreEqual(3, filesToCreate.Count);
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\Course 1.pdf"), filesToCreate[0].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { Designator(1) }, filesToCreate[0].Second.ToList());
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\Course 5.pdf"), filesToCreate[1].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { Designator(6) }, filesToCreate[1].Second.ToList());
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\All controls.pdf"), filesToCreate[2].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { CourseDesignator.AllControls }, filesToCreate[2].Second.ToList());
        }
Ejemplo n.º 3
0
        public void Files_OnePerCourse()
        {
            EventDB eventDB = controller.GetEventDB();
            SymbolDB symbolDB = ui.symbolDB;

            CoursePdfSettings settings = new CoursePdfSettings();
            settings.mapDirectory = settings.fileDirectory = false;
            settings.outputDirectory = TestUtil.GetTestFile("controller\\pdf_create1");
            settings.CourseIds = new Id<Course>[] { CourseId(1), CourseId(6), Id<Course>.None };
            settings.ColorModel = ColorModel.CMYK;
            settings.CropLargePrintArea = true;
            settings.FileCreation = CoursePdfSettings.PdfFileCreation.FilePerCourse;
            settings.PrintMapExchangesOnOneMap = false;

            bool success = controller.LoadInitialFile(TestUtil.GetTestFile("controller\\mapexchange1.ppen"), true);
            Assert.IsTrue(success);

            var coursePdf = new CoursePdf(eventDB, symbolDB, controller, controller.MapDisplay, settings, new CourseAppearance());
            var filesToCreate = coursePdf.GetFilesToCreate();

            Assert.AreEqual(3, filesToCreate.Count);
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\Course 1.pdf"), filesToCreate[0].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { Designator(1) }, filesToCreate[0].Second.ToList());
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\Course 5.pdf"), filesToCreate[1].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { new CourseDesignator(CourseId(6), 0), new CourseDesignator(CourseId(6), 1), new CourseDesignator(CourseId(6), 2), new CourseDesignator(CourseId(6), 3) },
                                      filesToCreate[1].Second.ToList());
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\All controls.pdf"), filesToCreate[2].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { CourseDesignator.AllControls }, filesToCreate[2].Second.ToList());

            settings.PrintMapExchangesOnOneMap = true;

            coursePdf = new CoursePdf(eventDB, symbolDB, controller, controller.MapDisplay, settings, new CourseAppearance());
            filesToCreate = coursePdf.GetFilesToCreate();

            Assert.AreEqual(3, filesToCreate.Count);
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\Course 1.pdf"), filesToCreate[0].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { Designator(1) }, filesToCreate[0].Second.ToList());
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\Course 5.pdf"), filesToCreate[1].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { Designator(6) },
                                      filesToCreate[1].Second.ToList());
            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\All controls.pdf"), filesToCreate[2].First);
            CollectionAssert.AreEqual(new CourseDesignator[] { CourseDesignator.AllControls }, filesToCreate[2].Second.ToList());
        }
Ejemplo n.º 4
0
        public void Files_Relay_SingleFile()
        {
            EventDB eventDB = controller.GetEventDB();
            SymbolDB symbolDB = ui.symbolDB;

            CoursePdfSettings settings = new CoursePdfSettings();
            settings.mapDirectory = settings.fileDirectory = false;
            settings.outputDirectory = TestUtil.GetTestFile("controller\\pdf_create1");
            settings.CourseIds = new Id<Course>[] { CourseId(2), Id<Course>.None };
            settings.ColorModel = ColorModel.CMYK;
            settings.CropLargePrintArea = true;
            settings.FileCreation = CoursePdfSettings.PdfFileCreation.SingleFile;
            settings.PrintMapExchangesOnOneMap = false;

            bool success = controller.LoadInitialFile(TestUtil.GetTestFile("controller\\variations.ppen"), true);
            Assert.IsTrue(success);

            var coursePdf = new CoursePdf(eventDB, symbolDB, controller, controller.MapDisplay, settings, new CourseAppearance());
            var filesToCreate = coursePdf.GetFilesToCreate();

            VariationInfo[] relayVariations = QueryEvent.GetAllVariations(eventDB, CourseId(2)).ToArray();

            Assert.AreEqual(1, filesToCreate.Count);

            Assert.AreEqual(TestUtil.GetTestFile("controller\\pdf_create1\\variations.pdf"), filesToCreate[0].First);
            CollectionAssert.AreEqual(new CourseDesignator[] {
                new CourseDesignator(CourseId(2), relayVariations[0]),
                new CourseDesignator(CourseId(2), relayVariations[1]),
                new CourseDesignator(CourseId(2), relayVariations[2]),
                new CourseDesignator(CourseId(2), relayVariations[3]),
                CourseDesignator.AllControls
            }, filesToCreate[0].Second.ToList());
        }