Path: blob/master/test/jdk/java/awt/FileDialog/8017487/bug8017487.java
41153 views
/*1* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/* @test24@key headful25@bug 8017487 816798826@summary filechooser in Windows-Libraries folder: columns are mixed up27@author Semyon Sadetsky28@modules java.desktop/sun.awt.shell29@library /test/lib30@build jdk.test.lib.OSVersion jdk.test.lib.Platform31@run main bug801748732*/333435import jdk.test.lib.Platform;36import jdk.test.lib.OSVersion;3738import sun.awt.shell.ShellFolder;39import sun.awt.shell.ShellFolderColumnInfo;40import javax.swing.filechooser.FileSystemView;41import java.io.File;4243public class bug801748744{45public static void main(String[] p_args) throws Exception {46if (Platform.isWindows() &&47OSVersion.current().compareTo(OSVersion.WINDOWS_VISTA) > 0 ) {48test();49System.out.println("ok");50}51}5253private static void test() throws Exception {54FileSystemView fsv = FileSystemView.getFileSystemView();55File def = new File(fsv.getDefaultDirectory().getAbsolutePath());56ShellFolderColumnInfo[] defColumns =57ShellFolder.getShellFolder(def).getFolderColumns();5859File[] files = fsv.getHomeDirectory().listFiles();60for (File file : files) {61if( "Libraries".equals(ShellFolder.getShellFolder( file ).getDisplayName())) {62File[] libs = file.listFiles();63for (File lib : libs) {64ShellFolder libFolder =65ShellFolder.getShellFolder(lib);66if( "Library".equals(libFolder.getFolderType() ) ) {67ShellFolderColumnInfo[] folderColumns =68libFolder.getFolderColumns();6970for (int i = 0; i < defColumns.length; i++) {71if (!defColumns[i].getTitle()72.equals(folderColumns[i].getTitle()))73throw new RuntimeException("Columnn " +74folderColumns[i].getTitle() +75" doesn't match " +76defColumns[i].getTitle());77}78}79}80}81}82}8384}858687