8279641: Create manual JTReg tests for Swing accessibility

Reviewed-by: serb, prr
This commit is contained in:
Alexandre Iline 2022-01-19 21:02:08 +00:00
parent dac15efc1b
commit 5523ddebd5
35 changed files with 1410 additions and 0 deletions

@ -0,0 +1,80 @@
<!--
Copyright (c) 2022, Oracle and/or its affiliates. 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.
-->
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:5%;">S.No</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:25%;">Test</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:75%;">Scenario</th>
</tr>
<tr>
<td>1</td>
<td>Button Demo</td>
<td>
<ol>
<li> Tab until the Button Demo icon <img src="./resource/rbtn.png"> has focus. Press 'space' to
choose.<br>
<li> Tab until the "Button Demo" tab has focus. Press 'space'. Press 'tab'.<br>
<li> Use the arrow keys to navigate between "Buttons", "Radio Buttons", and "Check Boxes".<br>
<li> Tab to enter the demo pane. Tab & Shift-Tab to move between each button.<br>
<li> Press 'space' to trigger (i.e. "press") a button.<br>
<li> Repeat steps 1 through 5 for the <b>Radio Button</b> & <b>Check Boxes</b> tabs.<br>
</ol>
</td>
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3"><b>Expected Result</b></td>
</tr>
<tr>
<td style="Width:100%;" colspan="3">
<ol>
<li>Verify that as you navigate, the focus is shown, e.g.</li>
<img src="./resource/btn.png">
<li>As you press 'space' to trigger each button, verify that you see each button visually depress.
e.g.:
</li>
<img src="./resource/dep.png">
</ol>
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3"><b>Note: actual component appearence may vary depending on look and
feel.</b></td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,28 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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
@key headful
@summary manual test for accessibility button demo
@run main/manual SwingSetTest ButtonDemo
*/

@ -0,0 +1,75 @@
<!--
Copyright (c) 2022, Oracle and/or its affiliates. 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.
-->
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:5%;">S.No</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:25%;">Test</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:75%;">Scenario</th>
</tr>
<tr>
<td>1</td>
<td>ComboBox Demo</td>
<td>
<ol>
<li> Tab until ComboBox icon<img src="./resource/cmb.png"> has focus. Press 'Space' to choose.</li>
<li>Tab until the "ComboBox Demo" tab has focus. Press 'space'. Press 'tab'.</li>
<li> Use Tab and Shift-Tab to move between the four ComboBox widgets.
<li>Use the space and down arrow keys to bring up the drop-down list.</li>
<li> Use the up and down arrows to navigate up and down the list.</li>
<li>Use the 'space' key to make a the selection.</li>
<li> Repeat 4,5 but hit Esc key to cancel the drop-down.</li>
</ol>
</td>
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3"><b>Expected Result</b></td>
</tr>
<tr>
<td style="Width:100%;" colspan="3">
<ol>
<li>Verify that space and down arrow bring up the drop-down list.</li>
<img src="./resource/list.png">
<li>Verify that up and down arrows move up and down the list.</li>
<li>Verify that 'space' makes the selection (the drop-down list should collapse).</li>
</ol>
</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,28 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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
@key headful
@summary manual test for accessibility button demo
@run main/manual SwingSetTest ComboBoxDemo
*/

@ -0,0 +1,66 @@
<!--
Copyright (c) 2022, Oracle and/or its affiliates. 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.
-->
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:5%;">S.No</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:25%;">Test</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:75%;">Scenario</th>
</tr>
<tr>
<td>1</td>
<td>Demo Selection</td>
<td>Move between demos with 'tab' and 'shift-tab', and left and right arrows. Type 'space' to activate a demo.
<img src="./resource/dms.png">
</td>
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3"><b>Expected Result</b></td>
</tr>
<tr>
<td style="Width:100%;" colspan="3">
Verify that there is visible focus as you tab (or arrow) between demo icons. Typing 'space' should change
the selected demo.
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3"><b>Note: actual component appearence may vary depending on look and
feel.</b></td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,28 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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
@key headful
@summary manual test for accessibility button demo
@run main/manual SwingSetTest DemoSelection
*/

