use of org.kie.workbench.common.dmn.client.shape.view.decisionservice.DecisionServiceSVGShapeView.MoveDividerControlHandle in project kie-wb-common by kiegroup.
the class DecisionServiceSVGShapeViewTest method testDragConstraintHandler.
@Test
@SuppressWarnings("unchecked")
public void testDragConstraintHandler() {
final MoveDividerControlHandle moveDividerControlHandle = getMoveDividerControlHandle();
final IPrimitive control = moveDividerControlHandle.getControl();
when(dragContext.getNode()).thenReturn(control);
final MoveDividerDragHandler dragConstraints = (MoveDividerDragHandler) getMoveDividerControlHandle().getControl().getDragConstraints();
dragConstraints.startDrag(dragContext);
final DragBounds dragBounds = control.getDragBounds();
assertThat(dragBounds.getX1()).isEqualTo(0.0);
assertThat(dragBounds.getY1()).isEqualTo(GeneralRectangleDimensionsSet.DEFAULT_HEIGHT);
assertThat(dragBounds.getX2()).isEqualTo(WIDTH);
assertThat(dragBounds.getY2()).isEqualTo(HEIGHT - GeneralRectangleDimensionsSet.DEFAULT_HEIGHT);
}
use of org.kie.workbench.common.dmn.client.shape.view.decisionservice.DecisionServiceSVGShapeView.MoveDividerControlHandle in project kie-wb-common by kiegroup.
the class DecisionServiceSVGShapeViewTest method testShapeControlResizeHandles.
@Test
public void testShapeControlResizeHandles() {
final IControlHandleFactory controlHandleFactory = view.getPath().getControlHandleFactory();
final IControlHandleList controlHandles = controlHandleFactory.getControlHandles(Collections.singletonList(RESIZE)).get(RESIZE);
assertThat(controlHandles.size()).isGreaterThan(0);
assertThat(controlHandles).areExactly(1, new Condition<>(ch -> ch instanceof MoveDividerControlHandle, "Is a MoveDividerControlHandle"));
}
use of org.kie.workbench.common.dmn.client.shape.view.decisionservice.DecisionServiceSVGShapeView.MoveDividerControlHandle in project kie-wb-common by kiegroup.
the class DecisionServiceSVGShapeViewTest method testShapeControlResizeHandlersWithList.
@Test
public void testShapeControlResizeHandlersWithList() {
final IControlHandleFactory controlHandleFactory = view.getPath().getControlHandleFactory();
final IControlHandleList controlHandles = controlHandleFactory.getControlHandles(RESIZE).get(RESIZE);
assertThat(controlHandles.size()).isGreaterThan(0);
assertThat(controlHandles).areExactly(1, new Condition<>(ch -> ch instanceof MoveDividerControlHandle, "Is a MoveDividerControlHandle"));
}
use of org.kie.workbench.common.dmn.client.shape.view.decisionservice.DecisionServiceSVGShapeView.MoveDividerControlHandle in project kie-wb-common by kiegroup.
the class DecisionServiceSVGShapeViewTest method getMoveDividerControlHandle.
private MoveDividerControlHandle getMoveDividerControlHandle() {
final IControlHandleFactory controlHandleFactory = view.getPath().getControlHandleFactory();
final IControlHandleList controlHandles = controlHandleFactory.getControlHandles(RESIZE).get(RESIZE);
return StreamSupport.stream(controlHandles.spliterator(), false).filter(ch -> ch instanceof MoveDividerControlHandle).map(ch -> (MoveDividerControlHandle) ch).findFirst().get();
}
use of org.kie.workbench.common.dmn.client.shape.view.decisionservice.DecisionServiceSVGShapeView.MoveDividerControlHandle in project kie-wb-common by kiegroup.
the class DecisionServiceSVGShapeViewTest method testShapeControlResizeHandlerMoveDividerEvents.
@Test
public void testShapeControlResizeHandlerMoveDividerEvents() {
final MoveDividerControlHandle moveDividerControlHandle = getMoveDividerControlHandle();
view.addDividerDragHandler(dragHandler);
moveDividerControlHandle.getControl().fireEvent(nodeDragStartEvent);
verify(dragHandler).start(any(DragEvent.class));
moveDividerControlHandle.getControl().fireEvent(nodeDragMoveEvent);
verify(dragHandler).handle(any(DragEvent.class));
moveDividerControlHandle.getControl().fireEvent(nodeDragEndEvent);
verify(dragHandler).end(any(DragEvent.class));
}
Aggregations