On Wed, 3 Sep 2025 03:58:56 GMT, Prasanta Sadhukhan <[email protected]> 
wrote:

>> The GlassPaneOverlappingTestBase tests are not multi-frame tests, they do 
>> not use multiple frames where each frame has an AWT component to test Swing 
>> with that AWT component. If the frame is disposed in the 
>> SimpleOverlappingTestBase class, the frame will disappear and the test will 
>> fail. This applies only the the GlassPane tests (extending 
>> GlassPaneOverlappingTestBase)
>
> 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`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25971#discussion_r2318328990

Reply via email to