<AWT Dev> RFR: 8267161 : Write automated test case for JDK-4479161 [v5]
Alexey Ivanov
aivanov at openjdk.java.net
Fri Aug 20 13:48:27 UTC 2021
On Thu, 19 Aug 2021 18:54:48 GMT, lawrence.andrews <github.com+87324768+lawrence-andrew at openjdk.org> wrote:
>> 1) Automated the manual test case.
>> 2) Removed html dependent file
>> 3) Removed javax.swing.JApplet dependent.
>> 4) Test case can be executed independently as well with jtreg framework.
>> 5) Added methods to know that JFrame and Other component is visible before starting the user action via Robot.
>>
>> @shurymury
>
> lawrence.andrews has updated the pull request incrementally with one additional commit since the last revision:
>
> Added WindowListener to check Frame is opened and simplified the testcase
Marked as reviewed by aivanov (Reviewer).
test/jdk/java/awt/im/4959409/bug4959409.java line 59:
> 57: private static JLabel jLabel;
> 58:
> 59: public static void createUIAndTest() throws InterruptedException, InvocationTargetException, AWTException {
`throws Exception` would be enough and shorter:
Suggestion:
public static void createUIAndTest() throws Exception {
It's a test code, any exception means the test fails, so we don't care much about which specific exceptions can be thrown.
test/jdk/java/awt/im/4959409/bug4959409.java line 80:
> 78:
> 79: jTextField.addKeyListener(new KeyAdapter() {
> 80:
I'd remove this blank line for consistency with the anonymous class above.
test/jdk/java/awt/im/4959409/bug4959409.java line 92:
> 90: } else {
> 91: jLabel.setText("Did not received keyPressed for Shift+1");
> 92: System.out.println("Did not received keyPressed for Shift+1");
The grammar:
Suggestion:
jLabel.setText("Did not receive keyPressed for Shift+1");
System.out.println("Did not receive keyPressed for Shift+1");
test/jdk/java/awt/im/4959409/bug4959409.java line 120:
> 118: });
> 119:
> 120: clickTextField(robot, points[0].x + rect[0].width / 2, points[0].y + rect[0].height / 2);
I'd probably wrap this line, it doesn't fit even in 120 columns.
test/jdk/java/awt/im/4959409/bug4959409.java line 131:
> 129:
> 130: if (!keyPressedEventLatch.await(TIMEOUT, TimeUnit.SECONDS)) {
> 131: throw new RuntimeException("Did not received keyPressed for Shift + 1 , test failed");
The grammar:
Suggestion:
throw new RuntimeException("Did not receive keyPressed for Shift + 1 , test failed");
test/jdk/java/awt/im/4959409/bug4959409.java line 147:
> 145:
> 146: public static void main(String[] args) throws InterruptedException, InvocationTargetException,
> 147: AWTException {
Suggestion:
public static void main(String[] args) throws Exception {
Shorter.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5058
More information about the awt-dev
mailing list