RFR: 8158801: [TEST_BUG] Mixing tests fail because of focus workaround trick [v27]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Thu Sep 4 05:00:49 UTC 2025
On Wed, 3 Sep 2025 09:12:14 GMT, Khalid Boulanouare <duke at openjdk.org> wrote:
>> But the frame should be disposed *after* the test is executed, more specifically in finally block so am still not sure about this addition
>
> @prsadhuk My understanding is that test which extend `GlassPaneOverlappingTestBase` use only on frame for testing all AWT component. If you have a look at implementation of method `prepareControls` in both `GlassPaneOverlappingTestBase` and in `SimpleOverlappingTestBase`, you will notice that in `GlassPaneOverlappingTestBase` we create only one instance frame, and we use this same frame for the whole lifecycle of the test for all AWT component. `performTest` method will test an AWT component at a time, and if we dispose of the ancestor frame, the test fails, because the next AWT component is expected to run on the same ancestor frame. On the contrary, in tests extending `SimpleOverlappingTestBase` each AWT component runs on its own Frame which is created on `prepareControls` method, so disposing that frame at the end of the `performTest` method, does not affect the next AWT components, because they have their own frame.
>
> For this reason I introduced the flag `multiFramesTest` to differentiate between multi-frames tests (Extending `SimpleOverlappingTestBase`) and one frame tests (Extending `GlassPaneOverlappingTestBase`).
>
>
> On slightly different topic, parent class OverlappingTestBase have method `cleanup` which is never used, but we can use to dispose of frame created by `GlassPaneOverlappingTestBase`.
ok
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25971#discussion_r2320832680
More information about the client-libs-dev
mailing list