RFR: 8340007: Refactor KeyEvent/FunctionKeyTest.java

Alexey Ivanov aivanov at openjdk.org
Mon Sep 16 09:59:17 UTC 2024


This changeset refactors `java/awt/event/KeyEvent/FunctionKeyTest.java`.

Key changes:

- Use `CyclicBarrier` to verify whether a key is pressed and released;
- Use `CountDownLatch` for frame activation;
- Ensure thread-safety for keeping thrown exceptions.

Other changes:

- Made `FunctionKeyTester` a nested class inside `FunctionKeyTest`;
- Used constants for the key events rather than magic numbers.

I ran the updated test a few times with `JTREG=REPEAT_COUNT=20`, the test has passed.

The updated test executes somewhat quicker than the old one.

@azvegint, you may want to take a look.

-------------

Commit messages:
 - 8340007: Refactor KeyEvent/FunctionKeyTest.java

Changes: https://git.openjdk.org/jdk/pull/21013/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=21013&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8340007
  Stats: 114 lines in 1 file changed: 62 ins; 15 del; 37 mod
  Patch: https://git.openjdk.org/jdk/pull/21013.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21013/head:pull/21013

PR: https://git.openjdk.org/jdk/pull/21013


More information about the client-libs-dev mailing list