8191678: [TESTBUG] Add keyword headful in java/awt and javax tests.
authorgoetz
Tue, 21 Nov 2017 17:39:04 +0100
changeset 48063 50d61f4b5d1a
parent 48062 f14a1972f35d
child 48064 390794d000e6
child 55956 3c681a5d4ba1
8191678: [TESTBUG] Add keyword headful in java/awt and javax tests. Summary: Also fix some NPE thrown if run headless. Reviewed-by: serb
test/jdk/java/awt/Component/GetScreenLocTest/ComponentGetLocationOnScreenNPETest.java
test/jdk/java/awt/Dialog/SiblingChildOrder/SiblingChildOrderTest.java
test/jdk/java/awt/Focus/FocusTransitionTest/FocusTransitionTest.java
test/jdk/javax/swing/DefaultButtonModel/DefaultButtonModelCrashTest.java
test/jdk/javax/swing/GraphicsConfigNotifier/TestMultiScreenGConfigNotify.java
test/jdk/javax/swing/JButton/TestGlyphBreak.java
test/jdk/javax/swing/JComboBox/8182031/ComboPopupTest.java
test/jdk/javax/swing/JMenu/8178430/LabelDotTest.java
test/jdk/javax/swing/JTextArea/TestTabSize.java
test/jdk/javax/swing/dnd/8139050/NativeErrorsInTableDnD.java
test/jdk/javax/swing/plaf/nimbus/TestNimbusOverride.java
test/jdk/javax/swing/text/DefaultCaret/HidingSelection/HidingSelectionTest.java
--- a/test/jdk/java/awt/Component/GetScreenLocTest/ComponentGetLocationOnScreenNPETest.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/java/awt/Component/GetScreenLocTest/ComponentGetLocationOnScreenNPETest.java	Tue Nov 21 17:39:04 2017 +0100
@@ -25,6 +25,7 @@
  * @test
  * @bug 8189204
  * @summary Possible NPE in Component::getLocationOnScreen()
+ * @key headful
  * @run main ComponentGetLocationOnScreenNPETest
  */
 
--- a/test/jdk/java/awt/Dialog/SiblingChildOrder/SiblingChildOrderTest.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/java/awt/Dialog/SiblingChildOrder/SiblingChildOrderTest.java	Tue Nov 21 17:39:04 2017 +0100
@@ -21,9 +21,11 @@
  * questions.
  */
 
-/* @test
+/**
+ * @test
  * @bug 8190230
  * @summary [macosx] Order of overlapping of modal dialogs is wrong
+ * @key headful
  * @run main SiblingChildOrderTest
  */
 
--- a/test/jdk/java/awt/Focus/FocusTransitionTest/FocusTransitionTest.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/java/awt/Focus/FocusTransitionTest/FocusTransitionTest.java	Tue Nov 21 17:39:04 2017 +0100
@@ -21,10 +21,12 @@
  * questions.
  */
 
-/* @test
+/**
+ * @test
  * @bug 8155197
  * @summary Tests whether the value of mostRecentFocusOwner for a window is correct, if
  *          another window is displayed during focus transition
+ * @key headful
  * @library ../../regtesthelpers
  * @build Util
  * @run main FocusTransitionTest
--- a/test/jdk/javax/swing/DefaultButtonModel/DefaultButtonModelCrashTest.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/javax/swing/DefaultButtonModel/DefaultButtonModelCrashTest.java	Tue Nov 21 17:39:04 2017 +0100
@@ -20,12 +20,15 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/*
+
+/**
  * @test
  * @bug 8182577
  * @summary  Verifies if moving focus via custom ButtonModel causes crash
+ * @key headful
  * @run main DefaultButtonModelCrashTest
  */
+
 import java.awt.BorderLayout;
 import java.awt.Container;
 import java.awt.Point;
@@ -61,7 +64,7 @@
             robot.keyPress(KeyEvent.VK_TAB);
             robot.keyRelease(KeyEvent.VK_TAB);
         } finally {
-            SwingUtilities.invokeAndWait(()->frame  .dispose());
+            if (frame != null) { SwingUtilities.invokeAndWait(()->frame.dispose()); }
         }
     }
 
--- a/test/jdk/javax/swing/GraphicsConfigNotifier/TestMultiScreenGConfigNotify.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/javax/swing/GraphicsConfigNotifier/TestMultiScreenGConfigNotify.java	Tue Nov 21 17:39:04 2017 +0100
@@ -20,12 +20,14 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/*
+
+/**
  * @test
  * @bug 8178025
  * @summary  Verifies if graphicsConfiguration property notification is sent
  *           when frame is moved from one screen to another in multiscreen
  *           environment.
+ * @key headful
  * @run main TestMultiScreenGConfigNotify
  */
 
