GridLienzoScrollHandler { Integer calculateInternalScrollPanelHeight() { final Double absHeight = scrollBounds().maxBoundY() - scrollBounds().minBoundY(); if (getViewport() != null && scrollPosition().deltaY() != 0) { final Double scaleY = getViewport().getTransform().getScaleY(); final Double height = absHeight * scaleY; return height.intValue(); } return DEFAULT_INTERNAL_SCROLL_HEIGHT; } GridLienzoScrollHandler(final GridLienzoPanel panel); void init(); Integer scrollbarWidth(); Integer scrollbarHeight(); void refreshScrollPosition(); void setBounds(final Bounds bounds);  }
@Test public void testCalculateInternalScrollPanelHeightWhenScrollbarYIsEnabled() { final Double maximumBoundY = +20d; final Double minimumBoundY = -20d; final Double zoomLevel = 0.75d; final Double currentScrollPosition = 10d; doReturn(maximumBoundY).when(scrollBounds).maxBoundY(); doReturn(minimumBoundY).when(scrollBounds).minBoundY(); doReturn(zoomLevel).when(transform).getScaleY(); doReturn(currentScrollPosition).when(scrollPosition).deltaY(); final Integer panelHeight = gridLienzoScrollHandler.calculateInternalScrollPanelHeight(); final Integer scaledHeight = (int) ((maximumBoundY - minimumBoundY) * zoomLevel); assertEquals(scaledHeight, panelHeight, 0); }
@Test public void testCalculateInternalScrollPanelHeightWhenScrollbarYIsDisabled() { final Double maximumBoundY = +20d; final Double minimumBoundY = -20d; final Double zoomLevel = 0.75d; final Double currentScrollPosition = 0d; doReturn(maximumBoundY).when(scrollBounds).maxBoundY(); doReturn(minimumBoundY).when(scrollBounds).minBoundY(); doReturn(zoomLevel).when(transform).getScaleY(); doReturn(currentScrollPosition).when(scrollPosition).deltaY(); final Integer panelHeight = gridLienzoScrollHandler.calculateInternalScrollPanelHeight(); assertEquals(DEFAULT_INTERNAL_SCROLL_HEIGHT, panelHeight, 0); }