RFR: 8316947: Write a test to check textArea triggers MouseEntered/MouseExited events properly [v2]
Alexey Ivanov
aivanov at openjdk.org
Fri Oct 6 18:30:13 UTC 2023
On Thu, 5 Oct 2023 08:13:53 GMT, Ravi Gupta <duke at openjdk.org> wrote:
>> Write a test to check textArea triggers MouseEntered/MouseExited events properly
>>
>> MouseEntered should be triggered only when the mouse enters the component and MouseExited should be triggered when the mouse goes out of the component.
>>
>> In TextArea, when we moved the mouse inside the component MouseMoved events are triggered properly. But when we slowly took the mouse outside the component that is towards the scrollbars, we could see a MouseEntered event being triggered followed by MouseExited.(before actually mouse enters the scrollbar)
>>
>> Testing:
>> Tested using Mach5(20 times per platform) in macos,linux and windows and got all pass.
>
> Ravi Gupta has updated the pull request incrementally with one additional commit since the last revision:
>
> 8316947: Review comments solved
Changes requested by aivanov (Reviewer).
test/jdk/java/awt/event/MouseEvent/MouseEnterExitTest.java line 40:
> 38: * @key headful
> 39: * @bug 4454304
> 40: * @summary On Solaris,TextArea triggers MouseEntered when the mouse is inside the component
Suggestion:
* @summary On Solaris, TextArea triggers MouseEntered when the mouse is inside the component
test/jdk/java/awt/event/MouseEvent/MouseEnterExitTest.java line 47:
> 45: private static Frame frame;
> 46: private static TextArea textArea;
> 47: private static List list;
Both `list` and `textArea` can be local variables in the `initializeGUI` method.
test/jdk/java/awt/event/MouseEvent/MouseEnterExitTest.java line 48:
> 46: private static TextArea textArea;
> 47: private static List list;
> 48: private static Robot robot;
Robot can be a local variable in the `main` method.
test/jdk/java/awt/event/MouseEvent/MouseEnterExitTest.java line 55:
> 53: private volatile static Dimension compSize;
> 54:
> 55: private static MouseListener mListener = new MouseAdapter() {
Suggestion:
private static final MouseListener mouseListener = new MouseAdapter() {
Why not make the field `mouseListener`?
test/jdk/java/awt/event/MouseEvent/MouseEnterExitTest.java line 101:
> 99: robot = new Robot();
> 100: robot.setAutoDelay(100);
> 101: robot.setAutoWaitForIdle(true);
Suggestion:
robot = new Robot();
robot.setAutoDelay(100);
robot.setAutoWaitForIdle(true);
EventQueue.invokeAndWait(MouseEnterExitTest::initializeGUI);
robot.waitForIdle();
Before continuing to get the coordinates of the frame, you want to ensure it's completely shown.
-------------
PR Review: https://git.openjdk.org/jdk/pull/15961#pullrequestreview-1662583031
PR Review Comment: https://git.openjdk.org/jdk/pull/15961#discussion_r1349181886
PR Review Comment: https://git.openjdk.org/jdk/pull/15961#discussion_r1349181089
PR Review Comment: https://git.openjdk.org/jdk/pull/15961#discussion_r1349180170
PR Review Comment: https://git.openjdk.org/jdk/pull/15961#discussion_r1349178806
PR Review Comment: https://git.openjdk.org/jdk/pull/15961#discussion_r1349178102
More information about the client-libs-dev
mailing list