3030 * @build Util
3131 * @run main JInternalFrameIconTest
3232 */
33+ import java .io .File ;
3334import java .awt .BorderLayout ;
3435import java .awt .Component ;
3536import java .awt .Graphics ;
3637import java .awt .Point ;
3738import java .awt .Rectangle ;
3839import java .awt .Robot ;
3940import java .awt .image .BufferedImage ;
41+ import javax .imageio .ImageIO ;
4042import javax .swing .Icon ;
4143import javax .swing .ImageIcon ;
4244import javax .swing .JDesktopPane ;
@@ -61,7 +63,6 @@ public class JInternalFrameIconTest {
6163
6264 public static void main (String [] args ) throws Exception {
6365 robot = new Robot ();
64- robot .delay (2000 );
6566 UIManager .LookAndFeelInfo [] lookAndFeelArray
6667 = UIManager .getInstalledLookAndFeels ();
6768 for (UIManager .LookAndFeelInfo lookAndFeelItem : lookAndFeelArray ) {
@@ -76,21 +77,28 @@ public static void main(String[] args) throws Exception {
7677 private static void executeCase (String lookAndFeelString ) throws Exception {
7778 if (tryLookAndFeel (lookAndFeelString )) {
7879 createImageIconUI (lookAndFeelString );
80+ robot .waitForIdle ();
7981 robot .delay (1000 );
8082 getImageIconBufferedImage ();
83+ robot .waitForIdle ();
8184 robot .delay (1000 );
8285 cleanUp ();
8386 robot .waitForIdle ();
87+ robot .delay (1000 );
8488
8589 createIconUI (lookAndFeelString );
90+ robot .waitForIdle ();
8691 robot .delay (1000 );
8792 getIconBufferedImage ();
93+ robot .waitForIdle ();
8894 robot .delay (1000 );
8995 cleanUp ();
9096 robot .waitForIdle ();
97+ robot .delay (1000 );
9198
9299 testIfSame (lookAndFeelString );
93100 robot .waitForIdle ();
101+ robot .delay (1000 );
94102 }
95103
96104 }
@@ -208,6 +216,8 @@ private static void getIconBufferedImage() throws Exception {
208216 private static void testIfSame (final String lookAndFeelString )
209217 throws Exception {
210218 if (!bufferedImagesEqual (imageIconImage , iconImage )) {
219+ ImageIO .write (imageIconImage , "png" , new File ("imageicon-fail.png" ));
220+ ImageIO .write (iconImage , "png" , new File ("iconImage-fail.png" ));
211221 String error ="[" + lookAndFeelString
212222 + "] : ERROR: icon and imageIcon not same." ;
213223 errorString += error ;
0 commit comments