8196196: Headful tests should not be run in headless mode

Reviewed-by: prr
This commit is contained in:
Sergey Bylokhov 2018-02-16 12:24:38 -08:00
parent 3715cbe450
commit 7578044e71
24 changed files with 89 additions and 30 deletions
test/jdk
java/awt
Color
FileDialog
Gtk/GtkVersionTest
JAWT
Toolkit
BadDisplayTest
DesktopProperties
TrayIcon/SystemTrayInstance
dnd/BadSerializaionTest
print/PrinterJob
javax
accessibility/AccessibilityProvider
swing
ClientProperty/UIClientPropertyKeyTest
GroupLayout/7071166
JComboBox
JFileChooser
JFrame/Serialization
JLayer/8041982
JTableHeader/8020039
Security/6657138
UIDefaults
plaf/metal/MetalUtils

@ -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.

@ -27,6 +27,7 @@ import java.util.concurrent.TimeUnit;
/**
* @test
* @key headful
* @bug 8177758
* @requires os.family == "windows"
* @summary Regression in java.awt.FileDialog

@ -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

@ -22,6 +22,7 @@
*/
/* @test
* @key headful
* @bug 8156121
* @summary "Fail forward" fails for GTK3 if no GTK2 available
* @modules java.desktop/sun.awt

@ -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 @@ case "$OS" in
else
ARCH="i386"
fi
SYST="cygwin"
SYST="cygwin"
MAKE="make"
;;
Darwin )

@ -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) {

@ -28,6 +28,7 @@ import java.io.InputStream;
/*
* @test
* @key headful
* @bug 4758438
* @summary Testcase to check the implementation of RFE 4758438
* The RFE suggests that the GNOME desktop properties

@ -25,6 +25,7 @@ import java.awt.*;
/*
* @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

@ -23,6 +23,7 @@
/**
* @test
* @key headful
* @bug 8030050
* @summary Validate fields on DnD class deserialization
* @author petr.pchelko@oracle.com

@ -23,7 +23,7 @@
/**
* @test
* @key printer
* @key printer headful
* @bug 8163889
* @summary Printing crashes on OSX.
* @run main PrintCrashTest

@ -21,6 +21,7 @@
# questions.
#
# @test
# @key headful
# @bug 8055160
# @summary Unit test for javax.accessibility.AccessibilitySPI
#

@ -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 @@ public final class UIClientPropertyKeyTest {
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);
}
}

@ -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 class bug7071166 {
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() {

@ -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 @@ public class bug6632953 {
: UIManager.getInstalledLookAndFeels()) {
try {
UIManager.setLookAndFeel(lafInfo.getClassName());
} catch (UnsupportedLookAndFeelException ignored) {
continue;
} catch (Exception e) {
throw new RuntimeException(e);
}

@ -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 class bug7082443 {
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() {

@ -22,6 +22,7 @@
*/
/* @test
* @key headful
* @bug 6489130
* @summary FileChooserDemo hung by keeping pressing Enter key
* @author Pavel Porvatov

@ -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 java.util.Locale;
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 @@ public class bug8080628 {
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) {

@ -23,6 +23,7 @@
/**
* @test
* @key headful
* @bug 8189201
* @summary [macosx] NotSerializableException during JFrame with MenuBar
* serialization

@ -22,6 +22,7 @@
*/
/* @test
* @key headful
* @bug 8041982
* @summary Use of animated icon in JLayer causes CPU spin
* @author Alexander Potochkin

@ -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 @@ public class TableHeaderRendererExceptionTest {
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();

@ -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 @@ public class bug6657138 implements Runnable {
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);

@ -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.SwingUtilities;
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 @@ public class bug6302464 {
private static void setLookAndFeel(String lafClass) {
try {
UIManager.setLookAndFeel(lafClass);
} catch (final UnsupportedLookAndFeelException ignored) {
} catch (Exception e) {
throw new RuntimeException(e);
}

@ -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 @@ public final class InternalFrameIcon implements Runnable {
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) {
}
}

@ -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 @@ public final class bug6190373 {
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);
}
}