Search in sources :

Example 1 with ImageShapeLoadedHandler

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

the class CustomTaskShapeViewHandlerTest method checkIconLoad.

private void checkIconLoad(final String IconData) {
    when(imageProxy.isLoaded()).thenReturn(true);
    when(icon.getBoundingBox()).thenReturn(new BoundingBox(0d, 0d, CustomTaskShapeViewHandler.WID_ICON_WIDTH * 2, CustomTaskShapeViewHandler.WID_ICON_HEIGHT * 2));
    tested.handle(task, view);
    ArgumentCaptor<ImageShapeLoadedHandler> loadedHandlerArgumentCaptor = ArgumentCaptor.forClass(ImageShapeLoadedHandler.class);
    verify(imageProxy, times(1)).setImageShapeLoadedHandler(loadedHandlerArgumentCaptor.capture());
    verify(imageProxy, times(1)).load(eq(IconData));
    ImageShapeLoadedHandler loadedHandler = loadedHandlerArgumentCaptor.getValue();
    loadedHandler.onImageShapeLoaded(icon);
    verify(icon, times(1)).setScale(eq(0.5d), eq(0.5d));
    verify(width, times(1)).setValue(WIDTH);
    verify(height, times(1)).setValue(HEIGHT);
    verify(view, never()).refresh();
}
Also used : BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) ImageShapeLoadedHandler(com.ait.lienzo.client.core.image.ImageShapeLoadedHandler)

Aggregations

ImageShapeLoadedHandler (com.ait.lienzo.client.core.image.ImageShapeLoadedHandler)1 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)1