@Test
public void testRangeChanged() {

  Range global = new Range(secToUs(0), secToUs(10));
  Range view = new Range(secToUs(2), secToUs(5));
  RangeTimeScrollBar scrollBar = new RangeTimeScrollBar(global, view, TimeUnit.MICROSECONDS);
  // view range changed
  assertThat(scrollBar.getValue()).isEqualTo(secToMillis(2));
  assertThat(scrollBar.getVisibleAmount()).isEqualTo(secToMillis(5 - 2));
  view.set(secToUs(3), secToUs(8));
  assertThat(scrollBar.getValue()).isEqualTo(secToMillis(3));
  assertThat(scrollBar.getVisibleAmount()).isEqualTo(secToMillis(8 - 3));
  // global range changed
  assertThat(scrollBar.getMinimum()).isEqualTo(secToMillis(0));
  assertThat(scrollBar.getMaximum()).isEqualTo(secToMillis(10));
  global.set(secToUs(0), secToUs(15));
  assertThat(scrollBar.getMinimum()).isEqualTo(secToMillis(0));
  assertThat(scrollBar.getMaximum()).isEqualTo(secToMillis(15));
}