changeset 14042:f633780cf089

8151282: [TEST_BUG] javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java fails with GTK LnF Reviewed-by: serb, alexsch
author aniyogi
date Wed, 23 Mar 2016 17:25:27 +0530
parents 818f74ccccf9
children 5f53e3dabdc5
files test/javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java
diffstat 1 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java	Wed Mar 23 14:25:22 2016 +0400
+++ b/test/javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java	Wed Mar 23 17:25:27 2016 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 8146321
+ * @bug 8146321 8151282
  * @summary verifies JInternalFrame Icon and ImageIcon
  * @library ../../regtesthelpers
  * @build Util
@@ -53,8 +53,9 @@
     private static Icon titleIcon;
     private static BufferedImage imageIconImage;
     private static BufferedImage iconImage;
+    private static Robot robot;
+    private static volatile String errorString = "";
 
-    private static Robot robot;
 
     public static void main(String[] args) throws Exception {
         robot = new Robot();
@@ -64,6 +65,9 @@
         for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
             executeCase(lookAndFeelItem.getClassName());
         }
+        if (!"".equals(errorString)) {
+            throw new RuntimeException("Error Log:\n" + errorString);
+        }
 
     }
 
@@ -72,17 +76,18 @@
             createImageIconUI(lookAndFeelString);
             robot.delay(1000);
             getImageIconBufferedImage();
-            robot.waitForIdle();
+            robot.delay(1000);
             cleanUp();
             robot.waitForIdle();
 
             createIconUI(lookAndFeelString);
             robot.delay(1000);
             getIconBufferedImage();
-            robot.waitForIdle();
+            robot.delay(1000);
             cleanUp();
             robot.waitForIdle();
-            testIfSame();
+
+            testIfSame(lookAndFeelString);
             robot.waitForIdle();
         }
 
@@ -198,11 +203,16 @@
                 = robot.createScreenCapture(captureRect);
     }
 
-    private static void testIfSame() throws Exception {
+    private static void testIfSame(final String lookAndFeelString)
+            throws Exception {
         if (!bufferedImagesEqual(imageIconImage, iconImage)) {
-            System.err.println("ERROR: icon and imageIcon not same.");
+            String error ="[" + lookAndFeelString
+                    + "] : ERROR: icon and imageIcon not same.";
+            errorString += error;
+            System.err.println(error);
         } else {
-            System.out.println("SUCCESS: icon and imageIcon same.");
+            System.out.println("[" + lookAndFeelString
+                    + "] : SUCCESS: icon and imageIcon same.");
         }
     }
 
@@ -260,6 +270,11 @@
 
     private static boolean tryLookAndFeel(String lookAndFeelString)
             throws Exception {
+        //This test case is not applicable for Motif and gtk LAFs
+        if(lookAndFeelString.contains("motif")
+                || lookAndFeelString.contains("gtk")) {
+            return false;
+        }
         try {
             UIManager.setLookAndFeel(
                     lookAndFeelString);