<Swing Dev> RFR: 8260331: javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java failed with "ERROR: icon and imageIcon not same."

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Mon May 17 09:13:18 UTC 2021


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
![iconImage-fail](https://user-images.githubusercontent.com/43534309/118223456-f5680700-b49e-11eb-9d9e-937f8bf96fa3.png)
image icon
![imageicon-fail](https://user-images.githubusercontent.com/43534309/118223479-01ec5f80-b49f-11eb-9f5e-f5da704f71ba.png)

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
![iconImage-success](https://user-images.githubusercontent.com/43534309/118223532-27796900-b49f-11eb-8bfc-63a9ed7e97f8.png)
imageicon
![imageicon-success](https://user-images.githubusercontent.com/43534309/118223544-2c3e1d00-b49f-11eb-8af9-ef3a22a4f8c9.png)

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


More information about the swing-dev mailing list