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

Tejesh R tr at openjdk.java.net
Tue Jun 14 05:17:48 UTC 2022


On Tue, 14 Jun 2022 00:20:18 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

> 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](https://github.com/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.

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

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



More information about the client-libs-dev mailing list