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

Alexey Ivanov aivanov at openjdk.org
Tue Sep 17 09:52:04 UTC 2024


On Tue, 17 Sep 2024 08:38:13 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:

> I think that this can be improved by adding some predefined positionTestUI functions, like in the #15721 (we can borrow them from it).

I agree that we should — and *we will*. Yet I don't see missing default layouts as stopper from integrating this PR.

Adding a library of common layouts will take more time — to add layouts and to review — and @honkar-jdk wants to use the feature right now. It's better to do it with what's currently available rather than implement tricks to position two test UI windows. @kumarabhi006 also asked about the feature.

Once tests are created, or even right now, we can submit bugs to update the test and use a common layout rather than one in the test and link those bugs as blocked by [JDK-8317116](https://bugs.openjdk.org/browse/JDK-8317116).

There's already a test `java/awt/event/KeyEvent/AcceleratorTest/AcceleratorTest.java` which uses two test UI windows, yet it doesn't do anything to position them:
https://github.com/openjdk/jdk/blob/c6721a0fa2582c3ddf1ef0a6e16a09234432939c/test/jdk/java/awt/event/KeyEvent/AcceleratorTest/AcceleratorTest.java#L157-L161

This test could be updated to use logging area instead of two test windows. Either way works.

> For example, consider adding `PositionWindowsLib.java`(or maybe a nested public static class for `PassFailJFrame` to avoid extra `@build` clause)

I've thought about it. We can add the most common layout right into `PassFailJFrame` to avoid additional `@build` tag. It could even be in a separate class, as you suggest, if it's referenced by `PassFailJFrame`, it will be automatically compiled by jtreg.

I think we should add convenience methods `positionTestUIRows`, `positionTestUIColumns`, it'll make using the common layouts even simpler. If the convenience methods reference another class, it should be compiled automatically; if it doesn't work, we will put the layouts as a nested class or as methods directly into `PassFailJFrame`.

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

PR Comment: https://git.openjdk.org/jdk/pull/21023#issuecomment-2355078684


More information about the client-libs-dev mailing list