Search in sources :

Example 1 with LienzoBoundsPanel

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

the class ScrollableLienzoPanelTest method testRefresh.

@Test
@SuppressWarnings("unchecked")
public void testRefresh() {
    LienzoBoundsPanel view = mock(LienzoBoundsPanel.class);
    when(panel.getView()).thenReturn(view);
    tested.refresh();
    verify(view, times(1)).refresh();
}
Also used : LienzoBoundsPanel(com.ait.lienzo.client.widget.panel.LienzoBoundsPanel) Test(org.junit.Test)

Example 2 with LienzoBoundsPanel

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

the class ScalableLienzoPanelTest method testInit.

@Test
@SuppressWarnings("unchecked")
public void testInit() {
    tested.init();
    ArgumentCaptor<BiFunction> builderCaptor = ArgumentCaptor.forClass(BiFunction.class);
    verify(panel, times(1)).setPanelBuilder(builderCaptor.capture());
    BiFunction<OptionalInt, OptionalInt, LienzoBoundsPanel> builder = builderCaptor.getValue();
    LienzoBoundsPanel result = builder.apply(OptionalInt.of(300), OptionalInt.of(450));
    assertTrue(result instanceof ScalablePanel);
    assertEquals(300, result.getWidthPx());
    assertEquals(450, result.getHeightPx());
}
Also used : BiFunction(java.util.function.BiFunction) LienzoBoundsPanel(com.ait.lienzo.client.widget.panel.LienzoBoundsPanel) OptionalInt(java.util.OptionalInt) ScalablePanel(com.ait.lienzo.client.widget.panel.impl.ScalablePanel) Test(org.junit.Test)

Example 3 with LienzoBoundsPanel

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

the class PreviewLienzoPanelTest method testInit.

@Test
@SuppressWarnings("unchecked")
public void testInit() {
    tested.init();
    ArgumentCaptor<BiFunction> builderCaptor = ArgumentCaptor.forClass(BiFunction.class);
    verify(panel, times(1)).setPanelBuilder(builderCaptor.capture());
    BiFunction<OptionalInt, OptionalInt, LienzoBoundsPanel> builder = builderCaptor.getValue();
    LienzoBoundsPanel result = builder.apply(OptionalInt.of(300), OptionalInt.of(450));
    assertTrue(result instanceof PreviewPanel);
    assertEquals(300, result.getWidthPx());
    assertEquals(450, result.getHeightPx());
}
Also used : BiFunction(java.util.function.BiFunction) LienzoBoundsPanel(com.ait.lienzo.client.widget.panel.LienzoBoundsPanel) PreviewPanel(com.ait.lienzo.client.widget.panel.impl.PreviewPanel) OptionalInt(java.util.OptionalInt) Test(org.junit.Test)

Example 4 with LienzoBoundsPanel

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

the class LienzoCanvasViewTest method testCursor.

@Test
public void testCursor() {
    LienzoBoundsPanel panelView = mock(LienzoBoundsPanel.class);
    when(panel.getView()).thenReturn(panelView);
    tested.initialize(panel, settings);
    tested.setCursor(AbstractCanvas.Cursors.MOVE);
    verify(panelView, times(1)).setCursor(eq(Style.Cursor.MOVE));
}
Also used : LienzoBoundsPanel(com.ait.lienzo.client.widget.panel.LienzoBoundsPanel) Test(org.junit.Test)

Example 5 with LienzoBoundsPanel

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

the class ScrollableLienzoPanelTest method testInit.

@Test
@SuppressWarnings("unchecked")
public void testInit() {
    tested.init();
    ArgumentCaptor<BiFunction> builderCaptor = ArgumentCaptor.forClass(BiFunction.class);
    verify(panel, times(1)).setPanelBuilder(builderCaptor.capture());
    BiFunction<OptionalInt, OptionalInt, LienzoBoundsPanel> builder = builderCaptor.getValue();
    LienzoBoundsPanel result = builder.apply(OptionalInt.of(300), OptionalInt.of(450));
    assertTrue(result instanceof ScrollableLienzoPanelView);
    assertEquals(300, result.getWidthPx());
    assertEquals(450, result.getHeightPx());
}
Also used : BiFunction(java.util.function.BiFunction) LienzoBoundsPanel(com.ait.lienzo.client.widget.panel.LienzoBoundsPanel) OptionalInt(java.util.OptionalInt) Test(org.junit.Test)

Aggregations

LienzoBoundsPanel (com.ait.lienzo.client.widget.panel.LienzoBoundsPanel)5 Test (org.junit.Test)5 OptionalInt (java.util.OptionalInt)3 BiFunction (java.util.function.BiFunction)3 PreviewPanel (com.ait.lienzo.client.widget.panel.impl.PreviewPanel)1 ScalablePanel (com.ait.lienzo.client.widget.panel.impl.ScalablePanel)1