|
1 /* |
|
2 * Copyright (c) 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 * have any questions. |
|
22 */ |
|
23 |
|
24 /* |
|
25 * @test |
|
26 * @bug 6842557 |
|
27 * @summary confirm that an instance which is created with new Enum ranges is |
|
28 * equivalent to another instance which is created with equivalent traditional |
|
29 * ranges or the same Enum ranges. |
|
30 */ |
|
31 |
|
32 import java.awt.font.NumericShaper; |
|
33 import java.util.EnumSet; |
|
34 import static java.awt.font.NumericShaper.*; |
|
35 |
|
36 public class EqualsTest { |
|
37 public static void main(String[] args) { |
|
38 NumericShaper ns1 = getContextualShaper(ARABIC | TAMIL, TAMIL); |
|
39 NumericShaper ns2 = getContextualShaper( |
|
40 EnumSet.of(Range.ARABIC, Range.TAMIL), |
|
41 Range.TAMIL); |
|
42 NumericShaper ns3 = getContextualShaper( |
|
43 EnumSet.of(Range.ARABIC, Range.TAMIL), |
|
44 Range.TAMIL); |
|
45 NumericShaper ns4 = getContextualShaper( |
|
46 EnumSet.of(Range.ARABIC, Range.TAMIL), |
|
47 Range.ARABIC); |
|
48 |
|
49 if (!ns1.equals(ns2)) { |
|
50 throw new RuntimeException("ns1 != ns2: ns1=" + ns1 + ", ns2=" + ns2); |
|
51 } |
|
52 if (!ns2.equals(ns1)) { |
|
53 throw new RuntimeException("ns2 != ns1: ns1=" + ns1 + ", ns2=" + ns2); |
|
54 } |
|
55 if (!ns2.equals(ns3)) { |
|
56 throw new RuntimeException("ns2 != ns3: ns2=" + ns2 + ", ns3=" + ns3); |
|
57 } |
|
58 if (ns1.equals(ns4)) { |
|
59 throw new RuntimeException("ns1 == ns4: ns1=" + ns1 + ", ns4=" + ns4); |
|
60 } |
|
61 if (ns2.equals(ns4)) { |
|
62 throw new RuntimeException("ns2 == ns4: ns2=" + ns2 + ", ns4=" + ns4); |
|
63 } |
|
64 } |
|
65 } |