8151282: [TEST_BUG] javax/swing/JInternalFrame/8146321/JInternalFrameIconTest.java fails with GTK LnF

Reviewed-by: serb, alexsch
This commit is contained in:
Avik Niyogi 2016-03-23 17:25:27 +05:30
parent c28c517f2e
commit d8f82c9477

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -22,7 +22,7 @@
*/ */
/* @test /* @test
* @bug 8146321 * @bug 8146321 8151282
* @summary verifies JInternalFrame Icon and ImageIcon * @summary verifies JInternalFrame Icon and ImageIcon
* @library ../../regtesthelpers * @library ../../regtesthelpers
* @build Util * @build Util
@ -53,8 +53,9 @@ public class JInternalFrameIconTest {
private static Icon titleIcon; private static Icon titleIcon;
private static BufferedImage imageIconImage; private static BufferedImage imageIconImage;
private static BufferedImage iconImage; private static BufferedImage iconImage;
private static Robot robot; private static Robot robot;
private static volatile String errorString = "";
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
robot = new Robot(); robot = new Robot();
@ -64,6 +65,9 @@ public class JInternalFrameIconTest {
for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) { for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) {
executeCase(lookAndFeelItem.getClassName()); executeCase(lookAndFeelItem.getClassName());
} }
if (!"".equals(errorString)) {
throw new RuntimeException("Error Log:\n" + errorString);
}
} }
@ -72,17 +76,18 @@ public class JInternalFrameIconTest {
createImageIconUI(lookAndFeelString); createImageIconUI(lookAndFeelString);
robot.delay(1000); robot.delay(1000);
getImageIconBufferedImage(); getImageIconBufferedImage();
robot.waitForIdle(); robot.delay(1000);
cleanUp(); cleanUp();
robot.waitForIdle(); robot.waitForIdle();
createIconUI(lookAndFeelString); createIconUI(lookAndFeelString);
robot.delay(1000); robot.delay(1000);
getIconBufferedImage(); getIconBufferedImage();
robot.waitForIdle(); robot.delay(1000);
cleanUp(); cleanUp();
robot.waitForIdle(); robot.waitForIdle();
testIfSame();
testIfSame(lookAndFeelString);
robot.waitForIdle(); robot.waitForIdle();
} }
@ -198,11 +203,16 @@ public class JInternalFrameIconTest {
= robot.createScreenCapture(captureRect); = robot.createScreenCapture(captureRect);
} }
private static void testIfSame() throws Exception { private static void testIfSame(final String lookAndFeelString)
throws Exception {
if (!bufferedImagesEqual(imageIconImage, iconImage)) { 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 { } else {
System.out.println("SUCCESS: icon and imageIcon same."); System.out.println("[" + lookAndFeelString
+ "] : SUCCESS: icon and imageIcon same.");
} }
} }
@ -260,6 +270,11 @@ public class JInternalFrameIconTest {
private static boolean tryLookAndFeel(String lookAndFeelString) private static boolean tryLookAndFeel(String lookAndFeelString)
throws Exception { throws Exception {
//This test case is not applicable for Motif and gtk LAFs
if(lookAndFeelString.contains("motif")
|| lookAndFeelString.contains("gtk")) {
return false;
}
try { try {
UIManager.setLookAndFeel( UIManager.setLookAndFeel(
lookAndFeelString); lookAndFeelString);