public VisualTask(ITask task, IGraphContainer parentContainer) { Task = task; BindTask(); var container = new GraphContainerVertical(); AddBox(container); if (task.Children != null) { var childContainer = new GraphContainerHorizontal(); foreach (var child in task.Children) { _children.Add(new VisualTask(child, childContainer)); } AddDivider(container, childContainer); container.AddBox(childContainer); } parentContainer.AddBox(container); _printer = new NodePrintController(this); }
public void On_nested_positions_on_added_boxes() { var box = new GraphBox(); box.SetSize(50, 50); var nestedContainer = new GraphContainerHorizontal(); nestedContainer.AddBox(box); _container.SetGlobalPosition(50, 100); _container.AddBox(nestedContainer); Assert.AreEqual(100, box.GlobalPositionY); }
public void It_should_align_a_child_in_the_center() { _childBox.Width.Returns(50); var children = new GraphContainerHorizontal(); children.AddBox(A.GraphBoxStub().WithSize(50, 50).Build()); children.AddBox(A.GraphBoxStub().WithSize(50, 50).Build()); var wrapper = new GraphContainerVertical(); wrapper.AddBox(_childBox); wrapper.AddBox(children); _container.AddBox(wrapper); _container.CenterAlignChildren(); _childBox.Received(1).AddGlobalPosition(25, 0); }
public void Root_should_push_down_the_next_node() { var tree = new GraphContainerVertical(); tree.SetGlobalPosition(300, 0); var nodeWrapper = new GraphContainerVertical(); var box = new GraphBox(); box.SetSize(50, 50); var childrenContainer = new GraphContainerHorizontal(); var childWrapper = new GraphContainerVertical(); var childBox = new GraphBox(); childBox.SetSize(50, 50); nodeWrapper.AddBox(box); Assert.AreEqual(50, nodeWrapper.Height); Assert.AreEqual(50, nodeWrapper.Width); Assert.AreEqual(0, box.GlobalPositionY); childWrapper.AddBox(childBox); Assert.AreEqual(50, nodeWrapper.Height); Assert.AreEqual(50, nodeWrapper.Width); childrenContainer.AddBox(childWrapper); Assert.AreEqual(50, nodeWrapper.Height); Assert.AreEqual(50, nodeWrapper.Width); Assert.AreEqual(0, childrenContainer.GlobalPositionY); nodeWrapper.AddBox(childrenContainer); Assert.AreEqual(100, nodeWrapper.Height); Assert.AreEqual(50, nodeWrapper.Width); Assert.AreEqual(50, childrenContainer.GlobalPositionY); tree.AddBox(nodeWrapper); Assert.AreEqual(0, nodeWrapper.LocalPositionY); Assert.AreEqual(0, nodeWrapper.GlobalPositionY); Assert.AreEqual(50, childrenContainer.GlobalPositionY); Assert.AreEqual(0, box.GlobalPositionY); }
public void On_deeply_nested_child_positions_on_added_boxes() { var boxA = new GraphBox(); boxA.SetSize(50, 50); var boxB = new GraphBox(); boxB.SetSize(50, 50); var nestedContainer = new GraphContainerHorizontal(); nestedContainer.SetGlobalPosition(100, 50); nestedContainer.AddBox(boxA); nestedContainer.AddBox(boxB); _container.SetGlobalPosition(50, 100); _container.AddBox(nestedContainer); Assert.AreEqual(200, boxB.GlobalPositionX); }
public void BeforeEach() { _container = new GraphContainerHorizontal(); _childBox = A.GraphBoxStub().WithSize(100, 50).Build(); }