use of org.kie.workbench.common.stunner.core.client.canvas.command.AddChildNodeCommand in project kie-wb-common by kiegroup.
the class ElementBuilderControlImplTest method getElementCommandsContainment.
@Test
public void getElementCommandsContainment() {
ParentAssignment parentAssignment = ParentAssignment.CONTAINMENT;
elementBuilderControl.getElementCommands(node, parent, parentAssignment, X, Y, callback);
verify(callback).onComplete(any(), commandsCapture.capture());
List<Command<AbstractCanvasHandler, CanvasViolation>> commands = commandsCapture.getValue();
assertTrue(commands.get(0) instanceof AddChildNodeCommand);
assertTrue(commands.get(1) instanceof UpdateElementPositionCommand);
verify(canvasCommandFactory).addChildNode(parent, node, SHAPE_SET_ID);
ArgumentCaptor<Point2D> positionCaptor = ArgumentCaptor.forClass(Point2D.class);
verify(canvasCommandFactory).updatePosition(eq(node), positionCaptor.capture());
assertEquals(positionCaptor.getValue(), new Point2D(X, Y));
}
use of org.kie.workbench.common.stunner.core.client.canvas.command.AddChildNodeCommand in project kie-wb-common by kiegroup.
the class ElementBuilderControlImplTest method getElementCommandsDocked.
@Test
public void getElementCommandsDocked() {
ParentAssignment parentAssignment = ParentAssignment.DOCKING;
elementBuilderControl.getElementCommands(node, parent, parentAssignment, X, Y, callback);
verify(callback).onComplete(any(), commandsCapture.capture());
List<Command<AbstractCanvasHandler, CanvasViolation>> commands = commandsCapture.getValue();
assertTrue(commands.get(0) instanceof AddChildNodeCommand);
assertTrue(commands.get(1) instanceof UpdateElementPositionCommand);
assertTrue(commands.get(2) instanceof UpdateDockNodeCommand);
verify(canvasCommandFactory).addChildNode(grandParent, node, SHAPE_SET_ID);
ArgumentCaptor<Point2D> positionCaptor = ArgumentCaptor.forClass(Point2D.class);
verify(canvasCommandFactory).updatePosition(eq(node), positionCaptor.capture());
assertEquals(positionCaptor.getValue(), new Point2D(X, Y));
verify(canvasCommandFactory).addChildNode(grandParent, node, SHAPE_SET_ID);
}
Aggregations