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

Harshitha Onkar honkar at openjdk.java.net
Tue Jun 14 00:23:52 UTC 2022


On Fri, 10 Jun 2022 05:35:22 GMT, Tejesh R <tr at openjdk.org> wrote:

> 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

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 was working on and @[azuev-java](https://github.com/azuev-java) suggested a good idea, that I think could be applicable here too.

- Set the background of last row (can be done for all the cells of the third row) to a different color, say red.
- 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 :)

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

PR: https://git.openjdk.org/jdk/pull/9117



More information about the client-libs-dev mailing list