RFR: JDK-8328190 : Convert AWTPanelSmoothWheel.html applet test to main [v4]
Harshitha Onkar
honkar at openjdk.org
Wed Mar 20 19:20:31 UTC 2024
On Wed, 20 Mar 2024 16:57:24 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> @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`.
@aivanov-jdk Thanks for reviewing this in-depth and pointing out the difference between wheelRotation & preciseWheelRotation when using hi-res mouse.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18312#discussion_r1532702217
More information about the client-libs-dev
mailing list