@ -0,0 +1,78 @@
<!--
Copyright (c) 2022, Oracle and/or its affiliates. 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.
-->
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:5%;">S.No</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:25%;">Test</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:75%;">Scenario</th>
</tr>
<tr>
<td>1</td>
<td>OptionPane Demo</td>
<td>
<ol>
<li>Tab until the OptionPane icon <img src="./resource/op.png">has focus. Press 'space' to choose.
<li>Tab until the "OptionPane Demo" tab has focus. Press 'space'. Press 'tab'. The 'Show Input Dialog'
button should have focus.
<li>Press 'space'. An Input dialog should pop up. Type some text, and hit return. The dialog should
change to a Message dialog with text saying "That was a pretty good movie!" Press return.
<li>Bring up the dialog again (space). Press 'esc' and confirm that the dialog goes away without the
Message from above.
<li>Press Tab to move down through the buttons, and select "Component Dialog Example" (press space). A
dialog should appear. Tab to ensure that you can navigate through all the components:<br>
a. Textfield<br>
b. ComboBox<br>
c. All 4 buttons: "Cancel", "Probably", "Maybe", "No", "Yes".<br>
d. Press 'esc' to cancel the dialog.<br>
</ol>
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3">
<b>Expected Result</b>
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3">
When a popup window is created, focus must be on the popup window; when the window is closed, focus must
return to the previous focus point.
</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,29 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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
@key headful
@summary manual test for accessibility button demo
@run main/manual SwingSetTest OptionPaneDemo
*/

@ -0,0 +1,79 @@
<!--
Copyright (c) 2022, Oracle and/or its affiliates. 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.
-->
# Manual javax.accessibility test suite
## Configure environment
### Swing Set 2
Prepare an appropriate version of Swing Set 2 from JDK demos.
### Acessibility frameworks
Testing can be performed without an accessibility framework or with one of these frameworks:
1. Windows
1. JAWS
2. NVDA
2. Mac OS X
1. Voice over
## Executing a test run
* Start the required accessibility framework, if necessary
* Swing Set 2 jar default location is
<code>&lt;tested jdk&gt;/demo/jfc/SwingSet2/SwingSet2.jar</code>
* To override Swing Set 2 jar use <code>SWINGSET2_JAR</code> environment variable:
jtreg ... -e:SWINGSET2_JAR=<file location> -m .../javax/accessibility/manual/...
## Performing tests
When a test a started, a UI appears consisting of two frames: test framework frame and Swing Set 2 frame. Test framework
frame will contain a name of the test in the title and detailed instructions.
1. Follow the test instructions
2. If everything goes as expected
1. Push "Pass"
2. UI for this test closes
3. If something goes not accordding to the instructions:
1. Push "Fail"
2. A screenshot is taken automatically
3. Describe the problem
4. Retake the screenshot, if necessary
1. Interract with the Swing Set 2 UI to make it showing the failure. Hit "Retake screenshot"
2. If to demonstrate the failure the UI need to be in a state which prevents using test framework UI, such as model dialogs need to be opened or menu expanded
1. Enter delay (in seconds)
2. Push "Retake screenshot"
3. Prepare the UI
4. Wait for the screenshot to be retaken
5. Push "Fail" button again
6. Screenshot and the description are saved for further analysis
7. Test UI closes
**Wasning: Do not close any window directly, all windows will be closed once the test is finished as passed or failed.**
**Note: Keyboard navigation is supported throughout the test framework UI.**