--- a/test/jdk/javax/swing/JButton/TestGlyphBreak.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/javax/swing/JButton/TestGlyphBreak.java	Tue Nov 21 17:39:04 2017 +0100
@@ -20,10 +20,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/*
+
+/**
  * @test
  * @bug 8191428
  * @summary  Verifies if text view is not borken into multiple lines
+ * @key headful
  * @run main/othervm -Dsun.java2d.uiScale=1.2 TestGlyphBreak
  */
 
--- a/test/jdk/javax/swing/JComboBox/8182031/ComboPopupTest.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/javax/swing/JComboBox/8182031/ComboPopupTest.java	Tue Nov 21 17:39:04 2017 +0100
@@ -20,12 +20,15 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/*
+
+/**
  * @test
  * @bug 8182031
  * @summary  Verifies if ComboBox Popup opens and closes immediately
+ * @key headful
  * @run main ComboPopupTest
  */
+
 import java.awt.Container;
 import java.awt.Dimension;
 import java.awt.FlowLayout;
@@ -80,7 +83,7 @@
                 throw new RuntimeException("combobox popup is not visible");
             }
         } finally {
-            SwingUtilities.invokeAndWait(()->frame.dispose());
+            if (frame != null) { SwingUtilities.invokeAndWait(()->frame.dispose()); }
         }
     }
 
--- a/test/jdk/javax/swing/JMenu/8178430/LabelDotTest.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/javax/swing/JMenu/8178430/LabelDotTest.java	Tue Nov 21 17:39:04 2017 +0100
@@ -20,13 +20,16 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/*
+
+/**
  * @test
  * @bug 8178430
  * @summary JMenu in GridBagLayout flickers when label text shows "..." and
  * is updated
+ * @key headful
  * @run main LabelDotTest
  */
+
 import java.awt.Dimension;
 import java.awt.GridBagConstraints;
 import java.awt.GridBagLayout;
@@ -112,7 +115,9 @@
             SwingUtilities.invokeAndWait(() -> createUI());
             runTest(50);
         } finally {
-            SwingUtilities.invokeAndWait(() -> frame.dispose());
+            if (frame != null) {
+                SwingUtilities.invokeAndWait(() -> frame.dispose());
+            }
             if (isException)
                 throw new RuntimeException("Size of Menu bar is not correct.");
         }
--- a/test/jdk/javax/swing/JTextArea/TestTabSize.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/javax/swing/JTextArea/TestTabSize.java	Tue Nov 21 17:39:04 2017 +0100
@@ -20,10 +20,12 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/*
+
+/**
  * @test
  * @bug 8187957
  * @summary  Verifies Tab Size works correctly in JTextArea
+ * @key headful
  * @run main TestTabSize
  */
 
@@ -96,7 +98,9 @@
             } catch (BadLocationException ex) {
                 excpnthrown = true;
             } finally {
-                f.dispose();
+                if (f != null) {
+                    f.dispose();
+                }
             }
         });
         if (excpnthrown) {
--- a/test/jdk/javax/swing/dnd/8139050/NativeErrorsInTableDnD.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/javax/swing/dnd/8139050/NativeErrorsInTableDnD.java	Tue Nov 21 17:39:04 2017 +0100
@@ -40,10 +40,12 @@
 /**
  * @test
  * @bug 8139050 8153871
+ * @key headful
  * @library ../../../../lib/testlibrary
  * @build ExtendedRobot
  * @run main/othervm/timeout=360 -Xcheck:jni NativeErrorsInTableDnD
  */
+
 public final class NativeErrorsInTableDnD {
 
     private static JFrame frame;
--- a/test/jdk/javax/swing/plaf/nimbus/TestNimbusOverride.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/javax/swing/plaf/nimbus/TestNimbusOverride.java	Tue Nov 21 17:39:04 2017 +0100
@@ -20,13 +20,16 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-/*
+
+/**
  * @test
  * @bug 8043315
  * @summary  Verifies if setting Nimbus.Overrides property affects
  *           keymap installation
+ * @key headful
  * @run main TestNimbusOverride
  */
+
 import java.awt.BorderLayout;
 import java.awt.Component;
 import java.awt.Dimension;
--- a/test/jdk/javax/swing/text/DefaultCaret/HidingSelection/HidingSelectionTest.java	Tue Dec 05 17:19:48 2017 +0800
+++ b/test/jdk/javax/swing/text/DefaultCaret/HidingSelection/HidingSelectionTest.java	Tue Nov 21 17:39:04 2017 +0100
@@ -30,6 +30,7 @@
  * @test
  * @bug 8188081
  * @summary  Text selection does not clear after focus is lost
+ * @key headful
  * @run main HidingSelectionTest
  */