On Fri, 13 Jun 2025 17:11:17 GMT, Damon Nguyen <dngu...@openjdk.org> wrote:

>> This change is to restore the original intent of the test by updating the 
>> instructions to check that the type of Cursor is preserved when clicked and 
>> dragged. Now the test correctly has instructions to check that an I-beam 
>> cursor stays an I-beam until released over a List with its cursor being 
>> updated to a Hand cursor.
>> 
>> There is a bug where this does not correctly update in macOS (found in 
>> [JDK-7177297](https://bugs.openjdk.org/browse/JDK-7177297)). So, this test 
>> needs to be problem-listed.
>> 
>> I have confirmed that preserving the cursor image when dragging is native 
>> behavior across macOS, Windows, and Ubuntu. And I have checked that the test 
>> passes on both Windows and Ubuntu, while macOS fails and immediately updates 
>> the cursor as it leaves the TextArea.
>
> Damon Nguyen has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Rearrange and update test.

test/jdk/java/awt/Cursor/CursorDragTest/ListDragCursor.java line 53:

> 51:         });
> 52:         countDownLatch.await();
> 53:         System.out.println("Test Passed");

@DamonGuy

Test continues to run if the user does not click on Pass/Fail buttons. It can 
be avoided by adding a timeout for the countdown latch as below and calling 
disposeFrames() in finally block.

Suggestion:

        countDownLatch = new CountDownLatch(1);
        try {
            EventQueue.invokeAndWait(() -> {
                createTestFrame();
                createInstructionsFrame();
            });

            if (!countDownLatch.await(2, TimeUnit.MINUTES)) {
                throw new RuntimeException("Test timeout : No action was"
                                           + " taken on the test.");
            }
            System.out.println("Test passed.");
        } finally {
            EventQueue.invokeAndWait(ListDragCursor::disposeFrames);
        }

test/jdk/java/awt/Cursor/CursorDragTest/ListDragCursor.java line 113:

> 111:             disposeFrames();
> 112:             throw new RuntimeException("Test Failed");
> 113:         });

With the test timeout changes the following lines requires an update

Suggestion:

        passBtn.addActionListener(e -> {
            countDownLatch.countDown();
        });

        failBtn.addActionListener(e -> {
            throw new RuntimeException("Test Failed");
        });

test/jdk/java/awt/Cursor/CursorDragTest/ListDragCursor.java line 125:

> 123: 
> 124:     static void disposeFrames() {
> 125:         countDownLatch.countDown();

countDownLatch.countDown(); needs to be removed from disposeFrames().

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25705#discussion_r2150945523
PR Review Comment: https://git.openjdk.org/jdk/pull/25705#discussion_r2150947869
PR Review Comment: https://git.openjdk.org/jdk/pull/25705#discussion_r2150948842

Reply via email to