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

8284619: javax/swing/JTable/8236907/LastVisibleRow.java failed with "Test Case Failed!!, Last Row not Visible!!!" #9117

Closed
wants to merge 11 commits into from

Conversation

TejeshR13
Copy link
Contributor

@TejeshR13 TejeshR13 commented Jun 10, 2022

Fix history - #7422.
The test is automatic and check if the last row is painted (Which was not happening before the fix, the last row appeared only after MouseClick operation) by capturing the last row before and after MouseClick Operation.If the both the captured images are same, then the test passes else it fails.
This Fix includes for ubuntu and macos failure, in which only the test case failed due to following reasons.

In ubuntu, the test fails due to unexpected dark line appearing on right side of last row before MouseClick operation.
In macos, the test fails since after MouseClick operation of last row, clearSelection didn't show any effect on the selected row.
The issue is intermittent and not able to reproduce it frequently. As a defensive fix, the rectangular area which is being captured is reduce for ubuntu failure and Delay is added between ClearSelection of focus and Image Capture for macos failure


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-8284619: javax/swing/JTable/8236907/LastVisibleRow.java failed with "Test Case Failed!!, Last Row not Visible!!!"

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9117

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 10, 2022

👋 Welcome back tr! 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 10, 2022

⚠️ @TejeshR13 This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

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

openjdk bot commented Jun 10, 2022

@TejeshR13 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 10, 2022
@mlbridge
Copy link

mlbridge bot commented Jun 10, 2022

Webrevs

Copy link
Contributor

@prsadhuk prsadhuk left a comment

Choose a reason for hiding this comment

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

Was there any reason of calling table.setFocusable(false) in clearSelect()? We have some focus related mach5 issues in macos that crops out intermittently so maybe we should get rid of that if it's not needed.
I think just calling clearSelection() would have been enough. Can you please check?

@TejeshR13
Copy link
Contributor Author

Was there any reason of calling table.setFocusable(false) in clearSelect()? We have some focus related mach5 issues in macos that crops out intermittently so maybe we should get rid of that if it's not needed. I think just calling clearSelection() would have been enough. Can you please check?

Yeah, table.setFocusable(false) is added intentionally, it is added to disable the cell focus. After selection the focus remains in cell, so in order to release the focus I used it. Any alternative to this is available?

@prsadhuk
Copy link
Contributor

prsadhuk commented Jun 10, 2022

Was there any reason of calling table.setFocusable(false) in clearSelect()? We have some focus related mach5 issues in macos that crops out intermittently so maybe we should get rid of that if it's not needed. I think just calling clearSelection() would have been enough. Can you please check?

Yeah, table.setFocusable(false) is added intentionally, it is added to disable the cell focus. After selection the focus remains in cell, so in order to release the focus I used it. Any alternative to this is available?

Even if the focus remains in the cell, what was the problem? I guess the problem was the contents was not drawn initially and only was getting drawn if rowcell is clicked. So, before and after mouseclick, the bufferedimage contents should be same, I guess focus is irrelevant here.

@TejeshR13
Copy link
Contributor Author

Was there any reason of calling table.setFocusable(false) in clearSelect()? We have some focus related mach5 issues in macos that crops out intermittently so maybe we should get rid of that if it's not needed. I think just calling clearSelection() would have been enough. Can you please check?

Yeah, table.setFocusable(false) is added intentionally, it is added to disable the cell focus. After selection the focus remains in cell, so in order to release the focus I used it. Any alternative to this is available?

Even if the focus remains in the cell, what was the problem? I guess the problem was the contents was not drawn initially and only was getting drawn if rowcell is clicked. So, before and after mouseclick, the bufferedimage contents should be same, I guess focus is irrelevant here.

No issue with the contents drawn. Before mouseclick there wouldn't be any focus on any cell, but after mouseclick the focus will be seen on the clicked cell. In order to remove that set focus, setFocusable(false) is required. Otherwise the matching fails due to cell focus draw as rectangular border around the cell.

@prsadhuk
Copy link
Contributor

Was there any reason of calling table.setFocusable(false) in clearSelect()? We have some focus related mach5 issues in macos that crops out intermittently so maybe we should get rid of that if it's not needed. I think just calling clearSelection() would have been enough. Can you please check?

Yeah, table.setFocusable(false) is added intentionally, it is added to disable the cell focus. After selection the focus remains in cell, so in order to release the focus I used it. Any alternative to this is available?

Even if the focus remains in the cell, what was the problem? I guess the problem was the contents was not drawn initially and only was getting drawn if rowcell is clicked. So, before and after mouseclick, the bufferedimage contents should be same, I guess focus is irrelevant here.

No issue with the contents drawn. Before mouseclick there wouldn't be any focus on any cell, but after mouseclick the focus will be seen on the clicked cell. In order to remove that set focus, setFocusable(false) is required. Otherwise the matching fails due to cell focus draw as rectangular border around the cell.

ok

@openjdk
Copy link

openjdk bot commented Jun 10, 2022

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

8284619: javax/swing/JTable/8236907/LastVisibleRow.java failed with "Test Case Failed!!, Last Row not Visible!!!"

