public IEnumerator CompositeWithWithGameObjectWithBrush_BrushHasCompositeAsParent() { var composite = TestUtility.CreateUndoableGameObjectWithComposite("composite"); var compositeGameObject = composite.gameObject; var plainGameObject = TestUtility.CreateGameObject("gameObject"); plainGameObject.transform.parent = compositeGameObject.transform; var brush = TestUtility.CreateUndoableGameObjectWithBrush("brush"); var brushGameObject = brush.gameObject; brush.transform.parent = plainGameObject.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(compositeGameObject); Assert.True(composite); Assert.True(plainGameObject); 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, composite.Node.Count); Assert.AreEqual(composite.Node.NodeID, brush.TopNode.Parent.NodeID); }
public IEnumerator OperationWithWithGameObjectWithBrush_BrushHasOperationAsParent() { var operation = TestUtility.CreateUndoableGameObjectWithOperation("operation"); var operationGameObject = operation.gameObject; var plainGameObject = TestUtility.CreateGameObject("gameObject"); plainGameObject.transform.parent = operationGameObject.transform; var brush = TestUtility.CreateUndoableGameObjectWithBrush("brush"); var brushGameObject = brush.gameObject; brush.transform.parent = plainGameObject.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(operationGameObject); Assert.True(operation); Assert.True(plainGameObject); 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, operation.Node.Count); Assert.AreEqual(operation.Node.NodeID, brush.TopNode.Parent.NodeID); }
public IEnumerator OperationWithGameObject_AddChildOperation_OperationHasChild() { var operation1 = TestUtility.CreateUndoableGameObjectWithOperation(); var operation1GameObject = operation1.gameObject; var plainGameObject = TestUtility.CreateGameObject(); plainGameObject.transform.parent = operation1.transform; var operation2 = TestUtility.CreateUndoableGameObjectWithOperation(); var operation2GameObject = operation2.gameObject; operation2.transform.parent = plainGameObject.transform; Assert.AreEqual(0, CSGManager.TreeCount, "Expected 0 Trees to Exist"); Assert.AreEqual(0, CSGManager.TreeBranchCount, "Expected 0 TreeBranches to Exist"); Assert.AreEqual(0, CSGManager.TreeNodeCount, "Expected 0 TreeNodes to Exist"); yield return(null); Assert.True(operation1GameObject); Assert.True(operation1); Assert.True(operation2GameObject); Assert.True(operation2); Assert.AreEqual(2, CSGManager.TreeBranchCount, "Expected 2 TreeBranches to Exist"); Assert.AreEqual(3, CSGManager.TreeNodeCount, "Expected 3 TreeNodes to Exist"); Assert.AreEqual(1, operation1.Node.Count); Assert.AreEqual(operation2.Node.NodeID, operation1.Node[0].NodeID); }
public IEnumerator ModelWithWithGameObjectWithBrush_BrushHasModelAsTree() { var model = TestUtility.CreateUndoableGameObjectWithModel("model"); var modelGameObject = model.gameObject; var plainGameObject = TestUtility.CreateGameObject("gameObject"); plainGameObject.transform.parent = modelGameObject.transform; var brush = TestUtility.CreateUndoableGameObjectWithBrush("brush"); var brushGameObject = brush.gameObject; brush.transform.parent = plainGameObject.transform; Assert.AreEqual(0, CSGManager.TreeCount, "Expected 0 Trees 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(modelGameObject); Assert.True(model); Assert.True(plainGameObject); Assert.True(brushGameObject); Assert.True(brush); Assert.AreEqual(1, CSGManager.TreeCount, "Expected 1 Tree to Exist"); Assert.AreEqual(1, CSGManager.TreeBrushCount, "Expected 1 TreeBrush to Exist"); Assert.AreEqual(2, CSGManager.TreeNodeCount, "Expected 2 TreeNodes to Exist"); Assert.AreEqual(1, model.Node.Count); Assert.AreEqual(model.Node.NodeID, brush.TopNode.Tree.NodeID); }
public IEnumerator CompositeWithGameObject_AddChildComposite_CompositeHasChild() { var composite1 = TestUtility.CreateUndoableGameObjectWithComposite(); var composite1GameObject = composite1.gameObject; var plainGameObject = TestUtility.CreateGameObject(); plainGameObject.transform.parent = composite1.transform; var composite2 = TestUtility.CreateUndoableGameObjectWithComposite(); var composite2GameObject = composite2.gameObject; composite2.transform.parent = plainGameObject.transform; Assert.AreEqual(0, CSGManager.TreeCount, "Expected 0 Trees to Exist"); Assert.AreEqual(0, CSGManager.TreeBranchCount, "Expected 0 TreeBranches 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(composite2); Assert.AreEqual(2, CSGManager.TreeBranchCount, "Expected 2 TreeBranches to Exist"); Assert.AreEqual(3, CSGManager.TreeNodeCount, "Expected 3 TreeNodes to Exist"); Assert.AreEqual(1, composite1.Node.Count); Assert.AreEqual(composite2.Node.NodeID, composite1.Node[0].NodeID); }
public IEnumerator Operation1WithChildGameObjectWithChildBrush_MoveChildToOperation2_ChildHasOperation2AsParent() { var operation1 = TestUtility.CreateUndoableGameObjectWithOperation("operation1"); var operation1GameObject = operation1.gameObject; var operation2 = TestUtility.CreateUndoableGameObjectWithOperation("operation2"); var operation2GameObject = operation2.gameObject; var plainGameObject = TestUtility.CreateGameObject("gameObject"); plainGameObject.transform.parent = operation1.transform; var brush = TestUtility.CreateUndoableGameObjectWithBrush(); var brushGameObject = brush.gameObject; brush.transform.parent = plainGameObject.transform; Assert.True(operation1GameObject); Assert.True(operation1); Assert.True(operation2GameObject); Assert.True(operation2); Assert.True(brushGameObject); Assert.True(brush); 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.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.AreNotEqual(CSGTreeNode.InvalidNode.NodeID, operation2.Node.NodeID); Assert.AreNotEqual(CSGTreeNode.InvalidNode.NodeID, operation1.Node.NodeID); Assert.AreNotEqual(CSGTreeNode.InvalidNode.NodeID, brush.TopNode.NodeID); Assert.AreEqual(operation1.Node.NodeID, brush.TopNode.Parent.NodeID); Assert.AreEqual(1, operation1.Node.Count); Assert.AreEqual(0, operation2.Node.Count); brush.transform.parent = operation2.transform; yield return(null); Assert.AreEqual(operation2.Node.NodeID, brush.TopNode.Parent.NodeID); Assert.AreEqual(0, operation1.Node.Count); Assert.AreEqual(1, operation2.Node.Count); }
public IEnumerator Composite1WithChildGameObjectWithChildBrush_MoveChildToComposite2_ChildHasComposite2AsParent() { var composite1 = TestUtility.CreateUndoableGameObjectWithComposite("composite1"); var composite1GameObject = composite1.gameObject; var composite2 = TestUtility.CreateUndoableGameObjectWithComposite("composite2"); var composite2GameObject = composite2.gameObject; var plainGameObject = TestUtility.CreateGameObject("gameObject"); plainGameObject.transform.parent = composite1.transform; var brush = TestUtility.CreateUndoableGameObjectWithBrush(); var brushGameObject = brush.gameObject; brush.transform.parent = plainGameObject.transform; Assert.True(composite1GameObject); Assert.True(composite1); Assert.True(composite2GameObject); Assert.True(composite2); Assert.True(brushGameObject); Assert.True(brush); 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.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.AreNotEqual(CSGTreeNode.InvalidNode.NodeID, composite2.Node.NodeID); Assert.AreNotEqual(CSGTreeNode.InvalidNode.NodeID, composite1.Node.NodeID); Assert.AreNotEqual(CSGTreeNode.InvalidNode.NodeID, brush.TopNode.NodeID); Assert.AreEqual(composite1.Node.NodeID, brush.TopNode.Parent.NodeID); Assert.AreEqual(1, composite1.Node.Count); Assert.AreEqual(0, composite2.Node.Count); brush.transform.parent = composite2.transform; yield return(null); Assert.AreEqual(composite2.Node.NodeID, brush.TopNode.Parent.NodeID); Assert.AreEqual(0, composite1.Node.Count); Assert.AreEqual(1, composite2.Node.Count); }
public IEnumerator Model1WithChildGameObjectWithChildBrush_MoveChildToModel2_ChildHasModel2AsTree() { var model1 = TestUtility.CreateUndoableGameObjectWithModel("model1"); var model1GameObject = model1.gameObject; var model2 = TestUtility.CreateUndoableGameObjectWithModel("model2"); var model2GameObject = model2.gameObject; var plainGameObject = TestUtility.CreateGameObject("gameObject"); plainGameObject.transform.parent = model1.transform; var brush = TestUtility.CreateUndoableGameObjectWithBrush(); var brushGameObject = brush.gameObject; brush.transform.parent = plainGameObject.transform; Assert.True(model1GameObject); Assert.True(model1); Assert.True(model2GameObject); Assert.True(model2); Assert.True(brushGameObject); Assert.True(brush); Assert.AreEqual(0, CSGManager.TreeCount, "Expected 0 Trees 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.AreEqual(2, CSGManager.TreeCount, "Expected 2 Trees to Exist"); Assert.AreEqual(1, CSGManager.TreeBrushCount, "Expected 1 TreeBrush to Exist"); Assert.AreEqual(3, CSGManager.TreeNodeCount, "Expected 3 TreeNodes to Exist"); Assert.AreNotEqual(CSGTreeNode.InvalidNode.NodeID, model2.Node.NodeID); Assert.AreNotEqual(CSGTreeNode.InvalidNode.NodeID, model1.Node.NodeID); Assert.AreNotEqual(CSGTreeNode.InvalidNode.NodeID, brush.TopNode.NodeID); Assert.AreEqual(model1.Node.NodeID, brush.TopNode.Tree.NodeID); Assert.AreEqual(1, model1.Node.Count); Assert.AreEqual(0, model2.Node.Count); brush.transform.parent = model2.transform; yield return(null); Assert.AreEqual(model2.Node.NodeID, brush.TopNode.Tree.NodeID); Assert.AreEqual(0, model1.Node.Count); Assert.AreEqual(1, model2.Node.Count); }
public IEnumerator Operation1WithWithGameObjectWithBrush_AddOperation2ToGameObject_BrushHasOperation2AsParent() { var operation1 = TestUtility.CreateUndoableGameObjectWithOperation("operation1"); var operation1GameObject = operation1.gameObject; var operation2GameObject = TestUtility.CreateGameObject("operation2"); operation2GameObject.transform.parent = operation1GameObject.transform; var brush = TestUtility.CreateUndoableGameObjectWithBrush("brush"); var brushGameObject = brush.gameObject; brush.transform.parent = operation2GameObject.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(operation1GameObject); Assert.True(operation1); Assert.True(operation2GameObject); 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, operation1.Node.Count); Assert.AreEqual(operation1.Node.NodeID, brush.TopNode.Parent.NodeID); var operation2 = TestUtility.CreateUndoableOperationComponent(operation2GameObject); yield return(null); Assert.True(operation1GameObject); Assert.True(operation1); Assert.True(operation2GameObject); Assert.True(operation2); 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, operation2.Node.Count); Assert.AreEqual(1, operation1.Node.Count); Assert.AreEqual(operation1.Node.NodeID, operation2.Node.Parent.NodeID); Assert.AreEqual(operation2.Node.NodeID, brush.TopNode.Parent.NodeID); }
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); }
public IEnumerator Model1WithWithGameObjectWithBrush_AddModel2ToGameObject_BrushHasModel2AsTree() { var model1 = TestUtility.CreateUndoableGameObjectWithModel("model1"); var model1GameObject = model1.gameObject; var model2GameObject = TestUtility.CreateGameObject("model2"); model2GameObject.transform.parent = model1GameObject.transform; var brush = TestUtility.CreateUndoableGameObjectWithBrush("brush"); var brushGameObject = brush.gameObject; brush.transform.parent = model2GameObject.transform; Assert.AreEqual(0, CSGManager.TreeCount, "Expected 0 Trees 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(model1GameObject); Assert.True(model1); Assert.True(model2GameObject); Assert.True(brushGameObject); Assert.True(brush); Assert.AreEqual(1, CSGManager.TreeCount, "Expected 1 Tree to Exist"); Assert.AreEqual(1, CSGManager.TreeBrushCount, "Expected 1 TreeBrush to Exist"); Assert.AreEqual(2, CSGManager.TreeNodeCount, "Expected 2 TreeNodes to Exist"); Assert.AreEqual(1, model1.Node.Count); Assert.AreEqual(model1.Node.NodeID, brush.TopNode.Tree.NodeID); var model2 = TestUtility.CreateUndoableModelComponent(model2GameObject); yield return(null); Assert.True(model1GameObject); Assert.True(model1); Assert.True(model2GameObject); Assert.True(model2); Assert.True(brushGameObject); Assert.True(brush); Assert.AreEqual(2, CSGManager.TreeCount, "Expected 2 Trees to Exist"); Assert.AreEqual(1, CSGManager.TreeBrushCount, "Expected 1 TreeBrush to Exist"); Assert.AreEqual(3, CSGManager.TreeNodeCount, "Expected 3 TreeNodes to Exist"); Assert.AreEqual(0, model1.Node.Count); Assert.AreEqual(1, model2.Node.Count); Assert.AreEqual(model2.Node.NodeID, brush.TopNode.Tree.NodeID); }
public IEnumerator Model1WithChildBrush_MoveChildOutOfAnyModel_ChildHasNoTreeNodeSet() { var model1 = TestUtility.CreateUndoableGameObjectWithModel("model1"); var model1GameObject = model1.gameObject; var plainGameObject = TestUtility.CreateGameObject("gameObject"); var brush = TestUtility.CreateUndoableGameObjectWithBrush(); var brushGameObject = brush.gameObject; brush.transform.parent = model1.transform; Assert.True(model1GameObject); Assert.True(model1); Assert.True(plainGameObject); Assert.True(brushGameObject); Assert.True(brush); Assert.AreEqual(0, CSGManager.TreeCount, "Expected 0 Trees 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.AreEqual(1, CSGManager.TreeCount, "Expected 1 Tree to Exist"); Assert.AreEqual(1, CSGManager.TreeBrushCount, "Expected 1 TreeBrush to Exist"); Assert.AreEqual(2, CSGManager.TreeNodeCount, "Expected 2 TreeNodes to Exist"); Assert.AreNotEqual(CSGTreeNode.InvalidNode.NodeID, model1.Node.NodeID); Assert.AreNotEqual(CSGTreeNode.InvalidNode.NodeID, brush.TopNode.NodeID); Assert.AreEqual(model1.Node.NodeID, brush.TopNode.Tree.NodeID); Assert.AreEqual(1, model1.Node.Count); brush.transform.parent = plainGameObject.transform; yield return(null); Assert.AreEqual(0, model1.Node.Count); var defaultModel = brush.hierarchyItem.sceneHierarchy.DefaultModel; Assert.AreEqual(defaultModel.NodeID, brush.TopNode.Tree.NodeID); }
public IEnumerator GameObjectWithBrush_AddModelToGameObject_BrushHasModelAsTree() { var modelGameObject = TestUtility.CreateGameObject("model"); var brush = TestUtility.CreateUndoableGameObjectWithBrush("brush"); var brushGameObject = brush.gameObject; brush.transform.parent = modelGameObject.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(modelGameObject); Assert.True(brushGameObject); Assert.True(brush); Assert.AreEqual(1, CSGManager.TreeCount, "Expected 1 Tree to Exist"); // default model Assert.AreEqual(1, CSGManager.TreeBrushCount, "Expected 1 TreeBrush to Exist"); Assert.AreEqual(2, CSGManager.TreeNodeCount, "Expected 2 TreeNodes to Exist"); Assert.AreEqual(CSGTreeNode.InvalidNode.NodeID, brush.TopNode.Parent.NodeID); var model = TestUtility.CreateUndoableModelComponent(modelGameObject); yield return(null); Assert.True(modelGameObject); Assert.True(model); Assert.True(brushGameObject); Assert.True(brush); Assert.AreEqual(1, CSGManager.TreeCount, "Expected 1 Tree to Exist"); // new model only, default model should've been destroyed Assert.AreEqual(1, CSGManager.TreeBrushCount, "Expected 1 TreeBrush to Exist"); Assert.AreEqual(2, CSGManager.TreeNodeCount, "Expected 2 TreeNodes to Exist"); Assert.AreEqual(1, model.Node.Count); Assert.AreEqual(model.Node.NodeID, brush.TopNode.Tree.NodeID); }