Exemple #1
0
        public void Test_PedigreeExporter()
        {
            BaseWindowStub      baseWin = new BaseWindowStub();
            GDMIndividualRecord iRec    = fContext.Tree.XRefIndex_Find("I1") as GDMIndividualRecord;

            baseWin.Context.ShieldState = ShieldState.None;

            Assert.Throws(typeof(ArgumentNullException), () => { new PedigreeExporter(null, null); });

            using (PedigreeExporter exporter = new PedigreeExporter(baseWin, iRec)) {
                exporter.Options = GlobalOptions.Instance;
                Assert.IsNotNull(exporter.Options);

                Assert.AreEqual(iRec, exporter.Root);
                Assert.AreEqual(ShieldState.None, exporter.ShieldState);

                exporter.Options.PedigreeOptions.IncludeAttributes  = true;
                exporter.Options.PedigreeOptions.IncludeNotes       = true;
                exporter.Options.PedigreeOptions.IncludeSources     = true;
                exporter.Options.PedigreeOptions.IncludeGenerations = true;

                exporter.Kind = PedigreeExporter.PedigreeKind.Descend_Konovalov;
                Assert.AreEqual(PedigreeExporter.PedigreeKind.Descend_Konovalov, exporter.Kind);

                var writer = Substitute.For <CustomWriter>();

                exporter.Options.PedigreeOptions.Format = PedigreeFormat.Excess;
                Assert.IsTrue(exporter.Generate(writer));

                exporter.Options.PedigreeOptions.Format = PedigreeFormat.Compact;
                Assert.IsTrue(exporter.Generate(writer));


                exporter.Kind = PedigreeExporter.PedigreeKind.Descend_dAboville;
                exporter.Options.PedigreeOptions.Format = PedigreeFormat.Excess;
                Assert.IsTrue(exporter.Generate(writer));


                exporter.Kind = PedigreeExporter.PedigreeKind.Ascend;
                exporter.Options.PedigreeOptions.Format = PedigreeFormat.Excess;
                Assert.IsTrue(exporter.Generate(writer));
            }
        }
Exemple #2
0
        public void GeneratePedigree(PedigreeExporter.PedigreeKind kind)
        {
            var selPerson = GetSelectedPerson();

            if (selPerson == null)
            {
                AppHost.StdDialogs.ShowError(LangMan.LS(LSID.LSID_NotSelectedPerson));
                return;
            }

            if (BaseController.DetectCycle(selPerson))
            {
                return;
            }

            using (var p = new PedigreeExporter(fView, selPerson)) {
                p.Options = AppHost.Options;
                p.Kind    = kind;
                p.Generate(true);
            }
        }