@ -0,0 +1,59 @@
/**
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
import lib.ManualTestFrame;
import lib.TestResult;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.util.function.Supplier;
import static java.io.File.separator;
public class SwingSetTest {
public static void main(String[] args) throws IOException, InterruptedException,
ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
System.out.println("test image " + System.getenv("TEST_IMAGE_DIR"));
Supplier<TestResult> resultSupplier = ManualTestFrame.showUI(args[0],
"Wait for SwingSet2 to load, follow the instructions, select pass or fail. " +
"Do not close windows manually.",
SwingSetTest.class.getResource(args[0] + ".html"));
String swingSetJar = System.getenv("SWINGSET2_JAR");
if (swingSetJar == null) {
swingSetJar = "file://" + System.getProperty("java.home") +
separator + "demo" +
separator + "jfc" +
separator + "SwingSet2" +
separator + "SwingSet2.jar";
}
System.out.println("Loading SwingSet2 from " + swingSetJar);
ClassLoader ss = new URLClassLoader(new URL[]{new URL(swingSetJar)});
ss.loadClass("SwingSet2").getMethod("main", String[].class).invoke(null, (Object)new String[0]);
//this will block until user decision to pass or fail the test
TestResult result = resultSupplier.get();
if (result != null) {
System.err.println("Failure reason: \n" + result.getFailureDescription());
if (result.getScreenCapture() != null) {
File screenDump = new File(System.getProperty("test.classes") + separator + args[0] + ".png");
System.err.println("Saving screen image to " + screenDump.getAbsolutePath());
ImageIO.write(result.getScreenCapture(), "png", screenDump);
}
Throwable e = result.getException();
if (e != null) {
throw new RuntimeException(e);
} else {
if (!result.getStatus()) throw new RuntimeException("Test failed!");
}
} else {
throw new RuntimeException("No result returned!");
}
}
}

@ -0,0 +1,81 @@
<!--
Copyright (c) 2022, Oracle and/or its affiliates. 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.
-->
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:5%;">S.No</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:25%;">Test</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:75%;">Scenario</th>
</tr>
<tr>
<td>1</td>
<td>Table Demo (tests table navigation, as well as textfield input)</td>
<td>
<ol>
<li>Tab until the Table icon <img src="./resource/tbld.png"> has focus. Press 'space' to choose.
<li>Tab until the "Table Demo" tab has focus. Press 'space'. Press 'tab'. "Reordering allowed" should
have focus.
<li>Tab to the Printing/Header textfield. Verify that you can type in some text.
<li>Continue tabbing until focus moves to the table. The table should show focus.
<li>Press the down arrow. "Mike Albers" should have focus.
<li>Use the right and left arrow keys to navigate between cells.
<li>Set focus to a text cell (e.g. someone's first name). Press space to edit. Type some text. Hit
'enter' and verify the text has been changed. After editing a text cell and hitting 'enter', the
focus could remain on the current cell or go to the next line.
<li>Press the 'Page Up' and 'Page Down' keys (if available on your keyboard); verify that the Table
scrolls up and down, page by page.
<ol><br>
<img src="./resource/tbl.png">
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3">
<b>Expected Result</b>
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3">
See above test description.
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3"><b>Note: actual component appearence may vary depending on look and
feel.</b></td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,28 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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
@key headful
@summary manual test for accessibility button demo
@run main/manual SwingSetTest TableDemo
*/

@ -0,0 +1,67 @@
<!--
Copyright (c) 2022, Oracle and/or its affiliates. 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.
-->
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:5%;">S.No</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:25%;">Test</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:75%;">Scenario</th>
</tr>
<tr>
<td>1</td>
<td>Tabs within demos (tests table navigation, as well as textfield input)</td>
<td>
Continue tabbing to enter a demo's pane. When the top demo tabs have focus, the left and right arrow keys
move between tabs.<br>
<img src="./resource/ifm.png">
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3">
<b>Expected Result</b>
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3">
Verify that the selected tab changes, e.g. between 'Internal Frame Demo' and "Source Code'.
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3"><b>Note: actual component appearence may vary depending on look and
feel.</b></td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,29 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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
@key headful
@summary manual test for accessibility button demo
@run main/manual SwingSetTest TabsDemo
*/

