From 6765708505757b944dc3ed65bf9411d540543815 Mon Sep 17 00:00:00 2001 From: Michael Ennen Date: Mon, 26 Nov 2018 23:58:37 -0700 Subject: [PATCH] fix --- .../test/robot/javafx/scene/RobotTest.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/system/src/test/java/test/robot/javafx/scene/RobotTest.java b/tests/system/src/test/java/test/robot/javafx/scene/RobotTest.java index 6597154532..315dad682a 100644 --- a/tests/system/src/test/java/test/robot/javafx/scene/RobotTest.java +++ b/tests/system/src/test/java/test/robot/javafx/scene/RobotTest.java @@ -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 -> {