Ejemplo n.º 1
0
        public void Test_TreeChartModel()
        {
            using (var model = new TreeChartModel())
            {
                Assert.IsNotNull(model);

                model.Base = fBase;
                Assert.AreEqual(fBase, model.Base);

                model.BranchDistance = TreeChartModel.DEF_BRANCH_DISTANCE;
                Assert.AreEqual(TreeChartModel.DEF_BRANCH_DISTANCE, model.BranchDistance);

                model.CertaintyIndex = true;
                Assert.AreEqual(true, model.CertaintyIndex);

                model.DepthLimit = 8;
                Assert.AreEqual(8, model.DepthLimit);

                model.DepthLimit = 8;
                Assert.AreEqual(8, model.DepthLimit);

                Assert.IsNotNull(model.Filter);

                model.HighlightedPerson = null;
                Assert.AreEqual(null, model.HighlightedPerson);

                Assert.AreEqual(0, model.ImageHeight);
                Assert.AreEqual(0, model.ImageWidth);

                model.KinRoot = null;
                Assert.AreEqual(null, model.KinRoot);

                model.Kind = TreeChartKind.ckAncestors;
                Assert.AreEqual(TreeChartKind.ckAncestors, model.Kind);

                model.Margins = 15;
                Assert.AreEqual(15, model.Margins);

                Assert.IsNull(model.Options);

                model.PathDebug = true;
                Assert.AreEqual(true, model.PathDebug);

                Assert.IsNotNull(model.Persons);

                Assert.IsNotNull(model.PreparedIndividuals);

                Assert.IsNull(model.Root);

                model.Scale = 1.3f;
                Assert.AreEqual(1.3f, model.Scale);

                model.Scale = 0.1f;
                Assert.AreEqual(0.5f, model.Scale);

                model.Scale = 1.7f;
                Assert.AreEqual(1.5f, model.Scale);

                Assert.Throws(typeof(ArgumentNullException), () => { model.DoFilter(null); });

                Assert.IsNull(model.FindPersonByCoords(0, 0));

                Assert.AreEqual(ExtRect.Create(0, -18, 15, -2), TreeChartModel.GetExpanderRect(ExtRect.Create(0, 0, 0, 0)));
                Assert.AreEqual(ExtRect.Create(-8, -18, 7, -2), TreeChartModel.GetPersonExpandRect(ExtRect.Create(0, 0, 0, 0)));

                ExtRect rt = model.VisibleArea;
                Assert.IsTrue(rt.IsEmpty());
            }
        }