@ -0,0 +1,65 @@
<!--
Copyright (c) 2022, Oracle and/or its affiliates. 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.
-->
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:5%;">S.No</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:25%;">Test</th>
<th style="background-color:rgb(204,255,255); font-weight:bold; width:75%;">Scenario</th>
</tr>
<tr>
<td>1</td>
<td>Tree Demo</td>
<td>
Tab until the Tree icon <img src="./resource/tree.png"> has focus. Press 'space' to choose.
Tab until the "Tree Demo" tab has focus. Press 'space'. Press 'tab'. Press the down arrow. "Music" should
have focus.
Navigate up and down the tree using the up and down arrow keys.
Expand and collapse folders using the right and left arrow keys.
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3">
<b>Expected Result</b>
</td>
</tr>
<tr>
<td style="Width:100%;" colspan="3">
See above test description.
</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,28 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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
@key headful
@summary manual test for accessibility button demo
@run main/manual SwingSetTest TreeDemo
*/

@ -0,0 +1,53 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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.
*/
package lib;
import javax.swing.JEditorPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.io.IOException;
import java.net.URL;
/**
* Displays instructions provided through a URL.
*/
class DescriptionPane extends JPanel {
DescriptionPane(URL instructions) throws IOException {
JEditorPane editorPane = new JEditorPane();
editorPane.setFocusable(false);
editorPane.setContentType("text/html");
editorPane.setPage(instructions);
editorPane.setEditable(false);
JScrollPane esp = new JScrollPane(editorPane);
esp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
esp.setPreferredSize(new Dimension(250, 350));
setLayout(new BorderLayout());
add(esp);
}
}

@ -0,0 +1,73 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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.
*/
package lib;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.BorderLayout;
import java.util.function.Consumer;
import static java.awt.BorderLayout.CENTER;
import static java.awt.BorderLayout.NORTH;
/**
* Allows to enter reason for the test failure.
*/
class FailureReasonPane extends JPanel {
private final JTextArea text;
FailureReasonPane(Consumer<String> listener) {
setLayout(new BorderLayout(10, 10));
add(new JLabel("Failure reason:"), NORTH);
text = new JTextArea(3, 10);
text.getDocument().addDocumentListener(new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
listener.accept(text.getText());
}
@Override
public void removeUpdate(DocumentEvent e) {
listener.accept(text.getText());
}
@Override
public void changedUpdate(DocumentEvent e) {
listener.accept(text.getText());
}
});
add(text, CENTER);
}
public String getReason() {
return text.getText();
}
public void requestFocus() {
text.requestFocus();
}
}

