use of org.kie.workbench.common.stunner.core.client.shape.ShapeViewExtStub in project kie-wb-common by kiegroup.
the class LienzoSelectionControlTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
when(element.getUUID()).thenReturn(ELEMENT_UUID);
when(element.getContent()).thenReturn(new ViewImpl<>(definition, BoundsImpl.build(0, 0, 10, 10)));
when(canvasHandler.getCanvas()).thenReturn(canvas);
when(canvas.getLayer()).thenReturn(layer);
when(canvas.getShape(eq(ELEMENT_UUID))).thenReturn(shape);
when(canvas.getShapes()).thenReturn(Collections.singletonList(shape));
when(shape.getUUID()).thenReturn(ELEMENT_UUID);
when(selectionControl.isEnabled()).thenReturn(true);
when(selectionControl.getCanvasHandler()).thenReturn(canvasHandler);
when(selectionControl.getCanvas()).thenReturn(canvas);
when(shapeViewHandlers.supports(any(ViewEventType.class))).thenReturn(true);
shapeView = new ShapeViewExtStub(shapeViewHandlers, null);
when(shape.getShapeView()).thenReturn(shapeView);
tested = new LienzoSelectionControl<>(selectionControl, canvasSelectionEvent, clearSelectionEvent);
}
use of org.kie.workbench.common.stunner.core.client.shape.ShapeViewExtStub in project kie-wb-common by kiegroup.
the class ResizeControlImplTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
this.canvasCommandFactory = new DefaultCanvasCommandFactory(null, null);
this.shapeView = new ShapeViewExtStub(shapeEventHandler, hasControlPoints);
when(canvasHandler.getDefinitionManager()).thenReturn(definitionManager);
when(definitionManager.adapters()).thenReturn(adapterManager);
when(adapterManager.registry()).thenReturn(adapterRegistry);
when(adapterManager.forProperty()).thenReturn(propertyAdapter);
when(adapterRegistry.getDefinitionAdapter(any(Class.class))).thenReturn(definitionAdapter);
when(adapterRegistry.getPropertyAdapter(anyObject())).thenReturn(propertyAdapter);
when(definitionAdapter.getId(eq(definition))).thenReturn(DEF_ID);
when(propertyAdapter.getId(eq(wProperty))).thenReturn(W_PROPERTY_ID);
when(propertyAdapter.getId(eq(hProperty))).thenReturn(H_PROPERTY_ID);
when(propertyAdapter.getId(eq(rProperty))).thenReturn(R_PROPERTY_ID);
when(definitionAdapter.getMetaProperty(eq(PropertyMetaTypes.WIDTH), eq(definition))).thenReturn(wProperty);
when(definitionAdapter.getMetaProperty(eq(PropertyMetaTypes.HEIGHT), eq(definition))).thenReturn(hProperty);
when(definitionAdapter.getMetaProperty(eq(PropertyMetaTypes.RADIUS), eq(definition))).thenReturn(rProperty);
when(element.getUUID()).thenReturn(ELEMENT_UUID);
when(canvasHandler.getDiagram()).thenReturn(diagram);
when(element.getContent()).thenReturn(elementContent);
when(elementContent.getDefinition()).thenReturn(definition);
when(elementContent.getBounds()).thenReturn(ELEMENT_BOUNDS);
when(graph.getContent()).thenReturn(graphContent);
when(graphContent.getBounds()).thenReturn(GRAPH_BOUNDS);
when(diagram.getGraph()).thenReturn(graph);
when(diagram.getMetadata()).thenReturn(metadata);
when(metadata.getCanvasRootUUID()).thenReturn(ROOT_UUID);
when(canvasHandler.getCanvas()).thenReturn(canvas);
when(canvas.getLayer()).thenReturn(layer);
when(canvas.getShape(eq(ELEMENT_UUID))).thenReturn(shape);
when(canvas.getShapes()).thenReturn(Collections.singletonList(shape));
when(shape.getUUID()).thenReturn(ELEMENT_UUID);
when(shape.getShapeView()).thenReturn(shapeView);
when(shapeEventHandler.supports(eq(ViewEventType.RESIZE))).thenReturn(true);
this.tested = new ResizeControlImpl(canvasCommandFactory);
tested.setCommandManagerProvider(() -> commandManager);
}
Aggregations