On Thu, 21 Mar 2024 01:13:50 GMT, Harshitha Onkar <hon...@openjdk.org> wrote:
>> This test is converted to main using PassFailJFrame. It verifies wheel >> rotation value for high-res mouse on windows. >> >> The test requires the updated PassFailJFrame's logArea() feature added in >> this PR https://github.com/openjdk/jdk/pull/18319 > > Harshitha Onkar has updated the pull request incrementally with one > additional commit since the last revision: > > added preciseWheelRotation logic & updated test Changes requested by aivanov (Reviewer). test/jdk/java/awt/event/MouseEvent/AWTPanelSmoothWheel.java line 58: > 56: When preciseWheelRotation adds up to 1,wheelRotation becomes > 1. <br> > 57: You should see a few events where preciseWheelRotation < 1 & > wheelRotation = 0 > 58: followed by a event where preciseWheelRotation = 1 & > wheelRotation = 1.<br> <br> Suggestion: <b>preciseWheelRotation < 1.</b> <br> When preciseWheelRotation adds up to 1, wheelRotation becomes 1. <br> You should see a few events where preciseWheelRotation < 1 & wheelRotation = 0 followed by a event where preciseWheelRotation = 1 & wheelRotation = 1.<br> <br> test/jdk/java/awt/event/MouseEvent/AWTPanelSmoothWheel.java line 64: > 62: > 63: <hr> > 64: PS: If you don't see events with preciseWheelRotation < 1, Suggestion: PS: If you don't see events with preciseWheelRotation < 1, test/jdk/java/awt/event/MouseEvent/AWTPanelSmoothWheel.java line 91: > 89: panel.addMouseWheelListener(e -> { > 90: if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { > 91: PassFailJFrame.log("WheelEvent#"+ ++wheelEventCount Suggestion: PassFailJFrame.log("WheelEvent#" + (++wheelEventCount) Use parentheses to avoid confusion. test/jdk/java/awt/event/MouseEvent/AWTPanelSmoothWheel.java line 101: > 99: PassFailJFrame.log("WARNING !!! You might not be > using a high-res mouse."); > 100: } > 101: } This logging style is easier to parse, thanks. You have nearly all the data to make the test semi-automatic. What's missing is `wheelRotationCount`. [This diff](https://github.com/aivanov-jdk/jdk/commit/04c80c519d1c116663ab10a177bff1c4b6924091) implements this feature. For convenience, I'll paste the diff inline too: diff --git a/test/jdk/java/awt/event/MouseEvent/AWTPanelSmoothWheel.java b/test/jdk/java/awt/event/MouseEvent/AWTPanelSmoothWheel.java index 1097d1dcb04..f3dd8294e8b 100644 --- a/test/jdk/java/awt/event/MouseEvent/AWTPanelSmoothWheel.java +++ b/test/jdk/java/awt/event/MouseEvent/AWTPanelSmoothWheel.java @@ -39,7 +39,9 @@ public class AWTPanelSmoothWheel { private static int wheelEventCount = 0; + private static int wheelRotationCount = 0; private static int hiResWheelCount = 0; + private static final String INSTRUCTIONS = """ <html> <body> @@ -92,12 +94,21 @@ private static Frame createUI() { + " --- Wheel Rotation: " + e.getWheelRotation() + " --- Precise Wheel Rotation: " + String.format("%.2f", e.getPreciseWheelRotation())); + if (e.getWheelRotation() >= 1) { + wheelRotationCount += e.getWheelRotation(); + } if (e.getPreciseWheelRotation() < 1) { hiResWheelCount++; } if (wheelEventCount >= 5 && hiResWheelCount == 0) { PassFailJFrame.log("WARNING !!! You might not be using a high-res mouse."); } + if (wheelRotationCount > 5 + && (hiResWheelCount / 2 >= wheelRotationCount)) { + PassFailJFrame.log("The test passes: hiResWheelCount = " + hiResWheelCount + + " wheelRotationCount = " + wheelRotationCount); + PassFailJFrame.forcePass(); + } } }); frame.setSize (400, 200); test/jdk/java/awt/event/MouseEvent/AWTPanelSmoothWheel.java line 103: > 101: } > 102: }); > 103: frame.setSize (400, 200); Suggestion: frame.setSize(400, 200); ------------- PR Review: https://git.openjdk.org/jdk/pull/18312#pullrequestreview-1952352489 PR Review Comment: https://git.openjdk.org/jdk/pull/18312#discussion_r1533996638 PR Review Comment: https://git.openjdk.org/jdk/pull/18312#discussion_r1534001700 PR Review Comment: https://git.openjdk.org/jdk/pull/18312#discussion_r1534003172 PR Review Comment: https://git.openjdk.org/jdk/pull/18312#discussion_r1534065861 PR Review Comment: https://git.openjdk.org/jdk/pull/18312#discussion_r1534004288