Path: blob/master/test/jdk/javax/accessibility/4702199/AccessibleExtendedTextTest.java
66644 views
/*1* Copyright (c) 2003, 2022, 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/*24* @test25* @key headful26* @bug 470219927* @summary AccessibleExtendedText and related classes for28* missing accessibility support29* @run main AccessibleExtendedTextTest30*/3132public class AccessibleExtendedTextTest {3334public static void doTest() throws Exception {35try {36Class[] param = { int.class, int.class };37Class accessibleExtendedText =38Class.forName("javax.accessibility.AccessibleExtendedText");39accessibleExtendedText.getDeclaredField("LINE");40accessibleExtendedText.getDeclaredField("ATTRIBUTE_RUN");41accessibleExtendedText.getDeclaredMethod("getTextRange", param);42accessibleExtendedText.getDeclaredMethod("getTextSequenceAt",43param);44accessibleExtendedText.getDeclaredMethod("getTextSequenceAfter",45param);46accessibleExtendedText.getDeclaredMethod("getTextSequenceBefore",47param);48accessibleExtendedText.getDeclaredMethod("getTextBounds", param);49} catch (Exception e) {50throw new Exception(51"Failures in Interface AccessibleExtendedText");52}5354try {55Class accessibleTextSequence =56Class.forName("javax.accessibility.AccessibleTextSequence");57accessibleTextSequence.getDeclaredField("startIndex");58accessibleTextSequence.getDeclaredField("endIndex");59accessibleTextSequence.getDeclaredField("text");60} catch (Exception e) {61throw new Exception(62"Failures in Interface AccessibleTextSequence");63}6465try {66Class accessibleTextAttributeSequence = Class67.forName("javax.accessibility.AccessibleAttributeSequence");68accessibleTextAttributeSequence.getDeclaredField("startIndex");69accessibleTextAttributeSequence.getDeclaredField("endIndex");70accessibleTextAttributeSequence.getDeclaredField("attributes");71} catch (Exception e) {72throw new Exception(73"Failures in Interface AccessibleAttributeSequence");74}7576try {77Class accessibleContext =78Class.forName("javax.accessibility.AccessibleContext");79accessibleContext80.getDeclaredField("ACCESSIBLE_INVALIDATE_CHILDREN");81accessibleContext82.getDeclaredField("ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED");83accessibleContext84.getDeclaredField("ACCESSIBLE_COMPONENT_BOUNDS_CHANGED");85} catch (Exception e) {86throw new Exception(87"Failures in Interface AccessibleContext");88}89System.out.println("Test Passed");90}9192public static void main(String[] args) throws Exception {93doTest();94}95}969798