On Tue, 19 Mar 2024 20:39:07 GMT, Harshitha Onkar <hon...@openjdk.org> wrote:

>> test/jdk/java/awt/event/MouseEvent/AWTPanelSmoothWheel.java line 49:
>> 
>>> 47:             below the instruction window.
>>> 48:             Please make sure that some of the messages have non-zero 
>>> 'wheelRotation' value,
>>> 49:             and also check if the test works OK if the mouse wheel is 
>>> rotated very slow.
>> 
>> Shall we increase the width of the instruction window so that less 
>> horizontal scrolling is needed?
>> 
>> The test can actually verify the condition without help from the user. The 
>> handler for `MouseWheelListener` could well look into the `MouseWheelEvent` 
>> and verify _automatically_ if `scrollType=WHEEL_UNIT_SCROLL` and there are 
>> any events with `wheelRotation=1` (or rather `wheelRotation!=0`).
>> 
>> You can even `forcePass` the test as soon as you detected few events which 
>> satisfy the condition.
>> 
>> If you don't see events with `scrollType=WHEEL_UNIT_SCROLL`, then the mouse 
>> doesn't support high-resolution scrolling.
>
> @aivanov-jdk Semi-automated the test, it now passes when 5 or more  
> MouseWheelEvent of type: scrollType=WHEEL_UNIT_SCROLL & wheelRotation != 0 is 
> recorded. Updated the instructions accordingly.

I think we should update the instructions.

A high resolution mouse produces events like this:

java.awt.event.MouseWheelEvent[MOUSE_WHEEL,(164,90),absolute(1135,365),button=0,clickCount=0,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=3,wheelRotation=0,preciseWheelRotation=0.25]
 on panel0
java.awt.event.MouseWheelEvent[MOUSE_WHEEL,(164,90),absolute(1135,365),button=0,clickCount=0,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=3,wheelRotation=0,preciseWheelRotation=0.25]
 on panel0
java.awt.event.MouseWheelEvent[MOUSE_WHEEL,(164,90),absolute(1135,365),button=0,clickCount=0,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=3,wheelRotation=0,preciseWheelRotation=0.25]
 on panel0
java.awt.event.MouseWheelEvent[MOUSE_WHEEL,(133,46),absolute(1104,321),button=0,clickCount=0,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=3,wheelRotation=1,preciseWheelRotation=1.0]
 on panel0


Thus, `wheelRotation=0` while `preciseWheelRotation=0.25`. When it reaches, 
`preciseWheelRotation=1.0`, the event contains **`wheelRotation=1`**.

A regular mouse with mouse-wheel notches produces the following events:

java.awt.event.MouseWheelEvent[MOUSE_WHEEL,(90,115),absolute(1061,390),button=0,clickCount=0,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=3,wheelRotation=1,preciseWheelRotation=1.0]
 on panel0
java.awt.event.MouseWheelEvent[MOUSE_WHEEL,(176,76),absolute(1147,351),button=0,clickCount=0,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=3,wheelRotation=1,preciseWheelRotation=1.0]
 on panel0


As you can see, `scrollType=WHEEL_UNIT_SCROLL` is the same in both cases. The 
only difference is that high-resolution mouse produces events where 
**`preciseWheelRotation < 1.0`**.

This means that you should also track the value of `preciseWheelRotation`. 
Otherwise, the test will pass when a regular mouse is used.

You may show a warning to the user if you detect, let's say, 5 events with 
`wheelRotation=1` but none of the events had `wheelRotation=0` and 
`preciseWheelRotation < 1.0`.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18312#discussion_r1532468459

Reply via email to