Search in sources :

Example 1 with NodeMouseClickHandler

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

the class ButtonItemImplTest method testClick.

@Test
public void testClick() {
    NodeMouseClickHandler handler = mock(NodeMouseClickHandler.class);
    final ButtonItemImpl cascade = tested.onClick(handler);
    assertEquals(tested, cascade);
    ;
    verify(groupItemPrim, times(1)).setListening(eq(true));
    verify(groupItemPrim, times(1)).addNodeMouseClickHandler(eq(handler));
    verify(registrations, times(1)).register(eq(clickReg));
    tested.destroy();
    verify(clickReg, times(1)).removeHandler();
}
Also used : NodeMouseClickHandler(com.ait.lienzo.client.core.event.NodeMouseClickHandler) Test(org.junit.Test)

Example 2 with NodeMouseClickHandler

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

the class UndefinedExpressionGridTest method testGridMouseClickHandler.

@Test
public void testGridMouseClickHandler() {
    setupGrid(0);
    final NodeMouseClickHandler handler = grid.getGridMouseClickHandler(selectionManager);
    handler.onNodeMouseClick(mouseClickEvent);
    verify(gridLayer).select(parentGridWidget);
}
Also used : NodeMouseClickHandler(com.ait.lienzo.client.core.event.NodeMouseClickHandler) Test(org.junit.Test)

Example 3 with NodeMouseClickHandler

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

the class LiteralExpressionGridTest method testGridMouseClickHandler.

@Test
public void testGridMouseClickHandler() {
    setupGrid(0);
    final NodeMouseClickHandler handler = grid.getGridMouseClickHandler(selectionManager);
    handler.onNodeMouseClick(mouseClickEvent);
    verify(gridLayer).select(parentGridWidget);
}
Also used : NodeMouseClickHandler(com.ait.lienzo.client.core.event.NodeMouseClickHandler) Test(org.junit.Test)

Example 4 with NodeMouseClickHandler

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

the class ViewEventHandlerManagerTest method testClickHandler.

@Test
@SuppressWarnings("unchecked")
public void testClickHandler() {
    final ViewHandler<ViewEvent> clickHandler = mock(ViewHandler.class);
    final HandlerRegistration handlerRegistration = mock(HandlerRegistration.class);
    when(node.addNodeMouseClickHandler(any(NodeMouseClickHandler.class))).thenReturn(handlerRegistration);
    tested.addHandler(ViewEventType.MOUSE_CLICK, clickHandler);
    final ArgumentCaptor<NodeMouseClickHandler> clickHandlerArgumentCaptor = ArgumentCaptor.forClass(NodeMouseClickHandler.class);
    verify(node, times(1)).addNodeMouseClickHandler(clickHandlerArgumentCaptor.capture());
    final NodeMouseClickHandler nodeCLickHandler = clickHandlerArgumentCaptor.getValue();
    final NodeMouseClickEvent clickEvent = mock(NodeMouseClickEvent.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.onNodeMouseClick(clickEvent);
    final ArgumentCaptor<ViewEvent> eventArgumentCaptor = ArgumentCaptor.forClass(ViewEvent.class);
    verify(clickHandler, times(1)).handle(eventArgumentCaptor.capture());
    final MouseClickEvent viewEvent = (MouseClickEvent) 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_CLICK));
}
Also used : HandlerRegistration(com.google.gwt.event.shared.HandlerRegistration) NodeMouseClickHandler(com.ait.lienzo.client.core.event.NodeMouseClickHandler) MouseEvent(com.google.gwt.event.dom.client.MouseEvent) ViewEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.ViewEvent) NodeMouseClickEvent(com.ait.lienzo.client.core.event.NodeMouseClickEvent) NodeMouseClickEvent(com.ait.lienzo.client.core.event.NodeMouseClickEvent) MouseClickEvent(org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent) Test(org.junit.Test)

Example 5 with NodeMouseClickHandler

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

the class ButtonGridItemImplTest method testClick.

@Test
public void testClick() {
    NodeMouseClickHandler handler = mock(NodeMouseClickHandler.class);
    tested.onClick(handler);
    verify(button, times(1)).onClick(eq(handler));
}
Also used : NodeMouseClickHandler(com.ait.lienzo.client.core.event.NodeMouseClickHandler) Test(org.junit.Test)

Aggregations

NodeMouseClickHandler (com.ait.lienzo.client.core.event.NodeMouseClickHandler)6 Test (org.junit.Test)5 NodeMouseClickEvent (com.ait.lienzo.client.core.event.NodeMouseClickEvent)2 MouseEvent (com.google.gwt.event.dom.client.MouseEvent)2 MouseClickEvent (org.kie.workbench.common.stunner.core.client.shape.view.event.MouseClickEvent)2 NodeMouseEnterEvent (com.ait.lienzo.client.core.event.NodeMouseEnterEvent)1 NodeMouseEnterHandler (com.ait.lienzo.client.core.event.NodeMouseEnterHandler)1 NodeMouseExitEvent (com.ait.lienzo.client.core.event.NodeMouseExitEvent)1 NodeMouseExitHandler (com.ait.lienzo.client.core.event.NodeMouseExitHandler)1 HandlerRegistration (com.google.gwt.event.shared.HandlerRegistration)1 ViewEvent (org.kie.workbench.common.stunner.core.client.shape.view.event.ViewEvent)1 TooltipItem (org.kie.workbench.common.stunner.lienzo.toolbox.items.TooltipItem)1