RFR: 8294156: Allow PassFailJFrame.Builder to create test UI [v4]
Alexey Ivanov
aivanov at openjdk.org
Wed Oct 25 11:29:49 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.
Alexey Ivanov has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 16 commits:
- Merge master
- Add instructions on how to use PassFailJFrame
- 8294156: Allow creating several test windows
The windows can be positioned in advance, or
a call back PositionWindows interface can be used
to define their positions after the instruction UI
frame is positioned on the screen.
- Remove trailing whitespace
- Mark the Builder class final
It's not supposed to be extended.
- Amend message in window closing handler
The WindowClosingHandler is used both for the instruction
frame and for test UI windows.
Also add blank lines to separate different parts of the class.
- Use invokeOnEDT in getInstructionFrameBounds
- Use functional style for disposing of windows
Also clean up the doc for disposeWindows().
- Use statically imported invokeAndWait and isEDT
- Build functional test UI
The Builder now provides a method to create test UI,
PassFailJFrame automatically invokes the method reference
on the EDT and then shows both the instruction frame and
the test window.
- ... and 6 more: https://git.openjdk.org/jdk/compare/14090ef6...eff09d0d
-------------
Changes: https://git.openjdk.org/jdk/pull/15665/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15665&range=03
Stats: 442 lines in 1 file changed: 365 ins; 38 del; 39 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