Search in sources :

Example 1 with NodeMouseUpHandler

use of com.ait.lienzo.client.core.event.NodeMouseUpHandler in project kie-wb-common by kiegroup.

the class ControlPointControlImplTest method testStunnerControlPointsAcceptorAdd.

@Test
public void testStunnerControlPointsAcceptorAdd() {
    final HandlerRegistration mouseUpHandlerRegistration = mock(HandlerRegistration.class);
    final NodeMouseUpHandler[] mouseUpHandlerCaptured = new NodeMouseUpHandler[1];
    doAnswer(invocationOnMock -> {
        mouseUpHandlerCaptured[0] = (NodeMouseUpHandler) invocationOnMock.getArguments()[0];
        mouseUpHandlerCaptured[0].onNodeMouseUp(mock(NodeMouseUpEvent.class));
        return mouseUpHandlerRegistration;
    }).when(layer).addNodeMouseUpHandler(any(NodeMouseUpHandler.class));
    ControlPointControl control = mock(ControlPointControl.class);
    ControlPointControlImpl.StunnerControlPointsAcceptor acceptor = createStunnerControlPointsAcceptor(control);
    boolean addResult = acceptor.add(connector, 1, new com.ait.lienzo.client.core.types.Point2D(2, 2));
    assertTrue(addResult);
    verify(connector, times(1)).addControlPoint(eq(2d), eq(2d), eq(1));
    verify(control, times(1)).addControlPoint(eq(edge), eq(ControlPoint.build(2, 2)), eq(0));
}
Also used : HandlerRegistration(com.google.gwt.event.shared.HandlerRegistration) NodeMouseUpEvent(com.ait.lienzo.client.core.event.NodeMouseUpEvent) ControlPointControl(org.kie.workbench.common.stunner.core.client.canvas.controls.connection.ControlPointControl) NodeMouseUpHandler(com.ait.lienzo.client.core.event.NodeMouseUpHandler) Test(org.junit.Test)

Aggregations

NodeMouseUpEvent (com.ait.lienzo.client.core.event.NodeMouseUpEvent)1 NodeMouseUpHandler (com.ait.lienzo.client.core.event.NodeMouseUpHandler)1 HandlerRegistration (com.google.gwt.event.shared.HandlerRegistration)1 Test (org.junit.Test)1 ControlPointControl (org.kie.workbench.common.stunner.core.client.canvas.controls.connection.ControlPointControl)1