This testcase has failed intermittently in CI testing citing icon and ImageIcon images are not same. It's been observed that the rectangle been passed to Robot.createScreenCapture was incorrect to compare the icon images but is passing because the images were not different (but the images itself was incorrect) so not reliable.
When it fails, it is seen that the icon and imageicon images captured, with height of the screenCapture which is the value of the topinset of internalFrame, is wrong and differ in some pixels at the end `icon captureRect java.awt.Rectangle[x=715,y=366,width=500,height=5]` The failed images look like (where one can see that there is some difference at the end of line) icon image  image icon  which is not compring the icon images actually. Rectified screenrect to correctly compare the icons. After the fix, the images being compared are these icon image  imageicon  Several iterations of the modified test execution is green on all platforms. Link in JBS. I have also verified the modified test fails without 8146321 fix. ------------- Commit messages: - Fix Changes: https://git.openjdk.java.net/jdk/pull/4048/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4048&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8260331 Stats: 11 lines in 2 files changed: 4 ins; 1 del; 6 mod Patch: https://git.openjdk.java.net/jdk/pull/4048.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/4048/head:pull/4048 PR: https://git.openjdk.java.net/jdk/pull/4048