|
| 1 | +/* |
| 2 | + * Copyright (c) 2026, 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 | +import javax.swing.JToggleButton; |
| 25 | +import javax.swing.JFrame; |
| 26 | + |
| 27 | +/* |
| 28 | + * @test |
| 29 | + * @key headful |
| 30 | + * @bug 8379347 |
| 31 | + * @summary manual test for VoiceOver reading JToggleButtons correctly |
| 32 | + * @requires os.family == "mac" |
| 33 | + * @library /java/awt/regtesthelpers |
| 34 | + * @build PassFailJFrame |
| 35 | + * @run main/manual VoiceOverToggleButtonRole |
| 36 | + */ |
| 37 | + |
| 38 | +public class VoiceOverToggleButtonRole { |
| 39 | + public static void main(String[] args) throws Exception { |
| 40 | + String INSTRUCTIONS = """ |
| 41 | + INSTRUCTIONS (Mac-only): |
| 42 | + 1. Open VoiceOver |
| 43 | + 2. Move the VoiceOver cursor over the JToggleButton. |
| 44 | + 3. Observe how VoiceOver identifies the toggle button. |
| 45 | +
|
| 46 | + Expected behavior: VoiceOver should identify it as a |
| 47 | + "toggle button" initially. (VO does still say "to select |
| 48 | + or deselect this checkbox", though.) |
| 49 | +
|
| 50 | + If you select the link using "Accessibility Inspector": |
| 51 | + it should identify its subrole as AXToggle. |
| 52 | + """; |
| 53 | + |
| 54 | + PassFailJFrame.builder() |
| 55 | + .title("VoiceOverToggleButtonRole Instruction") |
| 56 | + .instructions(INSTRUCTIONS) |
| 57 | + .columns(40) |
| 58 | + .testUI(VoiceOverToggleButtonRole::createUI) |
| 59 | + .build() |
| 60 | + .awaitAndCheck(); |
| 61 | + } |
| 62 | + |
| 63 | + private static JFrame createUI() { |
| 64 | + JFrame frame = new JFrame(); |
| 65 | + frame.getContentPane().add(new JToggleButton("JToggleButton")); |
| 66 | + frame.pack(); |
| 67 | + return frame; |
| 68 | + } |
| 69 | +} |
0 commit comments