Path: blob/master/test/jdk/javax/accessibility/AccessibleBundle/Basic.java
41149 views
/*1* Copyright (c) 2019, 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*/2223import java.util.Locale;2425import javax.accessibility.AccessibleBundle;2627import static javax.accessibility.AccessibleRole.ALERT;28import static javax.accessibility.AccessibleRole.LABEL;29import static javax.accessibility.AccessibleRole.PANEL;30import static javax.accessibility.AccessibleState.MANAGES_DESCENDANTS;3132/**33* @test34* @bug 821351635* @summary Checks basic functionality of AccessibleBundle class36*/37public final class Basic extends AccessibleBundle {3839private Basic(final String key) {40this.key = key;41}4243public static void main(final String[] args) {44testStandardResource();45testCustomResource();46}4748private static void testCustomResource() {49final Basic bundle = new Basic("managesDescendants");50test(bundle.toDisplayString(Locale.ENGLISH), "manages descendants");51test(bundle.toDisplayString("NonExistedBundle", Locale.ENGLISH),52"managesDescendants");53}5455private static void testStandardResource() {56test(ALERT.toDisplayString(Locale.ENGLISH), "alert");57test(ALERT.toDisplayString(Locale.JAPAN), "\u30a2\u30e9\u30fc\u30c8");58test(LABEL.toDisplayString(Locale.ENGLISH), "label");59test(LABEL.toDisplayString(Locale.JAPAN), "\u30e9\u30d9\u30eb");60test(PANEL.toDisplayString(Locale.ENGLISH), "panel");61test(PANEL.toDisplayString(Locale.JAPAN), "\u30D1\u30CD\u30EB");62test(MANAGES_DESCENDANTS.toDisplayString(Locale.ENGLISH),63"manages descendants");64test(MANAGES_DESCENDANTS.toDisplayString(Locale.JAPAN),65"\u5B50\u5B6B\u3092\u7BA1\u7406");66}6768private static void test(final String actual, final String expected) {69if (!actual.equals(expected)) {70System.err.println("Expected: " + expected);71System.err.println("Actual: " + actual);72throw new RuntimeException("Wrong text");73}74}75}767778