/* * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, JetBrains s.r.o.. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/
/* * @test * @bug 8281338 * @summary Test for an element that has more than one Accessibility Action * @author Artem.Semenov@jetbrains.com * @run main/manual AccessibleActionsTest * @requires (os.family == "mac")
*/
@Override public CountDownLatch createCountDownLatch() { returnnew CountDownLatch(1);
}
void createTest() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y actions.\n\n"
+ "Turn screen reader on, and Tab to the label.\n\n"
+ "Perform the VO action \"Press\" (VO+space)\n"
+ "Perform the VO action \"Show menu\" (VO+Shift+m)\n\n"
+ "If after the first action the text of the label has changed, and after the second action the menu appears tab further and press PASS, otherwise press FAIL.";
exceptionString = "AccessibleAction test failed!"; super.createUI(new AccessibleActionsTestFrame(), "AccessibleActionsTest");
}
void createTree() {
INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y actions.\n\n"
+ "Turn screen reader on, and Tab to the label.\n\n"
+ "Perform the VO action \"Press\" (VO+space) on tree nodes\n\n"
+ "If after press the tree node is expanded tab further and press PASS, otherwise press FAIL.";
Hashtable<String, String[]> data = new Hashtable<String, String[]>(); for (int i = 0; i < nodes.length; i++) {
data.put(nodes[i], leafs[i]);
}
JTree tree = new JTree(data);
tree.setRootVisible(true);
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
JScrollPane scrollPane = new JScrollPane(tree);
panel.add(scrollPane);
panel.setFocusable(false);
exceptionString = "AccessibleAction test failed!"; super.createUI(panel, "AccessibleActionsTest");
}
privatevoid createEditableTextArea() {
AccessibleComponentTest.INSTRUCTIONS = "INSTRUCTIONS:\n"
+ "Check a11y show context menu in editable JTextArea.\n\n"
+ "Turn screen reader on and press Tab to move to the text area\n"
+ "Perform the VO action \"Open a shortcut menu\" (VO+Shift+m)\n\n"
+ "If the menu appears tab further and press PASS, otherwise press FAIL.";
JTextArea textArea = new MyTextArea("some text to edit");
JLabel label = new JLabel(textArea.getText().length() + " chars");
label.setLabelFor(textArea);
textArea.setEditable(true);
textArea.addKeyListener(new KeyAdapter() {
@Override publicvoid keyReleased(KeyEvent e) {
label.setText(String.valueOf(textArea.getText().length()) + " chars");
}
});
JPanel panel = new JPanel();
panel.setLayout(new FlowLayout());
panel.add(textArea);
panel.add(label);
exceptionString = "Editable text area test failed!"; super.createUI(panel, "AccessibleTextTest");
}
publicstaticvoid main(String[] args) throws Exception {
AccessibleActionsTest test = new AccessibleActionsTest();
public AccessibleActionsTestFrame() {
MyLabel label = new MyLabel("I'm waiting for the push");
label.setComponentPopupMenu(createPopup());
label.setFocusable(true);
add(label);
setLayout(new FlowLayout());
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.