On Mon, 11 Sep 2023 15:36:56 GMT, Alexey Ivanov <[email protected]> wrote:

> 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.

test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 313:

> 311:     @FunctionalInterface
> 312:     public interface WindowCreator {
> 313:         Window createTestUI();

Sometimes we may need to create more than one window(e.g. some DnD test with 
two windows).
Perhaps we should consider that here by adding `List<Window> createTestUI()`.

test/jdk/java/awt/regtesthelpers/PassFailJFrame.java line 457:

> 455:     /**
> 456:      * Disposes of all the windows. It disposes of the test instruction 
> frame
> 457:      * and all other windows added via {@link #addTestWindow(Window)}.

Shouldn't we mention here a window added by `testUI`  via builder?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15665#discussion_r1323010242
PR Review Comment: https://git.openjdk.org/jdk/pull/15665#discussion_r1323014582

Reply via email to