RFR: JDK-8340210 : Add positionTestUI() to PassFailJFrame builder pattern
Alexey Ivanov
aivanov at openjdk.org
Mon Sep 16 19:44:04 UTC 2024
On Mon, 16 Sep 2024 19:11:59 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:
> `positionTestUI()` option is added to PassFailJFrame (PFJ).
>
> With this change multiple UI can be positioned using the PFJ new builder pattern by providing implementation for the Functional Interface `PositionWindows.positionTestWindows(List<? extends Window> testWindows,InstructionUI instructionUI)` in the test code.
>
> Since the position implementation is done in test code it allows flexibility as the user can add custom positioning code per test UI requirements.
>
> Usage:
>
> PassFailJFrame.builder()
> .title("Test Instructions")
> .instructions(INSTRUCTIONS)
> .rows((int) INSTRUCTIONS.lines().count() + 3)
> .columns(30)
> .testUI(<TestClass::createAndShowUI>)
> .positionTestUI(<TestClass::positionMultiTestUI>)
> .build()
> .awaitAndCheck();
>
> where positionMultiTestUI is the implementation for positioning of multiple test windows for `PositionWindows.positionTestWindows(List<? extends Window> testWindows,InstructionUI instructionUI)`
>
> Few examples of custom testUI positioning implementation using positionTestUI are demonstrated here:
> **[8294156: Demo positioning of multiple test windows](https://github.com/openjdk/jdk/pull/15721)**
Looks good to me.
It was previously discussed in #15665 when I added `testUI`. The interface and the field in the builder were defined but there was no way to pass an implementation of `PositionWindows`.
> Since the position implementation is done in test code it allows flexibility as the user can add custom positioning code per test UI requirements.
There's an enhancement [JDK-8317116](https://bugs.openjdk.org/browse/JDK-8317116): _Provide layouts for multiple test UI in `PassFailJFrame`_ to provide a set of common layouts for tests to re-use. It would avoid code duplication for the most common layouts like columns or rows to the right or bottom of the instruction UI.
-------------
Marked as reviewed by aivanov (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/21023#pullrequestreview-2307616880
More information about the client-libs-dev
mailing list