Search in sources :

Example 1 with EdgeBuildRequest

use of org.kie.workbench.common.stunner.core.client.canvas.controls.builder.request.EdgeBuildRequest in project kie-wb-common by kiegroup.

the class CreateConnectorActionTest method testMoveDrag.

private void testMoveDrag(DragProxyCallback callback) {
    // Verify drag proxy move.
    doAnswer(invocationOnMock -> {
        final EdgeBuildRequest request = (EdgeBuildRequest) invocationOnMock.getArguments()[0];
        return edge == request.getEdge() && element == request.getInNode() && targetNode == request.getOutNode();
    }).when(edgeBuilderControl).allows(any(EdgeBuildRequest.class));
    callback.onMove(100, 500);
    verify(edgeBuilderControl, times(1)).allows(any(EdgeBuildRequest.class));
    verify(canvasHighlight, times(1)).unhighLight();
    verify(canvasHighlight, times(1)).highLight(eq(targetNode));
}
Also used : EdgeBuildRequest(org.kie.workbench.common.stunner.core.client.canvas.controls.builder.request.EdgeBuildRequest)

Example 2 with EdgeBuildRequest

use of org.kie.workbench.common.stunner.core.client.canvas.controls.builder.request.EdgeBuildRequest in project kie-wb-common by kiegroup.

the class CreateConnectorActionTest method testCompleteDrag.

private void testCompleteDrag(DragProxyCallback callback) {
    // Verify drag proxy complete.
    callback.onComplete(100, 500);
    final ArgumentCaptor<EdgeBuildRequest> edgeBuildRequestArgumentCaptor = ArgumentCaptor.forClass(EdgeBuildRequest.class);
    final ArgumentCaptor<BuilderControl.BuildCallback> completeCallbackCaptor = ArgumentCaptor.forClass(BuilderControl.BuildCallback.class);
    verify(edgeBuilderControl, times(1)).build(edgeBuildRequestArgumentCaptor.capture(), completeCallbackCaptor.capture());
    final EdgeBuildRequest edgeBuildRequest = edgeBuildRequestArgumentCaptor.getValue();
    assertEquals(edge, edgeBuildRequest.getEdge());
    assertEquals(element, edgeBuildRequest.getInNode());
    assertEquals(targetNode, edgeBuildRequest.getOutNode());
    final BuilderControl.BuildCallback completeCallback = completeCallbackCaptor.getValue();
    completeCallback.onSuccess(TARGET_NODE_UUID);
    verify(edgeBuilderControl, times(1)).disable();
    verify(edgeBuilderControl, times(1)).setCommandManagerProvider(eq(null));
    verify(canvasHighlight, times(1)).destroy();
}
Also used : EdgeBuilderControl(org.kie.workbench.common.stunner.core.client.canvas.controls.builder.EdgeBuilderControl) BuilderControl(org.kie.workbench.common.stunner.core.client.canvas.controls.builder.BuilderControl) EdgeBuildRequest(org.kie.workbench.common.stunner.core.client.canvas.controls.builder.request.EdgeBuildRequest)

Aggregations

EdgeBuildRequest (org.kie.workbench.common.stunner.core.client.canvas.controls.builder.request.EdgeBuildRequest)2 BuilderControl (org.kie.workbench.common.stunner.core.client.canvas.controls.builder.BuilderControl)1 EdgeBuilderControl (org.kie.workbench.common.stunner.core.client.canvas.controls.builder.EdgeBuilderControl)1