On Tue, 12 Sep 2023 18:41:23 GMT, Alexander Zvegintsev <[email protected]> 
wrote:

>>> 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()`.
>> 
>> I thought about it. Yet I couldn't find a simple scenario where multiple 
>> windows need to be created. When there are multiple windows, you have to 
>> position them. The positions of the windows may depend on the position of 
>> the instruction frame. In #12447, Harshitha @honkar-jdk managed many test 
>> windows.
>> 
>> I decided to handle the most common scenario: *one test window*.
>> 
>> This can be extended in the future by creating `WindowListCreator` 
>> interface, its `createTestUI` method will return a list or a collection: 
>> `List<Window>` or `Collection<Window>`. Changing the signature of the 
>> existing `WindowCreator.createTestUI` could also be possible without 
>> breaking backwards compatibility.
>> 
>> Now that I think about it more, you have a point… *Why not allow passing a 
>> list of windows right away?* However, to test this case I'll need a (simple) 
>> scenario where multiple windows are created.
>
>> However, to test this case I'll need a (simple) scenario where multiple 
>> windows are created.
> 
> For example 
> `test/jdk/java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter_2.java`
>  is not converted to use PassFailJFrame, but shows instruction window and two 
> test windows.
> 
> For these test windows, we can safely reduce the width a lot and arrange them 
> in a row.
> ![image](https://github.com/openjdk/jdk/assets/77687766/9c7f3548-fa0a-4e1f-ad87-a7af7561064b)
> 
> Probably we could add some other sophisticated layouts later, e.g.:
> ![image](https://github.com/openjdk/jdk/assets/77687766/a9da5948-9f52-420e-8f15-55818fe8f255)
> 
> But this kind of layout seems to be beyond the scope of this PR, I just wish 
> we hadn't missed the option to add multiple windows at once.

But laying out the test windows is really a problem. With one window, the 
framework already provides a way to position the window, it is applied to the 
primary test window.

Before showing other windows, they need to be positioned.

There could be a callback so that the test developer is able to position the 
windows. In the future, we may add simple layouts to perform this task 
automatically.

> But this kind of layout seems to be beyond the scope of this PR, I just wish 
> we hadn't missed the option to add multiple windows at once.

I agree, it's better to implement it right away. I didn't think about it as 
viable solution because of positioning issues.

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

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

Reply via email to