< prev index next >

test/jdk/javax/swing/JComboBox/8182031/ComboPopupTest.java

Print this page
rev 47956 : 8191678: [TESTBUG] Add keyword headful in java/awt and javax tests.
Summary: Also fix some NPE thrown if run headless.

@@ -18,16 +18,19 @@
  *
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * 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;
 import java.awt.Point;
 import java.awt.Robot;

@@ -78,11 +81,11 @@
             System.out.println("popmenu visible " + comboBox.isPopupVisible());
             if (!comboBox.isPopupVisible()) {
                 throw new RuntimeException("combobox popup is not visible");
             }
         } finally {
-            SwingUtilities.invokeAndWait(()->frame.dispose());
+            if (frame != null) { SwingUtilities.invokeAndWait(()->frame.dispose()); }
         }
     }
 
     public void start() {
         frame = new JFrame();
< prev index next >