Search in sources :

Example 1 with Item

use of org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Item in project kie-wb-common by kiegroup.

the class DecisionComponentsItemViewTest method testMakeDragHandler.

@Test
public void testMakeDragHandler() {
    final Glyph glyph = mock(Glyph.class);
    final Item item = view.makeDragHandler(glyph);
    assertEquals(16, item.getHeight());
    assertEquals(16, item.getWidth());
    assertEquals(glyph, item.getShape());
}
Also used : Item(org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Item) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) Test(org.junit.Test)

Example 2 with Item

use of org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Item in project kie-wb-common by kiegroup.

the class DecisionComponentsItemViewTest method testDecisionComponentItemMouseDown.

@Test
public void testDecisionComponentItemMouseDown() {
    final MouseDownEvent mouseDownEvent = mock(MouseDownEvent.class);
    final Callback proxy = mock(Callback.class);
    final DRGElement drgElement = mock(DRGElement.class);
    final DMNShapeFactory factory = mock(DMNShapeFactory.class);
    final ShapeGlyphDragHandler.Item item = mock(ShapeGlyphDragHandler.Item.class);
    final Glyph glyph = mock(Glyph.class);
    final int x = 10;
    final int y = 20;
    when(dmnShapeSet.getShapeFactory()).thenReturn(factory);
    when(presenter.getDrgElement()).thenReturn(drgElement);
    when(factory.getGlyph(any())).thenReturn(glyph);
    when(mouseDownEvent.getX()).thenReturn(x);
    when(mouseDownEvent.getY()).thenReturn(y);
    doReturn(proxy).when(view).makeDragProxyCallbackImpl(drgElement, factory);
    doReturn(item).when(view).makeDragHandler(glyph);
    view.decisionComponentItemMouseDown(mouseDownEvent);
    verify(shapeGlyphDragHandler).show(item, x, y, proxy);
}
Also used : Item(org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Item) Callback(org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Callback) DMNShapeFactory(org.kie.workbench.common.dmn.client.shape.factory.DMNShapeFactory) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) ShapeGlyphDragHandler(org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler) MouseDownEvent(com.google.gwt.event.dom.client.MouseDownEvent) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement) Test(org.junit.Test)

Example 3 with Item

use of org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Item in project kie-wb-common by kiegroup.

the class BS3PaletteWidgetViewImplTest method testShowDragProxy.

@Test
@SuppressWarnings("unchecked")
public void testShowDragProxy() {
    view.showDragProxy(ITEM_ID, X, Y, WIDTH, HEIGHT);
    verify(presenter).getShapeDragProxyGlyph(ITEM_ID);
    verify(shapeGlyphDragHandler).show(dragItemCaptor.capture(), eq((int) X), eq((int) Y), dragProxyCallbackCaptor.capture());
    final Item dragItem = dragItemCaptor.getValue();
    assertEquals(glyph, dragItem.getShape());
    assertEquals(WIDTH, dragItem.getWidth(), 0.0);
    assertEquals(HEIGHT, dragItem.getHeight(), 0.0);
    final Callback dragProxyCallback = dragProxyCallbackCaptor.getValue();
    dragProxyCallback.onStart((int) X, (int) Y);
    verify(presenter).onDragStart(ITEM_ID, (int) X, (int) Y);
    dragProxyCallback.onMove((int) X, (int) Y);
    verify(presenter).onDragProxyMove(ITEM_ID, (int) X, (int) Y);
    dragProxyCallback.onComplete((int) X, (int) Y);
    verify(presenter).onDragProxyComplete(ITEM_ID, (int) X, (int) Y);
}
Also used : Item(org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Item) Callback(org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Callback) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 Item (org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Item)3 Callback (org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Callback)2 Glyph (org.kie.workbench.common.stunner.core.definition.shape.Glyph)2 MouseDownEvent (com.google.gwt.event.dom.client.MouseDownEvent)1 DRGElement (org.kie.workbench.common.dmn.api.definition.model.DRGElement)1 DMNShapeFactory (org.kie.workbench.common.dmn.client.shape.factory.DMNShapeFactory)1 ShapeGlyphDragHandler (org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler)1