RFR: JDK-8340210 : Add positionTestUI() to PassFailJFrame.Builder [v2]

Harshitha Onkar honkar at openjdk.org
Mon Sep 16 21:38:36 UTC 2024


On Mon, 16 Sep 2024 21:31:58 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)
>>                       .columns(int)
>>                       .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)`
>> 
>> @aivanov-jdk has demonstrated custom test UI positioning in this PR: 
>> **[8294156: Demo positioning of multiple test windows](https://github.com/openjdk/jdk/pull/15721)**
>
> Harshitha Onkar has updated the pull request incrementally with one additional commit since the last revision:
> 
>   removed errorenous check

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

> 1275:                                                 + "nor a list of test windows "
> 1276:                                                 + "has been provided");
> 1277:             }

@aivanov-jdk Running into exception when this check is added here. I believe this check needs to be done after `positionWindows` is assigned.
  
And since this check is already in-place in [validate()](https://github.com/openjdk/jdk/blob/418bb42b95b177f5f31f756054d0dd83740c6686/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java#L1475C1-L1479C18) , I'm removing it from here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21023#discussion_r1761989555


More information about the client-libs-dev mailing list