Exemplo n.º 1
0
        public void Test_SubGrid_ParentAssignment()
        {
            ISubGrid parentSubgrid = null;
            ISubGrid leafSubgrid   = null;

            SubGridTree tree = new SubGridTree(SubGridTreeConsts.SubGridTreeLevels, 1.0, new SubGridFactory <NodeSubGrid, LeafSubGrid>());

            leafSubgrid   = new SubGrid(tree, null, SubGridTreeConsts.SubGridTreeLevels);
            parentSubgrid = new SubGrid(tree, null, SubGridTreeConsts.SubGridTreeLevels - 1);

            leafSubgrid.Parent = parentSubgrid;
            leafSubgrid.SetOriginPosition(10, 10);

            Assert.Equal((int)leafSubgrid.OriginX, 10 * SubGridTreeConsts.SubGridTreeDimension);
            Assert.Equal((int)leafSubgrid.OriginY, 10 * SubGridTreeConsts.SubGridTreeDimension);
            Assert.Equal(leafSubgrid.Moniker(), string.Format("{0}:{0}", 10 * SubGridTreeConsts.SubGridTreeDimension));
        }
Exemplo n.º 2
0
        public void Test_SubGrid_LeafSubgridProperties()
        {
            ISubGrid    leafSubgrid = null;
            SubGridTree tree        = new SubGridTree(SubGridTreeConsts.SubGridTreeLevels, 1.0, new SubGridFactory <NodeSubGrid, LeafSubGrid>());

            // Create a new base subgrid leaf instance directly
            leafSubgrid = new SubGrid(tree, null, SubGridTreeConsts.SubGridTreeLevels);

            Assert.True(leafSubgrid.IsLeafSubGrid());

            Assert.False(leafSubgrid.Dirty);
            Assert.Equal(leafSubgrid.Level, SubGridTreeConsts.SubGridTreeLevels);
            Assert.Equal(leafSubgrid.AxialCellCoverageByThisSubGrid(), SubGridTreeConsts.SubGridTreeDimension);

            Assert.Equal(0, leafSubgrid.OriginX);
            Assert.Equal(0, leafSubgrid.OriginY);
            Assert.Equal("0:0", leafSubgrid.Moniker());

            // Does the dirty flag change?
            leafSubgrid.SetDirty();
            Assert.True(leafSubgrid.Dirty, "Leaf sub grid is not marked as dirty after setting it to dirty");
        }