Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
brcolow committed Nov 27, 2018
1 parent a3397b0 commit 6765708
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions tests/system/src/test/java/test/robot/javafx/scene/RobotTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,27 @@ private static void testMouseWheel(int amount) {
CountDownLatch setSceneLatch = new CountDownLatch(1);
Button button = new Button("Scroll me");
InvalidationListener invalidationListener = observable -> setSceneLatch.countDown();
int[] totalScroll = new int[]{0};
long[] firstScrollMillis = new long[]{0};
Util.runAndWait(() -> {
button.setOnScroll(event -> {
button.setText("Scrolled " + event.getDeltaY());
onScrollLatch.countDown();
System.out.println("event: " + event);
System.out.println("total scroll before: " + totalScroll[0]);
totalScroll[0] += event.getDeltaY();
System.out.println("total scroll after: " + totalScroll[0]);
if (firstScrollMillis[0] == 0) {
firstScrollMillis[0] = System.currentTimeMillis();
} else {
if (System.currentTimeMillis() - firstScrollMillis[0] > 1000) {
button.setText("Scrolled " + totalScroll[0]);
onScrollLatch.countDown();
}
}
if (Math.abs(totalScroll[0]) / 40 >= Math.abs(amount)) {
System.out.println("total scroll is greater than or equal to amount");
button.setText("Scrolled " + -(totalScroll[0] / 40));
onScrollLatch.countDown();
}
});
scene = new Scene(new HBox(button), SIZE, SIZE);
stage.sceneProperty().addListener(observable -> {
Expand Down

0 comments on commit 6765708

Please sign in to comment.