use of com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method checkRegisteredNodeMouseDoubleClickHandlerNotOverHeader.
@Test
@SuppressWarnings("unchecked")
public void checkRegisteredNodeMouseDoubleClickHandlerNotOverHeader() {
final ArgumentCaptor<NodeMouseDoubleClickHandler> nodeMouseDoubleClickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseDoubleClickHandler.class);
// dtPresenter.setContent(...) is called by the base tests @Before method
verify(view, times(1)).registerNodeMouseDoubleClickHandler(nodeMouseDoubleClickHandlerArgumentCaptor.capture());
final NodeMouseDoubleClickHandler nodeMouseDoubleClickHandler = nodeMouseDoubleClickHandlerArgumentCaptor.getValue();
assertNotNull(nodeMouseDoubleClickHandler);
// Mouse not over Header
final NodeMouseDoubleClickEvent event = mock(NodeMouseDoubleClickEvent.class);
when(view.isNodeMouseEventOverCaption(eq(event))).thenReturn(false);
nodeMouseDoubleClickHandler.onNodeMouseDoubleClick(event);
verify(dtPresenter, never()).enterPinnedMode(any(GridWidget.class), any(Command.class));
verify(dtPresenter, never()).enterPinnedMode(any(GridWidget.class), any(Command.class));
}
use of com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method initialiseEventHandler.
@Test
@SuppressWarnings("unchecked")
public void initialiseEventHandler() {
final ArgumentCaptor<NodeDragMoveHandler> nodeDragMoveHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeDragMoveHandler.class);
final ArgumentCaptor<NodeMouseDoubleClickHandler> nodeMouseDoubleClickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseDoubleClickHandler.class);
// dtPresenter.setContent(...) is called by the base tests @Before method
verify(view, times(1)).registerNodeDragMoveHandler(nodeDragMoveHandlerArgumentCaptor.capture());
verify(view, times(1)).registerNodeMouseDoubleClickHandler(nodeMouseDoubleClickHandlerArgumentCaptor.capture());
final NodeDragMoveHandler nodeDragMoveHandler = nodeDragMoveHandlerArgumentCaptor.getValue();
final NodeMouseDoubleClickHandler nodeMouseDoubleClickHandler = nodeMouseDoubleClickHandlerArgumentCaptor.getValue();
assertNotNull(nodeDragMoveHandler);
assertNotNull(nodeMouseDoubleClickHandler);
}
use of com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler in project kie-wb-common by kiegroup.
the class ViewEventHandlerManagerTest method testTextDoubleClickHandler.
@Test
@SuppressWarnings("unchecked")
public void testTextDoubleClickHandler() {
final ViewHandler<ViewEvent> clickHandler = mock(ViewHandler.class);
final HandlerRegistration handlerRegistration = mock(HandlerRegistration.class);
when(node.addNodeMouseDoubleClickHandler(any(NodeMouseDoubleClickHandler.class))).thenReturn(handlerRegistration);
tested.addHandler(ViewEventType.TEXT_DBL_CLICK, clickHandler);
final ArgumentCaptor<NodeMouseDoubleClickHandler> clickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseDoubleClickHandler.class);
verify(node, times(1)).addNodeMouseDoubleClickHandler(clickHandlerArgumentCaptor.capture());
final NodeMouseDoubleClickHandler nodeCLickHandler = clickHandlerArgumentCaptor.getValue();
final NodeMouseDoubleClickEvent clickEvent = mock(NodeMouseDoubleClickEvent.class);
final MouseEvent mouseEvent = mock(MouseEvent.class);
final int x = 102;
final int y = 410;
when(clickEvent.getX()).thenReturn(x);
when(clickEvent.getY()).thenReturn(y);
when(clickEvent.isShiftKeyDown()).thenReturn(true);
when(clickEvent.isAltKeyDown()).thenReturn(true);
when(clickEvent.isMetaKeyDown()).thenReturn(true);
when(clickEvent.getMouseEvent()).thenReturn(mouseEvent);
when(mouseEvent.getClientX()).thenReturn(x);
when(mouseEvent.getClientY()).thenReturn(y);
nodeCLickHandler.onNodeMouseDoubleClick(clickEvent);
final ArgumentCaptor<ViewEvent> eventArgumentCaptor = ArgumentCaptor.forClass(ViewEvent.class);
verify(clickHandler, times(1)).handle(eventArgumentCaptor.capture());
final TextDoubleClickEvent viewEvent = (TextDoubleClickEvent) eventArgumentCaptor.getValue();
assertEquals(x, viewEvent.getX(), 0d);
assertEquals(y, viewEvent.getY(), 0d);
assertEquals(x, viewEvent.getClientX(), 0d);
assertEquals(y, viewEvent.getClientY(), 0d);
assertTrue(viewEvent.isAltKeyDown());
assertTrue(viewEvent.isMetaKeyDown());
assertTrue(viewEvent.isShiftKeyDown());
assertNotNull(tested.getRegistrationMap().get(ViewEventType.TEXT_DBL_CLICK));
}
use of com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler in project kie-wb-common by kiegroup.
the class ViewEventHandlerManagerTest method testDoubleClickHandler.
@Test
@SuppressWarnings("unchecked")
public void testDoubleClickHandler() {
final ViewHandler<ViewEvent> clickHandler = mock(ViewHandler.class);
final HandlerRegistration handlerRegistration = mock(HandlerRegistration.class);
when(node.addNodeMouseDoubleClickHandler(any(NodeMouseDoubleClickHandler.class))).thenReturn(handlerRegistration);
tested.addHandler(ViewEventType.MOUSE_DBL_CLICK, clickHandler);
final ArgumentCaptor<NodeMouseDoubleClickHandler> clickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseDoubleClickHandler.class);
verify(node, times(1)).addNodeMouseDoubleClickHandler(clickHandlerArgumentCaptor.capture());
final NodeMouseDoubleClickHandler nodeCLickHandler = clickHandlerArgumentCaptor.getValue();
final NodeMouseDoubleClickEvent clickEvent = mock(NodeMouseDoubleClickEvent.class);
final MouseEvent mouseEvent = mock(MouseEvent.class);
final int x = 102;
final int y = 410;
when(clickEvent.getX()).thenReturn(x);
when(clickEvent.getY()).thenReturn(y);
when(clickEvent.isButtonLeft()).thenReturn(true);
when(clickEvent.isButtonRight()).thenReturn(true);
when(clickEvent.isButtonMiddle()).thenReturn(true);
when(clickEvent.isShiftKeyDown()).thenReturn(true);
when(clickEvent.isAltKeyDown()).thenReturn(true);
when(clickEvent.isMetaKeyDown()).thenReturn(true);
when(clickEvent.getMouseEvent()).thenReturn(mouseEvent);
when(mouseEvent.getClientX()).thenReturn(x);
when(mouseEvent.getClientY()).thenReturn(y);
nodeCLickHandler.onNodeMouseDoubleClick(clickEvent);
final ArgumentCaptor<ViewEvent> eventArgumentCaptor = ArgumentCaptor.forClass(ViewEvent.class);
verify(clickHandler, times(1)).handle(eventArgumentCaptor.capture());
final MouseDoubleClickEvent viewEvent = (MouseDoubleClickEvent) eventArgumentCaptor.getValue();
assertEquals(x, viewEvent.getX(), 0d);
assertEquals(y, viewEvent.getY(), 0d);
assertEquals(x, viewEvent.getClientX(), 0d);
assertEquals(y, viewEvent.getClientY(), 0d);
assertTrue(viewEvent.isButtonLeft());
assertTrue(viewEvent.isButtonRight());
assertTrue(viewEvent.isButtonMiddle());
assertTrue(viewEvent.isAltKeyDown());
assertTrue(viewEvent.isMetaKeyDown());
assertTrue(viewEvent.isShiftKeyDown());
assertNotNull(tested.getRegistrationMap().get(ViewEventType.MOUSE_DBL_CLICK));
}
use of com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method checkRegisteredNodeMouseDoubleClickHandlerOverHeader.
@Test
@SuppressWarnings("unchecked")
public void checkRegisteredNodeMouseDoubleClickHandlerOverHeader() {
final ArgumentCaptor<NodeMouseDoubleClickHandler> nodeMouseDoubleClickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseDoubleClickHandler.class);
// dtPresenter.setContent(...) is called by the base tests @Before method
verify(view, times(1)).registerNodeMouseDoubleClickHandler(nodeMouseDoubleClickHandlerArgumentCaptor.capture());
final NodeMouseDoubleClickHandler nodeMouseDoubleClickHandler = nodeMouseDoubleClickHandlerArgumentCaptor.getValue();
assertNotNull(nodeMouseDoubleClickHandler);
// Mouse over Header, not pinned
final NodeMouseDoubleClickEvent event = mock(NodeMouseDoubleClickEvent.class);
when(view.isNodeMouseEventOverCaption(eq(event))).thenReturn(true);
when(modellerPresenter.isGridPinned()).thenReturn(false);
nodeMouseDoubleClickHandler.onNodeMouseDoubleClick(event);
verify(dtPresenter, times(1)).enterPinnedMode(eq(view), any(Command.class));
// Mouse over Header, pinned
when(modellerPresenter.isGridPinned()).thenReturn(true);
nodeMouseDoubleClickHandler.onNodeMouseDoubleClick(event);
verify(dtPresenter, times(1)).exitPinnedMode(any(Command.class));
}
Aggregations