Search in sources :

Example 1 with LienzoPanelImpl

use of com.ait.lienzo.client.widget.panel.impl.LienzoPanelImpl in project kie-wb-common by kiegroup.

the class ShapeGlyphDragHandlerTest method setUp.

@Before
public void setUp() throws Exception {
    proxyPanel = spy(new LienzoPanelImpl(DRAG_PROXY_WIDTH, DRAG_PROXY_HEIGHT));
    when(proxyPanel.getElement()).thenReturn(proxyElement);
    when(proxyElement.getStyle()).thenReturn(proxyStyle);
    handlerRegistrations = new ArrayList<>();
    glyphGroup = new Group();
    when(glyphLienzoGlyphRenderer.render(eq(glyph), anyDouble(), anyDouble())).thenReturn(glyphGroup);
    when(glyphDragItem.getHeight()).thenReturn(DRAG_PROXY_WIDTH);
    when(glyphDragItem.getWidth()).thenReturn(DRAG_PROXY_HEIGHT);
    when(glyphDragItem.getShape()).thenReturn(glyph);
    when(rootPanel.addDomHandler(any(MouseMoveHandler.class), eq(MouseMoveEvent.getType()))).thenReturn(moveHandlerReg);
    when(rootPanel.addDomHandler(any(MouseUpHandler.class), eq(MouseUpEvent.getType()))).thenReturn(upHandlerReg);
    when(rootPanel.addDomHandler(any(KeyDownHandler.class), eq(KeyDownEvent.getType()))).thenReturn(keyHandlerReg);
    tested = new ShapeGlyphDragHandler(glyphLienzoGlyphRenderer, handlerRegistrations, () -> rootPanel, item -> proxyPanel, (task, timeout) -> task.execute());
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) MouseMoveEvent(com.google.gwt.event.dom.client.MouseMoveEvent) Mock(org.mockito.Mock) ArgumentMatchers.eq(org.mockito.ArgumentMatchers.eq) MouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler) RunWith(org.junit.runner.RunWith) Group(com.ait.lienzo.client.core.shape.Group) AbstractCanvas(org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvas) AbsolutePanel(com.google.gwt.user.client.ui.AbsolutePanel) Mockito.spy(org.mockito.Mockito.spy) ArrayList(java.util.ArrayList) HandlerRegistration(com.google.gwt.event.shared.HandlerRegistration) LienzoMockitoTestRunner(com.ait.lienzo.test.LienzoMockitoTestRunner) Layer(com.ait.lienzo.client.core.shape.Layer) Style(com.google.gwt.dom.client.Style) ArgumentCaptor(org.mockito.ArgumentCaptor) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) MouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler) LienzoPanelImpl(com.ait.lienzo.client.widget.panel.impl.LienzoPanelImpl) Callback(org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Callback) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) ArgumentMatchers.anyDouble(org.mockito.ArgumentMatchers.anyDouble) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) Before(org.junit.Before) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) Mockito.times(org.mockito.Mockito.times) Mockito.when(org.mockito.Mockito.when) Mockito.verify(org.mockito.Mockito.verify) List(java.util.List) Mockito.never(org.mockito.Mockito.never) MouseUpEvent(com.google.gwt.event.dom.client.MouseUpEvent) Assert.assertEquals(org.junit.Assert.assertEquals) Mockito.mock(org.mockito.Mockito.mock) Group(com.ait.lienzo.client.core.shape.Group) MouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) MouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler) LienzoPanelImpl(com.ait.lienzo.client.widget.panel.impl.LienzoPanelImpl) Before(org.junit.Before)

Aggregations

Group (com.ait.lienzo.client.core.shape.Group)1 Layer (com.ait.lienzo.client.core.shape.Layer)1 LienzoPanelImpl (com.ait.lienzo.client.widget.panel.impl.LienzoPanelImpl)1 LienzoMockitoTestRunner (com.ait.lienzo.test.LienzoMockitoTestRunner)1 Style (com.google.gwt.dom.client.Style)1 KeyDownEvent (com.google.gwt.event.dom.client.KeyDownEvent)1 KeyDownHandler (com.google.gwt.event.dom.client.KeyDownHandler)1 MouseMoveEvent (com.google.gwt.event.dom.client.MouseMoveEvent)1 MouseMoveHandler (com.google.gwt.event.dom.client.MouseMoveHandler)1 MouseUpEvent (com.google.gwt.event.dom.client.MouseUpEvent)1 MouseUpHandler (com.google.gwt.event.dom.client.MouseUpHandler)1 HandlerRegistration (com.google.gwt.event.shared.HandlerRegistration)1 AbsolutePanel (com.google.gwt.user.client.ui.AbsolutePanel)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Before (org.junit.Before)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1