RFR: 8294156: Demo positioning of multiple test windows [v2]
Alexey Ivanov
aivanov at openjdk.org
Wed Sep 27 17:01:16 UTC 2023
On Thu, 14 Sep 2023 14:53:08 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:
>> test/jdk/java/awt/Window/8294156/manyWindows/TwoWindowColumnsH.java line 96:
>>
>>> 94: private static final int COLUMNS = 3;
>>> 95:
>>> 96: public static void positionTestUI(List<? extends Window> windows,
>>
>> When I thought about adding more than one window, I thought about simply placing everything in a row.
>>
>> Looking at all this I have mixed feelings.
>> On the one hand a person using all this for the first time will have to spend some time to understand how it works, or take the easy way out and manually arrange the windows.
>> On the other hand, the result is impressive, and can make life easier if you don't have to write positionTestUI every time.
>>
>> I think if we do go this way, we should add some standard positionTestUI implementations to PassFailJFrame so that we don't have to reinvent the wheel every time.
>>
>> It is also worth considering that looks like we don't have many tests with more than 2-3 windows.
>
> Isn't it the problem? If we allow adding more than one window, there should be a way to position them… as we have a way to position one test window. Do you agree?
>
>> When I thought about adding more than one window, I thought about simply placing everything in a row.
>
> This is pretty easy. If you look at `TwoWindowsHH.java`
> https://github.com/openjdk/jdk/blob/4c0e4d097e3a484698bee0356ba36557ccc9e96c/test/jdk/java/awt/Window/8294156/twoWindows/TwoWindowsHH.java#L64-L69
>
> It implements positioning of test windows in a row, either to the right of the instructions or below it.
>
> Then `TwoWindowsHV.java` does the same for placing test windows in a column to the right or below the instructions.
>
> This still requires refinement.
>
>> Looking at all this I have mixed feelings.
>
> I do too.
>
> When Lawrence @lawrence-andrew and I started on the manual test framework ([JDK-8283712](https://bugs.openjdk.org/browse/JDK-8283712)), I envisioned it as something light that provided a quick and easy replacement for applet-based manual Yes/No test, that also gave a unified look to manual tests. If I remember correctly, we took inspiration from your code. ;)
>
> As new scenarios emerged, the framework grew… Yet it wasn't as easy to use, it still required manually creating test UI, registering test windows. The idea of disposing of all the frames was rejected on [the code review](https://github.com/openjdk/jdk/pull/7966#discussion_r835700911).
>
> I truly believe Lawrence's idea of the builder pattern ([JDK-8294535](https://bugs.openjdk.org/browse/JDK-8294535)) is a *game-changer*. With the addition of the `testUI` method, the entire `main` method becomes simple, *streamlined*. I think it makes using the framework easier.
>
> I had this idea of passing a method reference to create a test window from the start. But I never thought about supporting two test windows or more.
>
> As you can see, handling one test window is much simpler, the internals have grown dramatically with multiple windows.
>
> At the same time, I must **thank you** for raising this problem. Adding support for multiple windows would've been harder if I'd handled only one test window.
>
>> On the one hand a person using all this for the first time will have to spend some time to understand how it works, or take the easy way out and manually arrange the windows.
>
> The hardest part is making it easy to use… and flexible at the same time.
>
> Manually arranging windows could be easier as the developer knows more about their intentions. Ha...
> > …We should add some standard positionTestUI implementations to PassFailJFrame so that we don't have to reinvent the wheel every time.
>
> I didn't even think about not providing any default implementations of `positionTestUI` — that's the idea! The framework should support simple layouts.
I submitted an enhancement [JDK-8317116](https://bugs.openjdk.org/browse/JDK-8317116): _Provide layouts for multiple test UI in `PassFailJFrame`_.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15721#discussion_r1338928149
More information about the client-libs-dev
mailing list