<AWT Dev> RFR: 8267161 : Write automated test case for JDK-4479161 [v3]
Alexey Ivanov
aivanov at openjdk.java.net
Mon Aug 16 21:17:28 UTC 2021
On Mon, 16 Aug 2021 20:05:58 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 two additional commits since the last revision:
>
> - Fixed a single space issue
> - Add frame.setLocationRelativeTo to get the frame to center of the screen
test/jdk/java/awt/im/4959409/bug4959409.java line 47:
> 45: import java.awt.Robot;
> 46: import java.util.concurrent.CountDownLatch;
> 47: import java.util.concurrent.TimeUnit;
Usually in JDK, `javax.*` imports go after `java.*`.
test/jdk/java/awt/im/4959409/bug4959409.java line 124:
> 122: }
> 123:
> 124: Robot robot = new Robot();
Won't using `robot.setAutoDelay(DELAY)` give the same effect without the need to interleave key presses and mouse moves with explicit delay?
test/jdk/java/awt/im/4959409/bug4959409.java line 144:
> 142: robot.delay(DELAY);
> 143: robot.keyRelease(KeyEvent.VK_1);
> 144: robot.delay(DELAY);
Shall we not release '1' first and then Shift?
Isn't it the case mentioned in #5079 ?
test/jdk/java/awt/im/4959409/bug4959409.java line 173:
> 171: while (count <= 5) {
> 172: TimeUnit.SECONDS.sleep(1);
> 173: if (component.isVisible()) {
Should `component.isVisible()` also be called on EDT?
test/jdk/java/awt/im/4959409/bug4959409.java line 198:
> 196: });
> 197: }
> 198: }
Probably this could be simplified to:
Suggestion:
try {
createUIAndTest();
} finally {
SwingUtilities.invokeAndWait(()-> {
if (frame != null) {
frame.dispose();
}
});
}
With the assumption `createUIAndTest()` is made static.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5058
More information about the awt-dev
mailing list