Skip to content

Commit 563457f

Browse files
committed
8285693: Create an automated test for JDK-4702199
Backport-of: 158d871d0574970c9e5609dd037aaa0ead668a3b
1 parent 32ae0fc commit 563457f

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/*
2+
* Copyright (c) 2003, 2022, 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+
* @key headful
27+
* @bug 4702199
28+
* @summary AccessibleExtendedText and related classes for
29+
* missing accessibility support
30+
* @run main AccessibleExtendedTextTest
31+
*/
32+
33+
public class AccessibleExtendedTextTest {
34+
35+
public static void doTest() throws Exception {
36+
try {
37+
Class[] param = { int.class, int.class };
38+
Class accessibleExtendedText =
39+
Class.forName("javax.accessibility.AccessibleExtendedText");
40+
accessibleExtendedText.getDeclaredField("LINE");
41+
accessibleExtendedText.getDeclaredField("ATTRIBUTE_RUN");
42+
accessibleExtendedText.getDeclaredMethod("getTextRange", param);
43+
accessibleExtendedText.getDeclaredMethod("getTextSequenceAt",
44+
param);
45+
accessibleExtendedText.getDeclaredMethod("getTextSequenceAfter",
46+
param);
47+
accessibleExtendedText.getDeclaredMethod("getTextSequenceBefore",
48+
param);
49+
accessibleExtendedText.getDeclaredMethod("getTextBounds", param);
50+
} catch (Exception e) {
51+
throw new Exception(
52+
"Failures in Interface AccessibleExtendedText");
53+
}
54+
55+
try {
56+
Class accessibleTextSequence =
57+
Class.forName("javax.accessibility.AccessibleTextSequence");
58+
accessibleTextSequence.getDeclaredField("startIndex");
59+
accessibleTextSequence.getDeclaredField("endIndex");
60+
accessibleTextSequence.getDeclaredField("text");
61+
} catch (Exception e) {
62+
throw new Exception(
63+
"Failures in Interface AccessibleTextSequence");
64+
}
65+
66+
try {
67+
Class accessibleTextAttributeSequence = Class
68+
.forName("javax.accessibility.AccessibleAttributeSequence");
69+
accessibleTextAttributeSequence.getDeclaredField("startIndex");
70+
accessibleTextAttributeSequence.getDeclaredField("endIndex");
71+
accessibleTextAttributeSequence.getDeclaredField("attributes");
72+
} catch (Exception e) {
73+
throw new Exception(
74+
"Failures in Interface AccessibleAttributeSequence");
75+
}
76+
77+
try {
78+
Class accessibleContext =
79+
Class.forName("javax.accessibility.AccessibleContext");
80+
accessibleContext
81+
.getDeclaredField("ACCESSIBLE_INVALIDATE_CHILDREN");
82+
accessibleContext
83+
.getDeclaredField("ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED");
84+
accessibleContext
85+
.getDeclaredField("ACCESSIBLE_COMPONENT_BOUNDS_CHANGED");
86+
} catch (Exception e) {
87+
throw new Exception(
88+
"Failures in Interface AccessibleContext");
89+
}
90+
System.out.println("Test Passed");
91+
}
92+
93+
public static void main(String[] args) throws Exception {
94+
doTest();
95+
}
96+
}

0 commit comments

Comments
 (0)