Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/sun/util/resources/TimeZone/Bug6377794.java
41155 views
1
/*
2
* Copyright (c) 2007, 2016, 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
/*
25
* @test
26
* @bug 6377794
27
* @modules jdk.localedata
28
* @summary Test case for tzdata2005r support for 9 locales
29
* @run main/othervm -Djava.locale.providers=JRE,SPI Bug6377794
30
*/
31
32
import java.util.Locale;
33
import java.util.TimeZone;
34
35
public class Bug6377794 {
36
static Locale[] locales2Test = new Locale[] {
37
new Locale("en"),
38
new Locale("de"),
39
new Locale("es"),
40
new Locale("fr"),
41
new Locale("it"),
42
new Locale("ja"),
43
new Locale("ko"),
44
new Locale("sv"),
45
new Locale("zh","CN"),
46
new Locale("zh","TW")
47
};
48
49
public static void main(String[] args) {
50
TimeZone SystemVYST9 = TimeZone.getTimeZone("SystemV/YST9");
51
Locale tzLocale;
52
for (int i = 0; i < locales2Test.length; i++) {
53
tzLocale = locales2Test[i];
54
if (!SystemVYST9.getDisplayName(false, TimeZone.SHORT, tzLocale).equals
55
("AKST"))
56
throw new RuntimeException("\n" + tzLocale + ": SHORT, " +
57
"non-daylight saving name for " +
58
"SystemV/YST9 should be \"AKST\"");
59
}
60
61
/*
62
* For "SystemV/PST8", testing TimeZone.SHORT would return the same value
63
* before and after the fix. Therefore, the regression test was changed to test
64
* TimeZone.LONG instead.
65
*/
66
67
TimeZone SystemVPST8 = TimeZone.getTimeZone("SystemV/PST8");
68
tzLocale = locales2Test[0];
69
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
70
("Pacific Standard Time"))
71
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
72
"non-daylight saving name for " +
73
"SystemV/PST8 should be " +
74
"\"Pacific Standard Time\"");
75
tzLocale = locales2Test[1];
76
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
77
("Pazifische Normalzeit"))
78
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
79
"non-daylight saving name for " +
80
"SystemV/PST8 should be " +
81
"\"Pazifische Normalzeit\"");
82
tzLocale = locales2Test[2];
83
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
84
("Hora est\u00e1ndar del Pac\u00edfico"))
85
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
86
"non-daylight saving name for " +
87
"SystemV/PST8 should be " +
88
"\"Hora est\u00e1ndar del Pac\u00edfico\"");
89
tzLocale = locales2Test[3];
90
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
91
("Heure normale du Pacifique"))
92
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
93
"non-daylight saving name for " +
94
"SystemV/PST8 should be " +
95
"\"Heure normale du Pacifique\"");
96
tzLocale = locales2Test[4];
97
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
98
("Ora solare della costa occidentale USA"))
99
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
100
"non-daylight saving name for " +
101
"SystemV/PST8 should be " +
102
"\"Ora solare della costa occidentale USA\"");
103
tzLocale = locales2Test[5];
104
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
105
("\u592a\u5e73\u6d0b\u6a19\u6e96\u6642"))
106
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
107
"non-daylight saving name for " +
108
"SystemV/PST8 should be " +
109
"\"\u592a\u5e73\u6d0b\u6a19\u6e96\u6642\"");
110
tzLocale = locales2Test[6];
111
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
112
("\ud0dc\ud3c9\uc591 \ud45c\uc900\uc2dc"))
113
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
114
"non-daylight saving name for " +
115
"SystemV/PST8 should be " +
116
"\"\ud0dc\ud3c9\uc591 \ud45c\uc900\uc2dc\"");
117
tzLocale = locales2Test[7];
118
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
119
("Stilla havet, normaltid"))
120
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
121
"non-daylight saving name for " +
122
"SystemV/PST8 should be " +
123
"\"Stilla havet, normaltid\"");
124
tzLocale = locales2Test[8];
125
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
126
("\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4"))
127
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
128
"non-daylight saving name for " +
129
"SystemV/PST8 should be " +
130
"\"\u592a\u5e73\u6d0b\u6807\u51c6\u65f6\u95f4\"");
131
tzLocale = locales2Test[9];
132
if (!SystemVPST8.getDisplayName(false, TimeZone.LONG, tzLocale).equals
133
("\u592a\u5e73\u6d0b\u6a19\u6e96\u6642\u9593"))
134
throw new RuntimeException("\n" + tzLocale + ": LONG, " +
135
"non-daylight saving name for " +
136
"SystemV/PST8 should be " +
137
"\"\u592a\u5e73\u6d0b\u6a19\u6e96\u6642\u9593\"");
138
}
139
}
140
141