On Mon, 9 Oct 2023 05:07:13 GMT, Ravi Gupta <d...@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 50:

> 48:     private volatile static boolean passed = true;
> 49:     private volatile static Point compAt;
> 50:     private volatile static Dimension compSize;

To my personal taste, I'd add blank line to visually separate groups of fields:
Suggestion:

    private static Frame frame;

    private volatile static boolean entered = false;
    private volatile static boolean exited = false;
    private volatile static boolean passed = true;

    private volatile static Point compAt;
    private volatile static Dimension compSize;

test/jdk/java/awt/event/MouseEvent/MouseEnterExitTest.java line 53:

> 51: 
> 52:     private static final MouseListener mouseListener = new MouseAdapter() 
> {
> 53:         public void mouseEntered(MouseEvent e) {

Suggestion:

    private static final MouseListener mouseListener = new MouseAdapter() {
        @Override
        public void mouseEntered(MouseEvent e) {

Let's add `@Override` annotations, it's basically a new code, so it's better to 
add them.

test/jdk/java/awt/event/MouseEvent/MouseEnterExitTest.java line 63:

> 61:         }
> 62: 
> 63:         public void mouseExited(MouseEvent e) {

Suggestion:

        @Override
        public void mouseExited(MouseEvent e) {

test/jdk/java/awt/event/MouseEvent/MouseEnterExitTest.java line 101:

> 99:             EventQueue.invokeAndWait(MouseEnterExitTest::initializeGUI);
> 100:             robot.waitForIdle();
> 101:             EventQueue.invokeAndWait(() -> {

Suggestion:

            robot.waitForIdle();

            EventQueue.invokeAndWait(() -> {

test/jdk/java/awt/event/MouseEvent/MouseEnterExitTest.java line 110:

> 108:                 robot.mouseMove(i, compAt.y);
> 109:             }
> 110:             if (!passed || entered || !exited) {

Suggestion:


            if (!passed || entered || !exited) {

A couple of blank lines in the `main` method.

test/jdk/java/awt/event/MouseEvent/MouseEnterExitTest.java line 121:

> 119:     }
> 120: 
> 121:     public static void disposeFrame() {

Suggestion:

    private static void disposeFrame() {

It should be private.

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

PR Review: https://git.openjdk.org/jdk/pull/15961#pullrequestreview-1664717599
PR Review Comment: https://git.openjdk.org/jdk/pull/15961#discussion_r1350432826
PR Review Comment: https://git.openjdk.org/jdk/pull/15961#discussion_r1350434252
PR Review Comment: https://git.openjdk.org/jdk/pull/15961#discussion_r1350434537
PR Review Comment: https://git.openjdk.org/jdk/pull/15961#discussion_r1350435567
PR Review Comment: https://git.openjdk.org/jdk/pull/15961#discussion_r1350436186
PR Review Comment: https://git.openjdk.org/jdk/pull/15961#discussion_r1350436889

Reply via email to