Search in sources :

Example 6 with AbstractCanvas

use of org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas in project kie-wb-common by kiegroup.

the class CanvasDefinitionTooltipTest method testConfigure.

@Test
public void testConfigure() {
    final AbstractCanvasHandler canvasHandler = mock(AbstractCanvasHandler.class);
    final AbstractCanvas canvas = mock(AbstractCanvas.class);
    final AbstractCanvas.View canvasView = mock(AbstractCanvas.View.class);
    final Layer layer = mock(Layer.class);
    final Transform transform = mock(Transform.class);
    when(canvasHandler.getCanvas()).thenReturn(canvas);
    when(canvasHandler.getAbstractCanvas()).thenReturn(canvas);
    when(canvas.getLayer()).thenReturn(layer);
    when(layer.getTransform()).thenReturn(transform);
    when(canvas.getView()).thenReturn(canvasView);
    when(canvasView.getAbsoluteX()).thenReturn(220d);
    when(canvasView.getAbsoluteY()).thenReturn(50.5d);
    final CanvasDefinitionTooltip t = tested.configure(canvasHandler);
    assertEquals(tested, t);
    verify(textTooltip, times(1)).setTransform(eq(transform));
    final ArgumentCaptor<Point2D> pointCaptor = ArgumentCaptor.forClass(Point2D.class);
    verify(textTooltip, times(1)).setCanvasLocation(pointCaptor.capture());
    final Point2D point = pointCaptor.getValue();
    assertEquals(220d, point.getX(), 0);
    assertEquals(50.5d, point.getY(), 0);
}
Also used : AbstractCanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler) AbstractCanvas(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas) Point2D(org.kie.workbench.common.stunner.core.graph.content.view.Point2D) Transform(org.kie.workbench.common.stunner.core.client.canvas.Transform) Layer(org.kie.workbench.common.stunner.core.client.canvas.Layer) Test(org.junit.Test)

Example 7 with AbstractCanvas

use of org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas in project kie-wb-common by kiegroup.

the class SessionPreviewCanvasHandlerProxyTest method checkHandleDelegatesToWrapped.

@Test
@SuppressWarnings("unchecked")
public void checkHandleDelegatesToWrapped() {
    final AbstractCanvas canvas = mock(AbstractCanvas.class);
    proxy.handle(canvas);
    verify(wrapped).handle(eq(canvas));
}
Also used : AbstractCanvas(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas) Test(org.junit.Test)

Aggregations

AbstractCanvas (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas)7 Test (org.junit.Test)2 LienzoLayer (org.kie.workbench.common.stunner.client.lienzo.canvas.LienzoLayer)2 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)2 Shape (org.kie.workbench.common.stunner.core.client.shape.Shape)2 Node (org.kie.workbench.common.stunner.core.graph.Node)2 Layer (org.kie.workbench.common.stunner.core.client.canvas.Layer)1 Transform (org.kie.workbench.common.stunner.core.client.canvas.Transform)1 EdgeShape (org.kie.workbench.common.stunner.core.client.shape.EdgeShape)1 ElementShape (org.kie.workbench.common.stunner.core.client.shape.ElementShape)1 Edge (org.kie.workbench.common.stunner.core.graph.Edge)1 Element (org.kie.workbench.common.stunner.core.graph.Element)1 Point2D (org.kie.workbench.common.stunner.core.graph.content.view.Point2D)1 View (org.kie.workbench.common.stunner.core.graph.content.view.View)1 ViewConnector (org.kie.workbench.common.stunner.core.graph.content.view.ViewConnector)1