Search in sources :

Example 1 with Transform

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

the class CanvasDefinitionTooltipTest method testSetTransform.

@Test
public void testSetTransform() {
    final Transform transform = mock(Transform.class);
    tested.setTransform(transform);
    verify(textTooltip, times(1)).setTransform(eq(transform));
}
Also used : Transform(org.kie.workbench.common.stunner.core.client.canvas.Transform) Test(org.junit.Test)

Example 2 with Transform

use of org.kie.workbench.common.stunner.core.client.canvas.Transform 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)

Aggregations

Test (org.junit.Test)2 Transform (org.kie.workbench.common.stunner.core.client.canvas.Transform)2 AbstractCanvas (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas)1 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)1 Layer (org.kie.workbench.common.stunner.core.client.canvas.Layer)1 Point2D (org.kie.workbench.common.stunner.core.graph.content.view.Point2D)1