ProfilerScrollbar extends JBScrollBar { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (myCheckStream) { if (!myTimeline.isStreaming() && isCloseToMax() && myTimeline.canStream()) { myTimeline.setStreaming(true); } } myCheckStream = false; } ProfilerScrollbar(@NotNull StreamingTimeline timeline,
                           @NotNull JComponent zoomPanComponent); @VisibleForTesting double getZoomWheelDelta(); @VisibleForTesting double getPanWheelDelta(); @VisibleForTesting boolean isScrollable();  }
@Test public void testAdjust() { myTimeline.setIsPaused(false); assertEquals(0, myTimeline.getViewRange().getMin(), EPSILON); assertEquals(5000, myTimeline.getViewRange().getMax(), EPSILON); myUi.mouse.press(5, 100); assertEquals(0, myTimeline.getViewRange().getMin(), EPSILON); assertEquals(5000, myTimeline.getViewRange().getMax(), EPSILON); myUi.mouse.dragTo(10, 100); assertEquals(1000, myTimeline.getViewRange().getMin(), EPSILON); assertEquals(6000, myTimeline.getViewRange().getMax(), EPSILON); myUi.mouse.release(); assertEquals(1000, myTimeline.getViewRange().getMin(), EPSILON); assertEquals(6000, myTimeline.getViewRange().getMax(), EPSILON); assertFalse(myTimeline.isStreaming()); myUi.mouse.press(10, 100); assertFalse(myTimeline.isStreaming()); myUi.mouse.dragTo(40, 100); assertFalse(myTimeline.isStreaming()); myUi.mouse.release(); assertEquals(4000, myTimeline.getViewRange().getMin(), EPSILON); assertEquals(9000, myTimeline.getViewRange().getMax(), EPSILON); BufferedImage image = new BufferedImage(100, 10, BufferedImage.TYPE_INT_ARGB); Graphics graphics = image.getGraphics(); graphics.setClip(0, 0, 100, 10); myScrollbar.paintComponent(graphics); assertTrue(myTimeline.isStreaming()); }