Search in sources :

Example 1 with ShapeDefFunctionalFactory

use of org.kie.workbench.common.stunner.core.client.shape.factory.ShapeDefFunctionalFactory in project kie-wb-common by kiegroup.

the class CaseManagementShapeDefFactoryTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
    this.pictureShapeView = new PictureShapeView(new MultiPath().rect(0, 0, 10, 10));
    when(stageView.setWidth(anyDouble())).thenReturn(stageView);
    when(stageView.setHeight(anyDouble())).thenReturn(stageView);
    when(basicShapeViewFactory.pictureFromUri(any(SafeUri.class), anyDouble(), anyDouble())).thenReturn(pictureShapeView);
    when(basicShapeViewFactory.connector(anyDouble(), anyDouble(), anyDouble(), anyDouble())).thenReturn(connectorShapeView);
    when(cmShapeViewFactory.newNullView()).thenReturn(nullView);
    when(cmShapeViewFactory.newStageView(anyDouble(), anyDouble(), anyDouble())).thenReturn(stageView);
    when(cmShapeViewFactory.newActivityView(anyDouble(), anyDouble())).thenReturn(activityView);
    when(cmShapeViewFactory.newDiagramView(anyDouble(), anyDouble())).thenReturn(diagramView);
    this.tested = new CaseManagementShapeDefFactory(cmShapeViewFactory, basicShapeViewFactory, new ShapeDefFunctionalFactory<>());
    this.tested.init();
}
Also used : MultiPath(com.ait.lienzo.client.core.shape.MultiPath) ShapeDefFunctionalFactory(org.kie.workbench.common.stunner.core.client.shape.factory.ShapeDefFunctionalFactory) SafeUri(com.google.gwt.safehtml.shared.SafeUri) PictureShapeView(org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView) Before(org.junit.Before)

Example 2 with ShapeDefFunctionalFactory

use of org.kie.workbench.common.stunner.core.client.shape.factory.ShapeDefFunctionalFactory in project kie-wb-common by kiegroup.

the class SVGShapeFactoryTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
    this.functionalFactory = new ShapeDefFunctionalFactory();
    this.tested = spy(new SVGShapeFactory(beanManager, functionalFactory));
    this.tested.init();
    when(svgShapeDef.getViewFactoryType()).thenReturn(Object.class);
    when(svgMutableShapeDef.getViewFactoryType()).thenReturn(Object.class);
    when(svgMutableShapeDef.titleHandler()).thenReturn(Optional.empty());
    when(svgMutableShapeDef.fontHandler()).thenReturn(Optional.empty());
    when(svgMutableShapeDef.sizeHandler()).thenReturn(Optional.empty());
    when(svgMutableShapeDef.viewHandler()).thenReturn(viewHandler);
    when(shapeView.getShapeStateHandler()).thenReturn(shapeViewStateHandler);
    when(shapeViewImpl.getShapeStateHandler()).thenReturn(shapeViewImplStateHandler);
    doAnswer(invocationOnMock -> SVGShapeDef.class).when(svgShapeDef).getType();
    doAnswer(invocationOnMock -> SVGShapeViewDef.class).when(svgMutableShapeDef).getType();
    doAnswer(invocationOnMock -> shapeView).when(svgShapeDef).newViewInstance(eq(viewFactory), any(Object.class));
    doAnswer(invocationOnMock -> shapeViewImpl).when(svgMutableShapeDef).newViewInstance(eq(viewFactory), any(Object.class));
}
Also used : ShapeDefFunctionalFactory(org.kie.workbench.common.stunner.core.client.shape.factory.ShapeDefFunctionalFactory) Before(org.junit.Before)

Aggregations

Before (org.junit.Before)2 ShapeDefFunctionalFactory (org.kie.workbench.common.stunner.core.client.shape.factory.ShapeDefFunctionalFactory)2 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1 SafeUri (com.google.gwt.safehtml.shared.SafeUri)1 PictureShapeView (org.kie.workbench.common.stunner.shapes.client.view.PictureShapeView)1