Skip to content
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

8333403: Write a test to check various components events are triggered properly #19521

Closed
wants to merge 11 commits into from

Conversation

ravigupta30
Copy link
Contributor

@ravigupta30 ravigupta30 commented Jun 3, 2024

This testcase checks for the following assertions for Component events:

  1. When components are resized, moved, hidden and shown the respective events are triggered.
  2. When the components are hidden/disabled also,the component events like resized/moved are triggered.
  3. When a hidden component is hidden again, or a visible component is shown again, the events should not be fired.
  4. When a window is minimized/restored then hidden and shown component events should be triggered.

Testing:
Tested using Mach5(20 times per platform) in macos,linux and windows and got all pass.


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-8333403: Write a test to check various components events are triggered properly (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19521

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 3, 2024

👋 Welcome back rgupta! 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 3, 2024

@ravigupta30 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:

8333403: Write a test to check various components events are triggered properly

Reviewed-by: 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 1303 new commits pushed to the master branch:

  • 6c91a16: 8340367: Opensource few AWT image tests
  • 865d99f: 8340596: Remove dead code from RequiresSetenv function in java.base/unix/native/libjli/java_md.c
  • 3411f9d: 8339995: Open source several AWT focus tests - series 6
  • 40cde00: 8340114: Remove outdated SelectVersion() function from the launcher and update the code comments explaining the code flow
  • c8ae848: 8340707: ProblemList applications/ctw/modules/java_base.java due to JDK-8340683
  • cd796e0: 8338918: Remove non translated file name from WinResources resource bundle
  • e97f0fe: 8340365: Position the first window of a window list
  • 8dcf7b8: 8340411: open source several 2D imaging tests
  • 833ff29: 8340461: Amend description for logArea
  • c6f1d5f: 8319332: Security properties files inclusion
  • ... and 1293 more: https://git.openjdk.org/jdk/compare/75220da26f647c6f3dabc05cea81cefaf3a1e195...master

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@DamonGuy, @aivanov-jdk) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

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

openjdk bot commented Jun 3, 2024

@ravigupta30 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.

@openjdk openjdk bot added the client client-libs-dev@openjdk.org label Jun 3, 2024
@mlbridge
Copy link

mlbridge bot commented Jun 3, 2024

@lawrence-andrew
Copy link
Contributor

Copyright is missing. Please add the Copyright.

Copy link
Contributor

@DamonGuy DamonGuy left a comment

Choose a reason for hiding this comment

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

Tested on MacOS. The test passes and looks functional. Minor comments.

Have you tried on Windows with different scaling? Looks like the only component location you access is for the panel position, which should be safe. I tried different scalings on MacOS with no issue. Curious because this was an issue with JButton a while before.

@ravigupta30
Copy link
Contributor Author

@DamonGuy
I have tried on Windows with different scaling , works fine for me .

@ravigupta30
Copy link
Contributor Author

any volunteer for review?

});

robot.delay(DELAY);
if (componentShown || componentHidden) {
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 possible that any other event is triggered? Or do you expect other events?

When you inconify the frame, you verify of all the event flags but you verify only two flags here.

Copy link
Contributor Author

@ravigupta30 ravigupta30 Aug 5, 2024

Choose a reason for hiding this comment

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

Here we expect events should not triggered.

When inconify i expect all events should not triggered , but when form Frame.ICONIFIED to Frame.NORMAL componentMoved and componentResized events are triggered , Events order on Windows and Mac are different.

Order of the events for Frame from Frame.ICONIFIED to Frame.NORMAL

On Windows

Component Shown
Frame is Visible with ExtendedState as ICONIFIED
Component Moved
Component Resized
Frame is Visible with ExtendedState as NORMAL

On MAC
Component Moved
Component Resized
Component Shown
Frame is Visible with ExtendedState as ICONIFIED
Frame is Visible with ExtendedState as NORMAL

Copy link
Member

Choose a reason for hiding this comment

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

when form Frame.ICONIFIED to Frame.NORMAL componentMoved and componentResized events are triggered

Then verify that these events are triggered:

-        if (componentShown || componentHidden) {
+        if (componentShown || componentHidden || !componentMoved
+            || !componentResized) {

Otherwise it looks as if you forgot to test something. You may have two if statements to print more precise error message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We observed different behavior between MS Windows and other OS ,we natively received WM_SIZE/WM_MOVE events when set frame iconify to
deiconify , The AWT sends the events to components when it receives the events from the native system.

Now we are applying the OS specific check to test this scenario.

Please check the details at JDK-6754618

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 2, 2024

@ravigupta30 This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@ravigupta30
Copy link
Contributor Author

any volunteer for review?

@openjdk openjdk bot removed the rfr Pull request is ready for review label Sep 17, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label Sep 17, 2024
Copy link
Member

@aivanov-jdk aivanov-jdk left a comment

Choose a reason for hiding this comment

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

I am still for moving the test into java/awt/Component folder.

@ravigupta30
Copy link
Contributor Author

moved test to java/awt/Component

Copy link
Member

@aivanov-jdk aivanov-jdk left a comment

Choose a reason for hiding this comment

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

Looks good to me except for minor nits.

Copy link
Member

@aivanov-jdk aivanov-jdk left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I presume you've run the updated test in CI.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Sep 23, 2024
@ravigupta30
Copy link
Contributor Author

I ran CI job with the latest code it passes without failure.

@ravigupta30
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Sep 24, 2024
@openjdk
Copy link

openjdk bot commented Sep 24, 2024

@ravigupta30
Your change (at version fe35276) is now ready to be sponsored by a Committer.

@aivanov-jdk
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Sep 26, 2024

Going to push as commit a02d895.
Since your change was applied there have been 1360 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Sep 26, 2024
@openjdk openjdk bot closed this Sep 26, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Sep 26, 2024
@openjdk
Copy link

openjdk bot commented Sep 26, 2024

@aivanov-jdk @ravigupta30 Pushed as commit a02d895.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

7 participants