Search in sources :

Example 1 with DMNShapeFactory

use of org.kie.workbench.common.dmn.client.shape.factory.DMNShapeFactory 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)

Aggregations

MouseDownEvent (com.google.gwt.event.dom.client.MouseDownEvent)1 Test (org.junit.Test)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 Callback (org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Callback)1 Item (org.kie.workbench.common.stunner.client.lienzo.components.glyph.ShapeGlyphDragHandler.Item)1 Glyph (org.kie.workbench.common.stunner.core.definition.shape.Glyph)1