RFR: 8316388: Opensource five Swing component related regression tests [v2]
Alexander Zuev
kizune at openjdk.org
Tue Mar 12 11:07:39 UTC 2024
On Mon, 11 Mar 2024 14:04:36 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> Alexander Zuev has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Bumped copyright year of the affected tests
>> Minor changes based on the review comments
>
> test/jdk/javax/swing/JEditorPane/4325606/bug4325606.java line 115:
>
>> 113: try {
>> 114: SwingUtilities.invokeAndWait(b::setupGUI);
>> 115: safeSleep(3000);
>
> Instead of sleeping, you can use a `CountDownLatch(3)` which you'll `countDown()` for each mouse click. Here you'll call `await(3, TimeUnit.SECONDS)` and throw a timeout error if `await` returns `false`.
>
> Another synchroniser may be used to handle the case where `BadLocationException` is thrown to fail the test right away. Alternatively, `BadLocationException` may be wrapped into `RuntimeException` and re-thrown.
This is a very simple case and sleeping worked for it so i do not see reason to rewrite it with CDL.
> test/jdk/javax/swing/JEditorPane/4694598/bug4694598.java line 69:
>
>> 67: public void performTest() throws InterruptedException,
>> 68: InvocationTargetException {
>> 69: JRobot jRobo = JRobot.getRobot();
>
> Suggestion:
>
> JRobot jRobo = JRobot.getRobot();
> jRobo.waitForIdle();
>
> Let the frame appear on the screen.
Done
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18184#discussion_r1521268654
PR Review Comment: https://git.openjdk.org/jdk/pull/18184#discussion_r1521267248
More information about the client-libs-dev
mailing list