Skip to content

8359061: Update and ProblemList manual test java/awt/Cursor/CursorDragTest/ListDragCursor.java #25705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

DamonGuy
Copy link
Contributor

@DamonGuy DamonGuy commented Jun 9, 2025

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). 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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8359061: Update and ProblemList manual test java/awt/Cursor/CursorDragTest/ListDragCursor.java (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25705/head:pull/25705
$ git checkout pull/25705

Update a local copy of the PR:
$ git checkout pull/25705
$ git pull https://git.openjdk.org/jdk.git pull/25705/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25705

View PR using the GUI difftool:
$ git pr show -t 25705

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25705.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 9, 2025

👋 Welcome back dnguyen! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jun 9, 2025

@DamonGuy This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8359061: Update and ProblemList manual test java/awt/Cursor/CursorDragTest/ListDragCursor.java

Reviewed-by: honkar, aivanov

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 131 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 9, 2025
@openjdk
Copy link

openjdk bot commented Jun 9, 2025

@DamonGuy The following label will be automatically applied to this pull request:

  • client

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@mlbridge
Copy link

mlbridge bot commented Jun 9, 2025

Comment on lines 47 to 52
If the mouse cursor starts as a Text Line Cursor (I-beam),
and does not change until you reached the List and
released the left mouse button (and becomes a Hand Cursor),
pass the test. This test fails if the cursor updates
when pointing over the different components before
dragging is complete.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new instructions doesn't seem to hold true when I tested on windows.
Additionally the instructions require rephrasing for clarity?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, the instructions need to be adjusted for each OS, or the test should be limited to a specific OS only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like there's a bug with this test when using it in a PassFailJFrame. When I move the createUI logic into a standalone java class's main method and add setVisible(true), the test works as expected for all OS's except macOS.

In this PassFailJFrame it looks like it "works" correctly for 1 second, and then the cursor updates anyway afterwards. I'm going to try to look into why this is, but is this what you are seeing too @honkar-jdk ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have attached the standalone test to the issue. I tried altering how ListDragCursor.java creates the UI but it seems that no matter what I do, the cursor still updates after 1 second. I'm looking into what PassFailJFrame does differently at the moment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's not the first time that we've encountered such an issue where using PassFailJFrame changes the behaviour of the test. Was it @TejeshR13's test?

I'm confused because PassFailJFrame does nothing more than provides a standard UI. It uses Swing components to display UI. Could this affect AWT components?

We have to look into what may cause the differences in behaviour.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DamonGuy

It seems like there's a bug with this test when using it in a PassFailJFrame. When I move the createUI logic into a standalone java class's main method and add setVisible(true), the test works as expected for all OS's except macOS.

I missed your earlier comment. Yes this seems to be true. Interestingly the cursor does not update when dragging across components until the left button is released with the standalone test on windows but with PFJ it does. I tried with PFJ's splitUI() & JPanel but the issue persists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking. I spent some time looking through the PFJFrame class and the standalone changing the test to better represent the PFJFrame version better, but I can't determine the exact cause. I will update this PR to include windows in the problem list and create a new JBS issue for windows.

Copy link
Contributor

@honkar-jdk honkar-jdk Jun 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the standalone test works as expected on windows, I'm not sure if the test needs to be problemlisted on windows, as @aivanov-jdk mentioned earlier it may be a side-effect of PFJ.

I used the standalone test and added another dummy frame, even with extra frame the test works as expected. (cursor remains a I-beam until the left mouse btn is released)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since I reworked the test to avoid using PFJ, I don't need to do anything like PL the test for windows anymore. I'll just file a new bug for PFJ instead.

Copy link
Contributor

@honkar-jdk honkar-jdk Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that sounds correct. The cursor issue that was observed is specific to PFJ.

Comment on lines 47 to 52
If the mouse cursor starts as a Text Line Cursor (I-beam),
and does not change until you reached the List and
released the left mouse button (and becomes a Hand Cursor),
pass the test. This test fails if the cursor updates
when pointing over the different components before
dragging is complete.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps, the instructions need to be adjusted for each OS, or the test should be limited to a specific OS only.

Comment on lines 47 to 48
If the mouse cursor starts as a Text Line Cursor (I-beam),
and does not change until you reached the List and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really how native applications behave on macOS?

At least on Windows, the cursor changes as soon as drag operation is started. The cursor shouldn't remain the I-beam when you drag from one component to another.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Windows 11, I tried using the file explorer's search text field. It turns into an I-beam and stays one until I let go of the left mouse button. I also tried with Cisco's VPN settings button (cog wheel) that is a hand cursor and it behaves the same way. I also tried dragging from the file explorer's search field to Cisco's cog wheel and it stays an I-beam throughout.

In macOS, I used the search bar in Finder to get an I-beam and drag. It also stays an I-beam until released.

@DamonGuy
Copy link
Contributor Author

I updated the test on @TejeshR13 's recommendation to refer to #22026 to work around having to use PFJFrame. Tested and this test works on Windows as expected.

Copy link
Contributor

@honkar-jdk honkar-jdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The custom manual test frame changes LGTM apart for minor inline suggestions and works as expected on windows.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 13, 2025
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jun 13, 2025
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 13, 2025
@aivanov-jdk
Copy link
Member

In fact, I also misinterpreted the scenario. I implied a text is dragged, but in this scenario no drag'n'drop operation happens, just text selection… as mouse is dragged.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jun 17, 2025
Copy link
Contributor

@honkar-jdk honkar-jdk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated changes LGTM

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 18, 2025
@aivanov-jdk
Copy link
Member

Funny!

The Windows test failing in PFJ was a separate issue that was found through this update.

You submitted JDK-8359469 to find the problem… What PassFailJFrame has in addition to a static frame that doesn't display anything is a timer. The timer updates each second, which sends additional messages — the dragged cursor changes as soon as the displayed time updates.

Pause the timer, and the drag cursor doesn't change until you release the left mouse button.

Harshitha was close to discovering it.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Jun 18, 2025
@DamonGuy
Copy link
Contributor Author

The timer updates each second, which sends additional messages — the dragged cursor changes as soon as the displayed time updates.

Pause the timer, and the drag cursor doesn't change until you release the left mouse button.

Harshitha was close to discovering it.

That makes a lot of sense. I saw your updates on that issue as well. I guess we can use this workaround in this niche case if necessary. Thanks @aivanov-jdk and @honkar-jdk for your help in looking into this!

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 19, 2025
@honkar-jdk
Copy link
Contributor

@aivanov-jdk

What PassFailJFrame has in addition to a static frame that doesn't display anything is a timer. The timer updates each second, which sends additional messages — the dragged cursor changes as soon as the displayed time updates.

Pause the timer, and the drag cursor doesn't change until you release the left mouse button

Nice find ! Finally an answer to the strange behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client [email protected] ready Pull request is ready to be integrated rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

3 participants