Reviewed-by: psadhukhan, honkar

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

  • fe80721: 8287917: System.loadLibrary does not work on Big Sur if JDK is built with macOS SDK 10.15 and earlier
  • bbaeacb: 8265586: [windows] last button is not shown in AWT Frame with BorderLayout and MenuBar set.
  • 0f58097: 8288134: Super class names don't have envelopes
  • fb29770: 8287186: JDK modules participating in preview
  • 0530f4e: 8288094: cleanup old _MSC_VER handling
  • 1a65332: 8287906: Rewrite of GitHub Actions (GHA) sanity tests
  • c2ccf4c: 8288003: log events for os::dll_unload
  • 03dca56: 8287525: Extend IR annotation with new options to test specific target feature.
  • 86c9241: 8287028: AArch64: [vectorapi] Backend implementation of VectorMask.fromLong with SVE2
  • fbe9266: 8288378: [BACKOUT] DST not applying properly with zone id offset set with TZ env variable
  • ... and 287 more: https://git.openjdk.org/jdk/compare/e1f140d270cc666d26b888a0a25ca7b02e1239af...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 (@prsadhuk) 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 ready Pull request is ready to be integrated label Jun 10, 2022
@honkar-jdk
Copy link
Contributor

honkar-jdk commented Jun 13, 2022

In getCellClickPoint() method, you could simplify the code by returning point variable , instead of using extra result variable.

@honkar-jdk
Copy link
Contributor

honkar-jdk commented Jun 14, 2022

If the test criteria is to check if the last row is visible, then the following suggestion might help to make the test more stable on different platforms.

This is similar to one of the issues I'm working on and @azuev-java suggested a good idea, that I think could be applicable here too.

  • Set the background of ONLY the last row to a different color, say red. (can be done for all the cells of the third row)
  • Check if this color is visible using Robot.getPixelColor() at desired location.
  • If red is returned then the third row is visible, else throw RuntimeException()

This would simplify the test case as you wouldn't have to compare two buffered images - before and after images and deal with platform specific issues such as unexpected dark line (on Ubuntu) and clearing the focus (on Mac).

Hope this helps :)

@TejeshR13
Copy link
Contributor Author

If the test criteria is to check if the last row is visible, then the following suggestion might help to make the test more stable on different platforms.

This is similar to one of the issues I'm working on and @azuev-java suggested a good idea, that I think could be applicable here too.

  • Set the background of ONLY the last row to a different color, say red. (can be done for all the cells of the third row)
  • Check if this color is visible using Robot.getPixelColor() at desired location.
  • If red is returned then the third row is visible, else throw RuntimeException()

This would simplify the test case as you wouldn't have to compare two buffered images - before and after images and deal with platform specific issues such as unexpected dark line (on Ubuntu) and clearing the focus (on Mac).

Hope this helps :)

Its really helpful suggestion. But in this case we are validating the last row contents, not the last row itself. Before the fix the last row was painted without the contents, after the fix we are validating whether the contents are printed on it. We still can use the technique though to verify the contents, means have to get the text content position and check if it is black or still background color. But I feel for this test case this technique wont be robust enough and finding the text area inside the cell might not be accurate always.

@TejeshR13
Copy link
Contributor Author

In getCellClickPoint() method, you could simplify the code by returning point variable , instead of using extra result variable.

Updated.

@TejeshR13
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jun 15, 2022
@openjdk
Copy link

openjdk bot commented Jun 15, 2022

@TejeshR13
Your change (at version 4b02357) is now ready to be sponsored by a Committer.

@prsadhuk
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Jun 16, 2022

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

  • a179590: 8283091: Support type conversion between different data sizes in SLP
  • f7ba3b7: 8288300: AArch64: Remove the assertion in fmovs/fmovd(FloatRegister, FloatRegister)
  • 0761228: 8288443: Simplify vmClasses::resolve_all()
  • 9ff4034: 8288530: ProblemList serviceability/jvmti/VMObjectAlloc/VMObjectAllocTest.java in -Xcomp mode
  • 1855e9d: 8220732: setSeed(long) java api doc is missing warning about provided seed quality
  • 6d59561: 8288425: Footprint regression due MH creation when initializing StringConcatFactory
  • 3475e12: 8288330: Avoid redundant ConcurrentHashMap.get call in Http2ClientImpl.deleteConnection
  • cb5ef3d: 8288499: Restore cancel-in-progress in GHA
  • 13d4ddc: 8286962: java/net/httpclient/ServerCloseTest.java failed once with ConnectException
  • 6633855: 8288399: MacOS debug symbol files not always deterministic in reproducible builds
  • ... and 304 more: https://git.openjdk.org/jdk/compare/e1f140d270cc666d26b888a0a25ca7b02e1239af...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jun 16, 2022
@openjdk openjdk bot closed this Jun 16, 2022
@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 Jun 16, 2022
@openjdk
Copy link

openjdk bot commented Jun 16, 2022

@prsadhuk @TejeshR13 Pushed as commit 39526e2.

💡 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
3 participants