RFR: 8158801: [TEST_BUG] Mixing tests fail because of focus workaround trick [v18]

Alexey Ivanov aivanov at openjdk.org
Tue Aug 12 15:09:24 UTC 2025


On Wed, 6 Aug 2025 10:27:06 GMT, Khalid Boulanouare <duke at openjdk.org> wrote:

>> Many Mixing tests failed because the work around click lands on the minimizing area in the window control and causes the tests to fail.
>> 
>> This fix changes the width of base frames which allows most of tests to pass.
>
> Khalid Boulanouare has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Updates CountDownLatch waiting time to one second

Strangely enough, these changes make no difference for me when I run Mixing tests locally. The same number of tests fails with and without this fix. However, it seems to affect the CI.

Additionally, I still see the windows / frames are minimised on Windows. I don't think this is expected, is it? Thus, your previous suggestion for increasing the size of the windows looks reasonable to me.

test/jdk/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java line 140:

> 138:                         }else{
> 139:                             f.requestFocusInWindow();
> 140:                         }

To simplify the code, you can request focus either way. If the component already has focus, requesting focus is a no-op.

Suggestion:

                        if (focusOwner == f) {
                            // frame already had focus
                            latch.countDown();
                        } else {
                            f.requestFocusInWindow();
                        }

Formatting needs tweaking.

test/jdk/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java line 152:

> 150:             try {
> 151:                 boolean await = latch.await(1, TimeUnit.SECONDS);
> 152:                 if (!await) {

Suggestion:

                if (!latch.await(1, TimeUnit.SECONDS)) {

I see no need for the variable.

test/jdk/java/awt/Mixing/AWT_Mixing/GlassPaneOverlappingTestBase.java line 155:

> 153:                     throw new RuntimeException(
> 154:                             "Ancestor frame didn't receive " +
> 155:                                     "focus");

Suggestion:

                    throw new RuntimeException("Ancestor frame didn't receive focus");

I think not wrapping this line improves readability.

test/jdk/java/awt/Mixing/AWT_Mixing/SimpleOverlappingTestBase.java line 169:

> 167:                 throw new RuntimeException("Ancestor frame didn't receive " +
> 168:                         "focus");
> 169:             }

The same comments as for `GlassPaneOverlappingTestBase.java`.

The latch may never release because you don't call its `countDown` method if `ancestor` is `null`. Can `ancestor` be `null`?

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

PR Review: https://git.openjdk.org/jdk/pull/25971#pullrequestreview-3111232727
PR Review Comment: https://git.openjdk.org/jdk/pull/25971#discussion_r2270174613
PR Review Comment: https://git.openjdk.org/jdk/pull/25971#discussion_r2270182995
PR Review Comment: https://git.openjdk.org/jdk/pull/25971#discussion_r2270179068
PR Review Comment: https://git.openjdk.org/jdk/pull/25971#discussion_r2270192913


More information about the client-libs-dev mailing list