Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/java/awt/FileDialog/8017487/bug8017487.java
41153 views
1
/*
2
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/* @test
25
@key headful
26
@bug 8017487 8167988
27
@summary filechooser in Windows-Libraries folder: columns are mixed up
28
@author Semyon Sadetsky
29
@modules java.desktop/sun.awt.shell
30
@library /test/lib
31
@build jdk.test.lib.OSVersion jdk.test.lib.Platform
32
@run main bug8017487
33
*/
34
35
36
import jdk.test.lib.Platform;
37
import jdk.test.lib.OSVersion;
38
39
import sun.awt.shell.ShellFolder;
40
import sun.awt.shell.ShellFolderColumnInfo;
41
import javax.swing.filechooser.FileSystemView;
42
import java.io.File;
43
44
public class bug8017487
45
{
46
public static void main(String[] p_args) throws Exception {
47
if (Platform.isWindows() &&
48
OSVersion.current().compareTo(OSVersion.WINDOWS_VISTA) > 0 ) {
49
test();
50
System.out.println("ok");
51
}
52
}
53
54
private static void test() throws Exception {
55
FileSystemView fsv = FileSystemView.getFileSystemView();
56
File def = new File(fsv.getDefaultDirectory().getAbsolutePath());
57
ShellFolderColumnInfo[] defColumns =
58
ShellFolder.getShellFolder(def).getFolderColumns();
59
60
File[] files = fsv.getHomeDirectory().listFiles();
61
for (File file : files) {
62
if( "Libraries".equals(ShellFolder.getShellFolder( file ).getDisplayName())) {
63
File[] libs = file.listFiles();
64
for (File lib : libs) {
65
ShellFolder libFolder =
66
ShellFolder.getShellFolder(lib);
67
if( "Library".equals(libFolder.getFolderType() ) ) {
68
ShellFolderColumnInfo[] folderColumns =
69
libFolder.getFolderColumns();
70
71
for (int i = 0; i < defColumns.length; i++) {
72
if (!defColumns[i].getTitle()
73
.equals(folderColumns[i].getTitle()))
74
throw new RuntimeException("Columnn " +
75
folderColumns[i].getTitle() +
76
" doesn't match " +
77
defColumns[i].getTitle());
78
}
79
}
80
}
81
}
82
}
83
}
84
85
}
86
87