# HG changeset patch # User serb # Date 1518812678 28800 # Node ID 82c1fe23c469dcd1a74bceb3301e718833f5bc47 # Parent 149647adb6332b1272bef843e9e482b28670c1a7 8196196: Headful tests should not be run in headless mode Reviewed-by: prr diff -r 149647adb633 -r 82c1fe23c469 test/jdk/java/awt/Color/XRenderTranslucentColorDrawTest.java --- a/test/jdk/java/awt/Color/XRenderTranslucentColorDrawTest.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/java/awt/Color/XRenderTranslucentColorDrawTest.java Fri Feb 16 12:24:38 2018 -0800 @@ -23,6 +23,7 @@ /* * @test + * @key headful * @bug 8176795 * @summary Test verifies that we get proper color when we draw translucent * color over an opaque color using X Render extension in Linux. diff -r 149647adb633 -r 82c1fe23c469 test/jdk/java/awt/FileDialog/FileDialogMemoryLeak/FileDialogLeakTest.java --- a/test/jdk/java/awt/FileDialog/FileDialogMemoryLeak/FileDialogLeakTest.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/java/awt/FileDialog/FileDialogMemoryLeak/FileDialogLeakTest.java Fri Feb 16 12:24:38 2018 -0800 @@ -27,6 +27,7 @@ /** * @test + * @key headful * @bug 8177758 * @requires os.family == "windows" * @summary Regression in java.awt.FileDialog diff -r 149647adb633 -r 82c1fe23c469 test/jdk/java/awt/FileDialog/MoveToTrashTest.java --- a/test/jdk/java/awt/FileDialog/MoveToTrashTest.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/java/awt/FileDialog/MoveToTrashTest.java Fri Feb 16 12:24:38 2018 -0800 @@ -23,6 +23,7 @@ /* @test + @key headful @bug 8190515 8193468 @summary java.awt.Desktop.moveToTrash(File) prompts on Windows 7 but not on Mac. @run main MoveToTrashTest diff -r 149647adb633 -r 82c1fe23c469 test/jdk/java/awt/Gtk/GtkVersionTest/GtkVersionTest.java --- a/test/jdk/java/awt/Gtk/GtkVersionTest/GtkVersionTest.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/java/awt/Gtk/GtkVersionTest/GtkVersionTest.java Fri Feb 16 12:24:38 2018 -0800 @@ -22,6 +22,7 @@ */ /* @test + * @key headful * @bug 8156121 * @summary "Fail forward" fails for GTK3 if no GTK2 available * @modules java.desktop/sun.awt diff -r 149647adb633 -r 82c1fe23c469 test/jdk/java/awt/JAWT/JAWT.sh --- a/test/jdk/java/awt/JAWT/JAWT.sh Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/java/awt/JAWT/JAWT.sh Fri Feb 16 12:24:38 2018 -0800 @@ -22,6 +22,7 @@ # questions. # @test JAWT.sh +# @key headful # @bug 7190587 # @summary Tests Java AWT native interface library # @author kshefov @@ -111,7 +112,7 @@ else ARCH="i386" fi - SYST="cygwin" + SYST="cygwin" MAKE="make" ;; Darwin ) diff -r 149647adb633 -r 82c1fe23c469 test/jdk/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.java --- a/test/jdk/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/java/awt/Toolkit/BadDisplayTest/BadDisplayTest.java Fri Feb 16 12:24:38 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, 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 @@ -24,18 +24,23 @@ /* * @test + * @key headful * @summary Test that Toolkit.getDefaultToolkit throws AWTError exception if bad DISPLAY variable was set * @bug 6818083 * * @run shell/timeout=240 BadDisplayTest.sh */ -import java.awt.*; +import java.awt.AWTError; +import java.awt.Toolkit; public class BadDisplayTest{ public static void main(String[] args) { + if (Boolean.getBoolean("java.awt.headless")) { + return; + } - Throwable th = null; + Throwable th = null; try { Toolkit.getDefaultToolkit(); } catch (Throwable x) { diff -r 149647adb633 -r 82c1fe23c469 test/jdk/java/awt/Toolkit/DesktopProperties/rfe4758438.java --- a/test/jdk/java/awt/Toolkit/DesktopProperties/rfe4758438.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/java/awt/Toolkit/DesktopProperties/rfe4758438.java Fri Feb 16 12:24:38 2018 -0800 @@ -28,6 +28,7 @@ /* * @test + * @key headful * @bug 4758438 * @summary Testcase to check the implementation of RFE 4758438 * The RFE suggests that the GNOME desktop properties diff -r 149647adb633 -r 82c1fe23c469 test/jdk/java/awt/TrayIcon/SystemTrayInstance/SystemTrayInstanceTest.java --- a/test/jdk/java/awt/TrayIcon/SystemTrayInstance/SystemTrayInstanceTest.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/java/awt/TrayIcon/SystemTrayInstance/SystemTrayInstanceTest.java Fri Feb 16 12:24:38 2018 -0800 @@ -25,6 +25,7 @@ /* * @test + * @key headful * @summary Check the getSystemTray method of the SystemTray. Checks if * a proper instance is returned in supported platforms and a proper * exception is thrown in unsupported platforms diff -r 149647adb633 -r 82c1fe23c469 test/jdk/java/awt/dnd/BadSerializaionTest/BadSerializationTest.java --- a/test/jdk/java/awt/dnd/BadSerializaionTest/BadSerializationTest.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/java/awt/dnd/BadSerializaionTest/BadSerializationTest.java Fri Feb 16 12:24:38 2018 -0800 @@ -23,6 +23,7 @@ /** * @test + * @key headful * @bug 8030050 * @summary Validate fields on DnD class deserialization * @author petr.pchelko@oracle.com diff -r 149647adb633 -r 82c1fe23c469 test/jdk/java/awt/print/PrinterJob/PrintCrashTest.java --- a/test/jdk/java/awt/print/PrinterJob/PrintCrashTest.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/java/awt/print/PrinterJob/PrintCrashTest.java Fri Feb 16 12:24:38 2018 -0800 @@ -23,7 +23,7 @@ /** * @test - * @key printer + * @key printer headful * @bug 8163889 * @summary Printing crashes on OSX. * @run main PrintCrashTest diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/accessibility/AccessibilityProvider/basic.sh --- a/test/jdk/javax/accessibility/AccessibilityProvider/basic.sh Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/accessibility/AccessibilityProvider/basic.sh Fri Feb 16 12:24:38 2018 -0800 @@ -21,6 +21,7 @@ # questions. # # @test +# @key headful # @bug 8055160 # @summary Unit test for javax.accessibility.AccessibilitySPI # diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/ClientProperty/UIClientPropertyKeyTest/UIClientPropertyKeyTest.java --- a/test/jdk/javax/swing/ClientProperty/UIClientPropertyKeyTest/UIClientPropertyKeyTest.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/ClientProperty/UIClientPropertyKeyTest/UIClientPropertyKeyTest.java Fri Feb 16 12:24:38 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, 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 @@ -92,8 +92,10 @@ try { UIManager.setLookAndFeel(laf.getClassName()); System.out.println("LookAndFeel: " + laf.getClassName()); + } catch (final UnsupportedLookAndFeelException ignored){ + System.out.println("Unsupported LookAndFeel: " + laf.getClassName()); } catch (ClassNotFoundException | InstantiationException | - UnsupportedLookAndFeelException | IllegalAccessException e) { + IllegalAccessException e) { throw new RuntimeException(e); } } diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/GroupLayout/7071166/bug7071166.java --- a/test/jdk/javax/swing/GroupLayout/7071166/bug7071166.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/GroupLayout/7071166/bug7071166.java Fri Feb 16 12:24:38 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, 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 @@ -28,9 +28,22 @@ * @author Pavel Porvatov */ -import javax.swing.*; -import static javax.swing.SwingConstants.*; -import java.awt.*; +import java.awt.Container; + +import javax.swing.JButton; +import javax.swing.LayoutStyle; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; + +import static javax.swing.SwingConstants.EAST; +import static javax.swing.SwingConstants.NORTH; +import static javax.swing.SwingConstants.NORTH_EAST; +import static javax.swing.SwingConstants.NORTH_WEST; +import static javax.swing.SwingConstants.SOUTH; +import static javax.swing.SwingConstants.SOUTH_EAST; +import static javax.swing.SwingConstants.SOUTH_WEST; +import static javax.swing.SwingConstants.WEST; public class bug7071166 { private static final int[] POSITIONS = {NORTH, EAST, SOUTH, WEST, // valid positions @@ -38,8 +51,11 @@ public static void main(String[] args) throws Exception { for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels()) { - UIManager.setLookAndFeel(lookAndFeelInfo.getClassName()); - + try { + UIManager.setLookAndFeel(lookAndFeelInfo.getClassName()); + } catch (final UnsupportedLookAndFeelException ignored) { + continue; + } System.out.println("LookAndFeel: " + lookAndFeelInfo.getName()); SwingUtilities.invokeAndWait(new Runnable() { diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/JComboBox/6632953/bug6632953.java --- a/test/jdk/javax/swing/JComboBox/6632953/bug6632953.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/JComboBox/6632953/bug6632953.java Fri Feb 16 12:24:38 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2018, 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 @@ -29,6 +29,7 @@ import javax.swing.JComboBox; import javax.swing.SwingUtilities; import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.metal.MetalComboBoxUI; public class bug6632953 { @@ -43,6 +44,8 @@ : UIManager.getInstalledLookAndFeels()) { try { UIManager.setLookAndFeel(lafInfo.getClassName()); + } catch (UnsupportedLookAndFeelException ignored) { + continue; } catch (Exception e) { throw new RuntimeException(e); } diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/JComboBox/7082443/bug7082443.java --- a/test/jdk/javax/swing/JComboBox/7082443/bug7082443.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/JComboBox/7082443/bug7082443.java Fri Feb 16 12:24:38 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2018, 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 @@ -36,8 +36,11 @@ public static void main(String[] args) throws Exception { for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels()) { if (lookAndFeelInfo.getClassName().contains(GTK_LAF_CLASS)) { - UIManager.setLookAndFeel(lookAndFeelInfo.getClassName()); - + try { + UIManager.setLookAndFeel(lookAndFeelInfo.getClassName()); + } catch (final UnsupportedLookAndFeelException ignored) { + continue; + } SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/JFileChooser/6489130/bug6489130.java --- a/test/jdk/javax/swing/JFileChooser/6489130/bug6489130.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/JFileChooser/6489130/bug6489130.java Fri Feb 16 12:24:38 2018 -0800 @@ -22,6 +22,7 @@ */ /* @test + * @key headful * @bug 6489130 * @summary FileChooserDemo hung by keeping pressing Enter key * @author Pavel Porvatov diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/JFileChooser/8080628/bug8080628.java --- a/test/jdk/javax/swing/JFileChooser/8080628/bug8080628.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/JFileChooser/8080628/bug8080628.java Fri Feb 16 12:24:38 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, 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 @@ -25,6 +25,7 @@ import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; import sun.swing.SwingUtilities2; @@ -77,7 +78,11 @@ try { LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels(); for (LookAndFeelInfo info : lafInfo) { - UIManager.setLookAndFeel(info.getClassName()); + try { + UIManager.setLookAndFeel(info.getClassName()); + } catch (final UnsupportedLookAndFeelException ignored) { + continue; + } for (Locale locale : LOCALES) { for (String key : MNEMONIC_KEYS) { diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/JFrame/Serialization/JFrameMenuSerializationTest.java --- a/test/jdk/javax/swing/JFrame/Serialization/JFrameMenuSerializationTest.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/JFrame/Serialization/JFrameMenuSerializationTest.java Fri Feb 16 12:24:38 2018 -0800 @@ -23,6 +23,7 @@ /** * @test + * @key headful * @bug 8189201 * @summary [macosx] NotSerializableException during JFrame with MenuBar * serialization diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/JLayer/8041982/bug8041982.java --- a/test/jdk/javax/swing/JLayer/8041982/bug8041982.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/JLayer/8041982/bug8041982.java Fri Feb 16 12:24:38 2018 -0800 @@ -22,6 +22,7 @@ */ /* @test + * @key headful * @bug 8041982 * @summary Use of animated icon in JLayer causes CPU spin * @author Alexander Potochkin diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/JTableHeader/8020039/TableHeaderRendererExceptionTest.java --- a/test/jdk/javax/swing/JTableHeader/8020039/TableHeaderRendererExceptionTest.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/JTableHeader/8020039/TableHeaderRendererExceptionTest.java Fri Feb 16 12:24:38 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2018, 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,6 +22,7 @@ */ import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; import javax.swing.table.JTableHeader; /** @@ -40,8 +41,11 @@ for (UIManager.LookAndFeelInfo lookAndFeelItem : lookAndFeelArray) { String lookAndFeelString = lookAndFeelItem.getClassName(); - - UIManager.setLookAndFeel(lookAndFeelString); + try{ + UIManager.setLookAndFeel(lookAndFeelString); + } catch (final UnsupportedLookAndFeelException ignored) { + continue; + } // Test getTableCellRendererComponent method by passing null table JTableHeader header = new JTableHeader(); diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/Security/6657138/bug6657138.java --- a/test/jdk/javax/swing/Security/6657138/bug6657138.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/Security/6657138/bug6657138.java Fri Feb 16 12:24:38 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2018, 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 @@ -68,7 +68,11 @@ continue; } String className = laf.getClassName(); - UIManager.setLookAndFeel(className); + try { + UIManager.setLookAndFeel(className); + } catch (final UnsupportedLookAndFeelException ignored) { + continue; + } ComponentUI ui = UIManager.getUI(c); if (ui == null) { throw new RuntimeException("UI is null for " + c); diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/UIDefaults/6302464/bug6302464.java --- a/test/jdk/javax/swing/UIDefaults/6302464/bug6302464.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/UIDefaults/6302464/bug6302464.java Fri Feb 16 12:24:38 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, 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 @@ -33,6 +33,7 @@ import javax.swing.UIManager; import javax.swing.UIDefaults; import javax.swing.UIManager.LookAndFeelInfo; +import javax.swing.UnsupportedLookAndFeelException; import javax.swing.plaf.basic.BasicLookAndFeel; import static java.awt.RenderingHints.KEY_TEXT_ANTIALIASING; import static java.awt.RenderingHints.KEY_TEXT_LCD_CONTRAST; @@ -178,6 +179,7 @@ private static void setLookAndFeel(String lafClass) { try { UIManager.setLookAndFeel(lafClass); + } catch (final UnsupportedLookAndFeelException ignored) { } catch (Exception e) { throw new RuntimeException(e); } diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/UIDefaults/8133926/InternalFrameIcon.java --- a/test/jdk/javax/swing/UIDefaults/8133926/InternalFrameIcon.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/UIDefaults/8133926/InternalFrameIcon.java Fri Feb 16 12:24:38 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2018, 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 @@ -45,9 +45,10 @@ try { UIManager.setLookAndFeel(laf.getClassName()); System.out.println("LookAndFeel: " + laf.getClassName()); - } catch (ClassNotFoundException | InstantiationException | - UnsupportedLookAndFeelException | IllegalAccessException e) { + } catch (ClassNotFoundException | IllegalAccessException | + InstantiationException e) { throw new RuntimeException(e); + } catch (final UnsupportedLookAndFeelException ignored) { } } diff -r 149647adb633 -r 82c1fe23c469 test/jdk/javax/swing/plaf/metal/MetalUtils/bug6190373.java --- a/test/jdk/javax/swing/plaf/metal/MetalUtils/bug6190373.java Fri Feb 16 18:27:35 2018 +0530 +++ b/test/jdk/javax/swing/plaf/metal/MetalUtils/bug6190373.java Fri Feb 16 12:24:38 2018 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2018, 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 @@ -102,8 +102,10 @@ try { UIManager.setLookAndFeel(laf.getClassName()); System.out.println("LookAndFeel: " + laf.getClassName()); + } catch (final UnsupportedLookAndFeelException ignored){ + System.out.println("Unsupported LookAndFeel: " + laf.getClassName()); } catch (ClassNotFoundException | InstantiationException | - UnsupportedLookAndFeelException | IllegalAccessException e) { + IllegalAccessException e) { throw new RuntimeException(e); } }