GridLienzoScrollBars { Double getHorizontalScrollPosition() { final Integer scrollLeft = scrollPanel().getElement().getScrollLeft(); final Integer scrollWidth = scrollPanel().getElement().getScrollWidth(); final Integer clientWidth = scrollPanel().getElement().getClientWidth(); final Integer level = scrollWidth - clientWidth; return level == 0 ? 0d : 100d * scrollLeft / level; } GridLienzoScrollBars(final GridLienzoScrollHandler gridLienzoScrollHandler);   }
@Test public void testGetHorizontalScrollPosition() { doReturn(scrollPanel()).when(gridLienzoScrollHandler).getScrollPanel(); final Double position = gridLienzoScrollBars.getHorizontalScrollPosition(); assertEquals(100d * SCROLL_LEFT / (SCROLL_WIDTH - CLIENT_WIDTH), position, 0); }
@Test public void testGetHorizontalScrollPositionWhenScrollbarIsDisabled() { doReturn(emptyPanel()).when(gridLienzoScrollHandler).getScrollPanel(); final Double position = gridLienzoScrollBars.getHorizontalScrollPosition(); assertEquals(0, position, 0); }