Skip to content

Commit e365b7d

Browse files
committed
8366369: Add @requires linux for GTK L&F tests
Reviewed-by: serb, prr, tr
1 parent 2b28c28 commit e365b7d

File tree

3 files changed

+50
-36
lines changed

3 files changed

+50
-36
lines changed

test/jdk/com/sun/java/swing/plaf/gtk/4928019/bug4928019.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,25 +26,25 @@
2626
* @bug 4928019
2727
* @key headful
2828
* @summary Makes sure all the basic classes can be created with GTK.
29-
* @author Scott Violet
29+
* @requires (os.family != "windows" & os.family != "mac")
30+
* @library /test/lib
31+
* @build jtreg.SkippedException
32+
* @run main bug4928019
3033
*/
3134

3235
import javax.swing.*;
3336
import javax.swing.plaf.basic.*;
3437

38+
import jtreg.SkippedException;
39+
3540
public class bug4928019 {
3641
public static void main(String[] args) throws Throwable {
3742
try {
3843
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
39-
} catch (UnsupportedLookAndFeelException ex) {
40-
System.err.println("GTKLookAndFeel is not supported on this platform." +
41-
" Test is considered passed.");
42-
return;
43-
} catch (ClassNotFoundException ex) {
44-
System.err.println("GTKLookAndFeel class is not found." +
45-
" Test is considered passed.");
46-
return;
44+
} catch (Exception e) {
45+
throw new SkippedException("GTKLookAndFeel isn't supported", e);
4746
}
47+
4848
new JButton() {
4949
public void updateUI() {
5050
setUI(new BasicButtonUI());

test/jdk/com/sun/java/swing/plaf/gtk/Test6635110.java

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -21,18 +21,28 @@
2121
* questions.
2222
*/
2323

24-
/* @test
25-
@bug 6635110
26-
@key headful
27-
@summary GTK icons should not throw NPE when called by non-GTK UI
28-
@author Peter Zhelezniakov
29-
@run main Test6635110
24+
/*
25+
* @test
26+
* @bug 6635110
27+
* @key headful
28+
* @summary GTK icons should not throw NPE when called by non-GTK UI
29+
* @requires (os.family != "windows" & os.family != "mac")
30+
* @library /test/lib
31+
* @build jtreg.SkippedException
32+
* @run main Test6635110
3033
*/
3134

32-
import javax.swing.*;
33-
import java.awt.*;
35+
import java.awt.Component;
3436
import java.awt.image.BufferedImage;
35-
import javax.swing.plaf.basic.*;
37+
38+
import javax.swing.JMenu;
39+
import javax.swing.JToolBar;
40+
import javax.swing.SwingUtilities;
41+
import javax.swing.UIManager;
42+
import javax.swing.plaf.basic.BasicMenuUI;
43+
import javax.swing.plaf.basic.BasicToolBarUI;
44+
45+
import jtreg.SkippedException;
3646

3747

3848
public class Test6635110 implements Runnable {
@@ -53,7 +63,7 @@ public class Test6635110 implements Runnable {
5363
paint(tb);
5464
}
5565

56-
void paint(Component c) {
66+
private void paint(Component c) {
5767
c.setSize(WIDTH, HEIGHT);
5868
c.paint(IMAGE.getGraphics());
5969
}
@@ -62,9 +72,9 @@ public static void main(String[] args) throws Exception {
6272
try {
6373
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
6474
} catch (Exception e) {
65-
System.out.println("GTKLookAndFeel cannot be set, skipping this test");
66-
return;
75+
throw new SkippedException("GTKLookAndFeel isn't supported", e);
6776
}
77+
6878
SwingUtilities.invokeAndWait(new Test6635110());
6979
}
7080
}

test/jdk/com/sun/java/swing/plaf/gtk/Test6963870.java

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2010, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -21,30 +21,36 @@
2121
* questions.
2222
*/
2323

24-
/* @test
25-
@bug 6963870
26-
@key headful
27-
@summary Tests that GTKPainter.ListTableFocusBorder.getBorderInsets()
28-
doesn't return null
29-
@author Peter Zhelezniakov
30-
@run main Test6963870
31-
*/
24+
/*
25+
* @test
26+
* @bug 6963870
27+
* @key headful
28+
* @summary Tests that GTKPainter.ListTableFocusBorder.getBorderInsets()
29+
* doesn't return null
30+
* @requires (os.family != "windows" & os.family != "mac")
31+
* @library /test/lib
32+
* @build jtreg.SkippedException
33+
* @run main Test6963870
34+
*/
3235

3336
import java.awt.Insets;
3437
import javax.swing.SwingUtilities;
3538
import javax.swing.UIManager;
3639
import javax.swing.border.Border;
3740

41+
import jtreg.SkippedException;
42+
3843
public class Test6963870 implements Runnable {
3944

40-
final static String[] UI_NAMES = {
45+
static final String[] UI_NAMES = {
4146
"List.focusCellHighlightBorder",
4247
"List.focusSelectedCellHighlightBorder",
4348
"List.noFocusBorder",
4449
"Table.focusCellHighlightBorder",
4550
"Table.focusSelectedCellHighlightBorder",
4651
};
4752

53+
@Override
4854
public void run() {
4955
for (String uiName: UI_NAMES) {
5056
test(uiName);
@@ -63,11 +69,9 @@ public static void main(String[] args) throws Exception {
6369
try {
6470
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
6571
} catch (Exception e) {
66-
System.out.println("GTKLookAndFeel cannot be set, skipping this test");
67-
return;
72+
throw new SkippedException("GTKLookAndFeel isn't supported", e);
6873
}
6974

7075
SwingUtilities.invokeAndWait(new Test6963870());
7176
}
7277
}
73-

0 commit comments

Comments
 (0)