use of org.kie.workbench.common.stunner.core.client.canvas.event.registration.CanvasShapeRemovedEvent in project kie-wb-common by kiegroup.
the class MapSelectionControlTest method testOnShapeRemovedEvent.
@Test
public void testOnShapeRemovedEvent() {
tested.enable(canvasHandler);
tested.register(element);
tested.select(element);
CanvasShapeRemovedEvent shapeRemovedEvent = new CanvasShapeRemovedEvent(canvas, shape);
tested.onShapeRemoved(shapeRemovedEvent);
assertTrue(tested.getSelectedItems().isEmpty());
verify(shape, times(1)).applyState(eq(ShapeState.SELECTED));
verify(shape, times(1)).applyState(eq(ShapeState.NONE));
verify(shape, never()).applyState(eq(ShapeState.INVALID));
verify(shape, never()).applyState(eq(ShapeState.HIGHLIGHT));
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.registration.CanvasShapeRemovedEvent in project kie-wb-common by kiegroup.
the class ToolboxControlTest method testShapeRemovedEvent.
@Test
public void testShapeRemovedEvent() {
final String uuid = "uuid1";
when(delegated.isActive(eq(uuid))).thenReturn(true);
final Shape shape = mock(Shape.class);
when(shape.getUUID()).thenReturn(uuid);
final CanvasShapeRemovedEvent event = new CanvasShapeRemovedEvent(canvas, shape);
tested.onCanvasShapeRemovedEvent(event);
verify(delegated, times(1)).destroy();
verify(delegated, never()).show(any(Element.class));
verify(delegated, never()).show(anyString());
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.registration.CanvasShapeRemovedEvent in project kie-wb-common by kiegroup.
the class AbstractCanvas method deleteShape.
@Override
public Canvas deleteShape(final Shape shape) {
deleteTransientShape(shape);
fireCanvasShapeRemoved(shape);
shapes.remove(shape);
canvasShapeRemovedEvent.fire(new CanvasShapeRemovedEvent(this, shape));
return this;
}
Aggregations