Search in sources :

Example 1 with PreviewPanel

use of com.ait.lienzo.client.widget.panel.impl.PreviewPanel 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 2 with PreviewPanel

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

the class PreviewLienzoPanelTest method testRefresh.

@Test
public void testRefresh() {
    PreviewPanel view = mock(PreviewPanel.class);
    when(panel.getView()).thenReturn(view);
    ScrollableLienzoPanel delegate = mock(ScrollableLienzoPanel.class);
    StunnerLienzoBoundsPanel delegate2 = mock(StunnerLienzoBoundsPanel.class);
    when(delegate.getDelegate()).thenReturn(delegate2);
    ScrollablePanel previewView = mock(ScrollablePanel.class);
    when(delegate2.getView()).thenReturn(previewView);
    tested.observe(delegate);
    verify(view, times(1)).observe(eq(previewView));
}
Also used : ScrollablePanel(com.ait.lienzo.client.widget.panel.scrollbars.ScrollablePanel) PreviewPanel(com.ait.lienzo.client.widget.panel.impl.PreviewPanel) Test(org.junit.Test)

Aggregations

PreviewPanel (com.ait.lienzo.client.widget.panel.impl.PreviewPanel)2 Test (org.junit.Test)2 LienzoBoundsPanel (com.ait.lienzo.client.widget.panel.LienzoBoundsPanel)1 ScrollablePanel (com.ait.lienzo.client.widget.panel.scrollbars.ScrollablePanel)1 OptionalInt (java.util.OptionalInt)1 BiFunction (java.util.function.BiFunction)1