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());
}
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);
}
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);
}
Aggregations