8196196: Headful tests should not be run in headless mode

Reviewed-by: sgehwolf
Backport-of: 7578044e7107c1914d85894cef5eb712c223252a
This commit is contained in:
Leslie Zhai 2022-12-14 10:05:07 +00:00 committed by Severin Gehwolf
parent c7599bd217
commit 537ff94225
14 changed files with 65 additions and 19 deletions

View File

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

View File

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

View File

@ -22,6 +22,7 @@
# questions.
# @test JAWT.sh
# @key headful
# @bug 7190587
# @summary Tests Java AWT native interface library
# @author kshefov
@ -107,7 +108,7 @@ case "$OS" in
else
ARCH="i386"
fi
SYST="cygwin"
SYST="cygwin"
MAKE="make"
;;
Darwin )

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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);
}

View File

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

View File

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

View File

@ -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;
@ -76,7 +77,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) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 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
@ -67,7 +67,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);

View File

@ -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);
}
}