21
21
* questions.
22
22
*/
23
23
24
- /*
24
+ /*
25
25
* @test
26
- * @bug 8226783
26
+ * @bug 8226783 8247753
27
27
* @key headful
28
28
* @summary Verify System L&F
29
29
*/
@@ -52,23 +52,26 @@ public static void main(String[] args) {
52
52
} else if (os .contains ("macos" )) {
53
53
expLAF = "com.apple.laf.AquaLookAndFeel" ;
54
54
} else if (os .contains ("linux" )) {
55
- /*
56
- * The implementation keys off the following desktop setting to
57
- * decide if GTK is an appropriate system L&F.
58
- * In its absence, there probably isn't support for the GTK L&F
59
- * anyway. It does not tell us if the GTK libraries are available
60
- * but they really should be if this is a gnome session.
61
- * If it proves necessary the test can perhaps be updated to see
62
- * if the GTK LAF is listed as installed and can be instantiated.
63
- */
64
- String gnome = System .getenv ("GNOME_DESKTOP_SESSION_ID" );
65
- System .out .println ("Gnome desktop session ID is " + gnome );
66
- if (gnome != null ) {
67
- expLAF = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" ;
68
- } else if (os .contains ("linux" )) {
69
- expLAF = "javax.swing.plaf.metal.MetalLookAndFeel" ;
70
- }
71
- }
55
+ /*
56
+ * The implementation keys off the following desktop setting to
57
+ * decide if GTK is an appropriate system L&F.
58
+ * In its absence, there probably isn't support for the GTK L&F
59
+ * anyway. It does not tell us if the GTK libraries are available
60
+ * but they really should be if this is a gnome session.
61
+ * If it proves necessary the test can perhaps be updated to see
62
+ * if the GTK LAF is listed as installed and can be instantiated.
63
+ */
64
+ String gnome = System .getenv ("GNOME_DESKTOP_SESSION_ID" );
65
+ String desktop = System .getenv ("XDG_CURRENT_DESKTOP" );
66
+ System .out .println ("Gnome desktop session ID is " + gnome );
67
+ System .out .println ("XDG_CURRENT_DESKTOP is set to " + desktop );
68
+ if (gnome != null ||
69
+ (desktop != null && desktop .toLowerCase ().contains ("gnome" ))) {
70
+ expLAF = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" ;
71
+ } else {
72
+ expLAF = "javax.swing.plaf.metal.MetalLookAndFeel" ;
73
+ }
74
+ }
72
75
System .out .println ("Expected System LAF is " + expLAF );
73
76
if (expLAF == null ) {
74
77
System .out .println ("No match for expected LAF, unknown OS ?" );
@@ -77,5 +80,5 @@ public static void main(String[] args) {
77
80
if (!(laf .equals (expLAF ))) {
78
81
throw new RuntimeException ("LAF not as expected" );
79
82
}
80
- }
83
+ }
81
84
}
0 commit comments