RangeSelectionComponent extends AnimatedComponent { @NotNull public Mode getMode() { return myMode; } RangeSelectionComponent(@NotNull RangeSelectionModel model, @NotNull Range viewRange);  RangeSelectionComponent(@NotNull RangeSelectionModel model, @NotNull Range viewRange, boolean isPointSelectionReplaced); void addSelectionUpdatedListener(final Consumer<Range> listener); @NotNull Mode getMode(); boolean shouldShowSeekComponent(); void setDragBarHeight(int dragBarHeight); static final double CLICK_RANGE_RATIO; }
@Test public void movingMouseChangesCursor() { RangeSelectionModel model = new RangeSelectionModel(new Range(10, 20)); RangeSelectionComponent component = new RangeSelectionComponent(model, new Range(0, 100)); component.setSize(100, 100); FakeUi ui = new FakeUi(component); ui.mouse.moveTo(getMinHandleX(model), 0); assertThat(component.getCursor()).isEqualTo(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); assertThat(component.getMode()).isEqualTo(RangeSelectionComponent.Mode.ADJUST_MIN); ui.mouse.moveTo(15, 0); assertThat(component.getCursor()).isEqualTo(AdtUiCursors.GRABBING); assertThat(component.getMode()).isEqualTo(RangeSelectionComponent.Mode.MOVE); ui.mouse.moveTo(15, 50); assertThat(component.getCursor()).isEqualTo(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); assertThat(component.getMode()).isEqualTo(RangeSelectionComponent.Mode.CREATE); ui.mouse.moveTo(getMaxHandleX(model), 50); assertThat(component.getCursor()).isEqualTo(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); assertThat(component.getMode()).isEqualTo(RangeSelectionComponent.Mode.ADJUST_MAX); ui.mouse.moveTo(0, 0); assertThat(component.getCursor()).isEqualTo(Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR)); assertThat(component.getMode()).isEqualTo(RangeSelectionComponent.Mode.CREATE); }