@ -0,0 +1,159 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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.
*/
package lib;
import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.JTextArea;
import javax.swing.border.BevelBorder;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import java.util.function.Supplier;
import static java.awt.BorderLayout.*;
import static javax.swing.SwingUtilities.invokeAndWait;
/**
* A frame which can be used to display manual test descriptions as well as, in case of a failure,
* enter failure reason and capture the screen.
*/
public class ManualTestFrame extends JFrame {
private boolean alreadyFailed = false;
private ManualTestFrame(String testName, String headerText, URL instructions, Consumer<TestResult> listener) throws IOException {
super(testName);
JLabel statusLabel = new JLabel("Follow test description, select \"Pass\" or \"Fail\"");
statusLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
PassFailPane[] passFail = new PassFailPane[1];
FailureReasonPane failureReason = new FailureReasonPane(reason -> {
passFail[0].setFailEnabled(!reason.isEmpty());
});
ScreenImagePane image = new ScreenImagePane(e -> {
listener.accept(new TestResult(e));
dispose();
});
JPanel failureInfoPane = new JPanel();
failureInfoPane.setLayout(new GridLayout(1, 2, 10, 10));
failureInfoPane.add(failureReason);
failureInfoPane.add(image);
failureInfoPane.setVisible(false);
JPanel main = new JPanel();
main.setLayout(new BorderLayout(10, 10));
DescriptionPane description = new DescriptionPane(instructions);
main.add(description, CENTER);
passFail[0] = new PassFailPane((status) -> {
if (status) {
listener.accept(new TestResult());
dispose();
} else {
if (!alreadyFailed) {
alreadyFailed = true;
split.setDividerLocation(.5);
failureInfoPane.setVisible(true);
pack();
image.capture();
failureReason.requestFocus();
statusLabel.setText("Enter failure reason, re-take screenshot, push \"Fail\"");
} else {
listener.accept(new TestResult(failureReason.getReason(), image.getImage()));
dispose();
}
}
});
main.add(passFail[0], SOUTH);
split.setLeftComponent(main);
split.setRightComponent(failureInfoPane);
split.setDividerLocation(1.);
getContentPane().setLayout(new BorderLayout());
if (headerText != null) {
JTextArea warningLabel = new JTextArea(headerText);
warningLabel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
warningLabel.setEditable(false);
warningLabel.setFocusable(false);
getContentPane().add(warningLabel, NORTH);
}
getContentPane().add(statusLabel, SOUTH);
getContentPane().add(split, CENTER);
setPreferredSize(new Dimension(800, 600));
pack();
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
setVisible(true);
}
/**
* Show a test control frame which allows a user to either pass or fail the test.
* @param testName
* @param headerText
* @param instructions
* @return Returning supplier blocks till the test is passed or failed by the user.
* @throws InterruptedException
* @throws InvocationTargetException
*/
public static Supplier<TestResult> showUI(String testName, String headerText, URL instructions)
throws InterruptedException, InvocationTargetException {
AtomicReference<TestResult> resultContainer = new AtomicReference<>();
CountDownLatch latch = new CountDownLatch(1);
invokeAndWait(() -> {
try {
new ManualTestFrame(testName, headerText, instructions, (status) -> {
resultContainer.set(status);
latch.countDown();
});
} catch (IOException e) {
resultContainer.set(new TestResult(e));
e.printStackTrace();
}
});
return () -> {
try {
latch.await();
} catch (InterruptedException e) {
return new TestResult(e);
}
return resultContainer.get();
};
}
}

@ -0,0 +1,74 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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.
*/
package lib;
import javax.swing.JButton;
import javax.swing.JPanel;
import java.awt.HeadlessException;
import java.io.IOException;
import java.util.function.Consumer;
/**
* Allows to chose if a test fails or passes. It is a multi-use component. A chosen answer can be confirmed later
* upon providing additional information.
*/
class PassFailPane extends JPanel {
private final Consumer<Boolean> listener;
private final JButton btnPass = new JButton("Pass");
private final JButton btnFail = new JButton("Fail");
/**
* @param listener gets called with true (pass) or false (fail).
* @throws HeadlessException
*/
PassFailPane(Consumer<Boolean> listener)
throws HeadlessException, IOException {
this.listener = listener;
add(btnPass);
add(btnFail);
btnPass.requestFocus();
btnPass.addActionListener((e) -> {
disableButtons();
listener.accept(true);
});
btnFail.addActionListener((e) -> {
disableButtons();
listener.accept(false);
});
}
private void disableButtons() {
btnFail.setEnabled(false);
btnPass.setEnabled(false);
}
public void setFailEnabled(boolean enabled) {
btnFail.setEnabled(enabled);
}
}

