changeset 48430:d41a61e52a84

8193673: Regression manual Test javax/swing/JFileChooser/6515169/bug6515169.java fails Reviewed-by: erikj, psadhukhan
author serb
date Wed, 10 Jan 2018 07:21:33 -0800
parents 2fe2d312e6ce
children e8e8c9e6ccf8
files make/gensrc/Gensrc-java.desktop.gmk test/jdk/javax/swing/UIManager/8193673/TestProperties.java
diffstat 2 files changed, 108 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/make/gensrc/Gensrc-java.desktop.gmk	Tue Jan 09 10:27:12 2018 +0100
+++ b/make/gensrc/Gensrc-java.desktop.gmk	Wed Jan 10 07:21:33 2018 -0800
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2016, 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
@@ -46,7 +46,6 @@
     $(TOPDIR)/src/java.desktop/share/classes/sun/awt/resources \
     $(TOPDIR)/src/java.desktop/share/classes/com/sun/accessibility/internal/resources \
     $(TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/resources \
-    $(TOPDIR)/src/java.desktop/share/classes/com/sun/java/swing/plaf/windows/resources \
     $(TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/basic/resources \
     $(TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/metal/resources \
     $(TOPDIR)/src/java.desktop/share/classes/com/sun/swing/internal/plaf/synth/resources \
@@ -61,7 +60,10 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  PROP_SRC_DIRS += $(TOPDIR)/src/java.desktop/windows/classes/sun/awt/windows
+  PROP_SRC_DIRS += \
+      $(TOPDIR)/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/resources \
+      $(TOPDIR)/src/java.desktop/windows/classes/sun/awt/windows \
+      #
 endif
 
 ifeq ($(filter $(OPENJDK_TARGET_OS), windows macosx), )
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/UIManager/8193673/TestProperties.java	Wed Jan 10 07:21:33 2018 -0800
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import javax.swing.UIManager;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import javax.swing.plaf.nimbus.NimbusLookAndFeel;
+
+/**
+ * @test
+ * @bug 8193673
+ * @summary The test verifies that l&f specific properties are accessible
+ */
+public final class TestProperties {
+
+    private static final String[] windowsProperties = {
+            "FileChooser.viewMenuButtonToolTipText",
+            "FileChooser.viewMenuButtonAccessibleName",
+    };
+
+    private static final String[] aquaProperties = {
+            "FileChooser.mac.newFolder",
+    };
+
+    private static final String[] gtkProperties = {
+            "FileChooser.renameFileDialogText",
+    };
+
+    private static final String[] motifProperties = {
+            "FileChooser.enterFolderNameLabel.textAndMnemonic",
+    };
+
+    private static final String[] nimbusProperties = {
+            "FileChooser.refreshActionLabelText",
+    };
+
+    private static final String[] metalProperties = {
+            "MetalTitlePane.iconify.titleAndMnemonic",
+    };
+
+    public static void main(final String[] args) throws Exception {
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
+        test(metalProperties);
+
+        UIManager.setLookAndFeel(new NimbusLookAndFeel());
+        test(nimbusProperties);
+
+        UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
+        test(motifProperties);
+
+        try {
+            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
+            test(windowsProperties);
+        } catch (Exception e) {
+            // ignore
+        }
+
+        try {
+            UIManager.setLookAndFeel("com.apple.laf.AquaLookAndFeel");
+            test(aquaProperties);
+        } catch (Exception e) {
+            // ignore
+        }
+
+        try {
+            UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
+            test(gtkProperties);
+        } catch (Exception e) {
+            // ignore
+        }
+    }
+
+    private static void test(final String[] properties) {
+        for (final String name : properties) {
+            String value = UIManager.getString(name);
+            if (value == null) {
+                System.err.println("Current LookAndFeel = "
+                        + UIManager.getLookAndFeel().getDescription());
+                System.err.printf("The value for %s property is null\n", name);
+                throw new Error();
+            }
+        }
+    }
+}