use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class CaseManagementCanvasViewTest method addWiresShape.
@Test
public void addWiresShape() {
final MockCaseManagementShape shape = new MockCaseManagementShape();
final String uuid = shape.uuid();
shape.setUUID(uuid);
view.addShape(shape);
final WiresShape registeredShape = view.getWiresManager().getShape(uuid);
assertNotNull(registeredShape);
assertEquals(shape, registeredShape);
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class CaseManagementContainmentAcceptorControlImplTest method checkContainmentAllowed.
@Test
public void checkContainmentAllowed() {
control.enable(canvasHandler);
final IContainmentAcceptor containmentAcceptor = getContainmentAcceptor();
final WiresShape parentShape = makeWiresShape(PARENT_UUID);
final WiresShape childShape = makeWiresShape(CANDIDATE_UUID);
assertTrue(containmentAcceptor.containmentAllowed(parentShape, new WiresShape[] { childShape }));
verify(canvasCommandFactory, times(1)).removeChild(any(Node.class), any(Node.class));
verify(canvasCommandFactory, times(1)).setChildNode(any(Node.class), any(Node.class));
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class CaseManagementContainmentAcceptorControlImplTest method checkInterceptingLayoutHandlerRemove.
@Test
public void checkInterceptingLayoutHandlerRemove() {
control.enable(canvasHandler);
final WiresShape parentShape = makeWiresShape();
final WiresShape childShape = makeWiresShape();
final ILayoutHandler layoutHandler = getILayoutHandler(parentShape, childShape);
layoutHandler.remove(childShape, parentShape);
assertTrue(parentShape.getLayoutHandler() instanceof ILayoutHandler.DefaultLayoutHandler);
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class CaseManagementContainmentControlTest method setup.
@Before
public void setup() {
layer = spy(new Layer());
shape = spy(new MockCaseManagementShape());
final Group shapeGroup = mock(Group.class);
when(shapeGroup.getLayer()).thenReturn(layer);
when(shape.getGroup()).thenReturn(shapeGroup);
when(shape.getWiresManager()).thenReturn(wiresManager);
when(shape.getGhost()).thenReturn(ghost);
when(wiresManager.getContainmentAcceptor()).thenReturn(containmentAcceptor);
when(parentPickerControl.getPickerOptions()).thenReturn(PICKER_OPTIONS);
when(parentPickerControl.getShapeLocationControl()).thenReturn(shapeLocationControl);
when(containmentControl.getParentPickerControl()).thenReturn(parentPickerControl);
when(containmentControl.getShape()).thenReturn(shape);
when(containmentControl.getParent()).thenReturn(parent);
final NFastArrayList<WiresShape> children = new NFastArrayList<>();
children.add(shape);
children.add(ghost);
when(parent.getChildShapes()).thenReturn(children);
when(parent.getLayoutHandler()).thenReturn(parentLayoutHandler);
when(parent.getIndex(eq(shape))).thenReturn(0);
when(parent.getGroup()).thenReturn(new Group());
when(state.getGhost()).thenReturn(Optional.of(ghost));
when(state.getOriginalParent()).thenReturn(Optional.of(parent));
when(state.getOriginalIndex()).thenReturn(Optional.of(0));
control = new CaseManagementContainmentControl(containmentControl, state);
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project kie-wb-common by kiegroup.
the class CaseManagementContainmentControlTest method testOnMoveStartButNoCMShape.
@Test
public void testOnMoveStartButNoCMShape() {
final WiresShape aShape = mock(WiresShape.class);
when(containmentControl.getShape()).thenReturn(aShape);
final double x = 15.5d;
final double y = 21.63d;
control.onMoveStart(x, y);
verify(containmentControl, times(1)).onMoveStart(eq(x), eq(y));
verify(state, times(1)).setGhost(eq(Optional.empty()));
verify(state, times(1)).setOriginalIndex(eq(Optional.empty()));
verify(state, times(1)).setOriginalParent(eq(Optional.empty()));
verify(parent, never()).logicallyReplace(any(WiresShape.class), any(WiresShape.class));
}
Aggregations