@ -0,0 +1,124 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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.
*/
package lib;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFormattedTextField;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.text.NumberFormat;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import static java.awt.BorderLayout.CENTER;
import static java.awt.BorderLayout.NORTH;
import static java.lang.String.format;
import static javax.swing.SwingUtilities.invokeAndWait;
import static javax.swing.SwingUtilities.invokeLater;
/**
* Allows ti take screenshot, possible with a delay to preapare the UI.
*/
class ScreenImagePane extends JPanel {
private final JPanel imagePanel;
private final JLabel imageLabel;
private final AtomicReference<BufferedImage> image = new AtomicReference<>();
private final Rectangle screenRect;
private final JFormattedTextField delayField;
private final Consumer<Throwable> exceptionHandler;
/**
*
* @param handler should an exception appear on other threads
*/
ScreenImagePane(Consumer<Throwable> handler) {
exceptionHandler = handler;
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
screenRect = new Rectangle(0, 0, screenSize.width, screenSize.height);
JPanel controls = new JPanel();
delayField = new JFormattedTextField(NumberFormat.getNumberInstance());
delayField.setText("0");
delayField.setColumns(3);
JButton capture = new JButton("Retake screenshot");
controls.add(new JLabel("in "));
controls.add(delayField);
controls.add(new JLabel(" seconds "));
controls.add(capture);
capture.addActionListener((e) -> capture());
imagePanel = new JPanel();
imageLabel = new JLabel();
imagePanel.add(imageLabel);
setLayout(new BorderLayout());
add(controls, NORTH);
add(imagePanel, CENTER);
}
public void capture() {
new Thread(() -> {
try {
int delay = Integer.parseInt(delayField.getText());
invokeAndWait(() -> imageLabel.setIcon(null));
while (delay > 0) {
String message = format("Retaking screenshot in %d seconds", delay);
invokeLater(() -> imageLabel.setText(message));
delay--;
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
}
}
BufferedImage image = new Robot().createScreenCapture(screenRect);
ScreenImagePane.this.image.set(image);
int newWidth = imagePanel.getWidth();
int newHeight = imagePanel.getHeight();
float xratio = (float) newWidth / (float) image.getWidth();
float yratio = (float) newHeight / (float) image.getHeight();
if (xratio < yratio) {
newHeight = (int) (image.getHeight() * xratio);
} else {
newWidth = (int) (image.getWidth() * yratio);
}
Image scaled = image.getScaledInstance(newWidth, newHeight, Image.SCALE_FAST);
invokeAndWait(() -> {
imageLabel.setText(null);
imageLabel.setIcon(new ImageIcon(scaled));
});
} catch (Throwable e) {
exceptionHandler.accept(e);
}
}).start();
}
public BufferedImage getImage() {
return image.get();
}
}

@ -0,0 +1,79 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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.
*/
package lib;
import java.awt.image.BufferedImage;
public final class TestResult {
private final boolean status;
private final String failureDescription;
private final BufferedImage screenCapture;
private final Throwable exception;
/**
* Failed due to an exception.
*/
public TestResult(Throwable exception) {
status = false;
failureDescription = exception.getMessage();
screenCapture = null;
this.exception = exception;
}
/**
* Failed by used decision.
*/
public TestResult(String description, BufferedImage capture) {
status = false;
failureDescription = description;
screenCapture = capture;
exception = null;
}
/**
* Passed.
*/
public TestResult() {
this.status = true;
failureDescription = null;
screenCapture = null;
exception = null;
}
/**
* true - pass, false - no pass.
*/
public boolean getStatus() {
return status;
}
public String getFailureDescription() {
return failureDescription;
}
public BufferedImage getScreenCapture() {
return screenCapture;
}
public Throwable getException() {return exception;}
}

Binary file not shown.

After

(image error) Size: 560 B

Binary file not shown.

After

(image error) Size: 1.6 KiB

Binary file not shown.

After

(image error) Size: 37 KiB

Binary file not shown.

After

(image error) Size: 19 KiB

Binary file not shown.

After

(image error) Size: 88 KiB

Binary file not shown.

After

(image error) Size: 94 KiB

Binary file not shown.

After

(image error) Size: 4.5 KiB

Binary file not shown.

After

(image error) Size: 72 KiB

Binary file not shown.

After

(image error) Size: 759 B

Binary file not shown.

After

(image error) Size: 780 B

Binary file not shown.

After

(image error) Size: 151 KiB

Binary file not shown.

After

(image error) Size: 185 B

Binary file not shown.

After

(image error) Size: 264 B