Example #1
0
        public IEnumerator Composite1WithWithGameObjectWithBrush_AddComposite2ToGameObject_BrushHasComposite2AsParent()
        {
            var composite1           = TestUtility.CreateUndoableGameObjectWithComposite("composite1");
            var composite1GameObject = composite1.gameObject;

            var composite2GameObject = TestUtility.CreateGameObject("composite2");

            composite2GameObject.transform.parent = composite1GameObject.transform;

            var brush           = TestUtility.CreateUndoableGameObjectWithBrush("brush");
            var brushGameObject = brush.gameObject;

            brush.transform.parent = composite2GameObject.transform;

            Assert.AreEqual(0, CSGManager.TreeBranchCount, "Expected 0 TreeBranches to Exist");
            Assert.AreEqual(0, CSGManager.TreeBrushCount, "Expected 0 TreeBrushes to Exist");
            Assert.AreEqual(0, CSGManager.TreeNodeCount, "Expected 0 TreeNodes to Exist");
            yield return(null);

            Assert.True(composite1GameObject);
            Assert.True(composite1);
            Assert.True(composite2GameObject);
            Assert.True(brushGameObject);
            Assert.True(brush);

            Assert.AreEqual(1, CSGManager.TreeBranchCount, "Expected 1 TreeBranch to Exist");
            Assert.AreEqual(1, CSGManager.TreeBrushCount, "Expected 1 TreeBrush to Exist");
            Assert.AreEqual(3, CSGManager.TreeNodeCount, "Expected 3 TreeNodes to Exist");
            Assert.AreEqual(1, composite1.Node.Count);
            Assert.AreEqual(composite1.Node.NodeID, brush.TopNode.Parent.NodeID);

            var composite2 = TestUtility.CreateUndoableCompositeComponent(composite2GameObject);

            yield return(null);

            Assert.True(composite1GameObject);
            Assert.True(composite1);
            Assert.True(composite2GameObject);
            Assert.True(composite2);
            Assert.True(brushGameObject);
            Assert.True(brush);

            Assert.AreEqual(2, CSGManager.TreeBranchCount, "Expected 2 TreeBranches to Exist");
            Assert.AreEqual(1, CSGManager.TreeBrushCount, "Expected 1 TreeBrush to Exist");
            Assert.AreEqual(4, CSGManager.TreeNodeCount, "Expected 4 TreeNodes to Exist");
            Assert.AreEqual(1, composite2.Node.Count);
            Assert.AreEqual(1, composite1.Node.Count);
            Assert.AreEqual(composite1.Node.NodeID, composite2.Node.Parent.NodeID);
            Assert.AreEqual(composite2.Node.NodeID, brush.TopNode.Parent.NodeID);
        }