RFR: 8294156: Allow PassFailJFrame.Builder to create test UI

Alexey Ivanov aivanov at openjdk.org
Mon Sep 11 15:45:09 UTC 2023


This enhances the `Builder` pattern added in [JDK-8294535](https://bugs.openjdk.org/browse/JDK-8294535) with a new method `testUI` which allows passing a lambda expression or a method reference to create *the test UI window*.

The `PassFailJFrame` will automatically call the method on the EDT to create the UI, add it to the internal list of windows, install the window closing listener and finally position and show both the instructions and test UI.

Alternatively, you can pass an already created window.

The `main` method of a manual test could look as simple as a sequence of calls:


    public static void main(String[] args) throws Exception {
        PassFailJFrame.builder()
                      .instructions(INSTRUCTIONS)
                      .testUI(() -> createTestUI())
                      .build()
                      .awaitAndCheck();
    }

where `createTestUI` returns a test UI window.

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

Depends on: https://git.openjdk.org/jdk/pull/15660

Commit messages:
 - Remove trailing whitespace
 - Mark the Builder class final
 - Amend message in window closing handler
 - Use invokeOnEDT in getInstructionFrameBounds
 - Use functional style for disposing of windows
 - Use statically imported invokeAndWait and isEDT
 - Build functional test UI
 - Refactor windowClosing listener

Changes: https://git.openjdk.org/jdk/pull/15665/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15665&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8294156
  Stats: 125 lines in 1 file changed: 91 ins; 20 del; 14 mod
  Patch: https://git.openjdk.org/jdk/pull/15665.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/15665/head:pull/15665

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


More information about the client-libs-dev mailing list