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));
}
Aggregations