RFR: 8316931: [macos14] Test "java/awt/TrayIcon/ShowAfterDisposeTest/ShowAfterDisposeTest.html" throws and exception on Mac OS 14(x64, aarch64) [v4]
Alexey Ivanov
aivanov at openjdk.org
Tue Jan 16 13:30:26 UTC 2024
On Fri, 12 Jan 2024 22:18:04 GMT, Alisen Chung <achung at openjdk.org> wrote:
>> SunToolkit.java is trying to post an event on the TrayIcon appContext, but the TrayIcon was already removed by the test, causing an error. The fix is to make SunToolkit skip posting the event if appContext is null. The test is also updated to remove applet usage and use PassFailJFrame instead.
>
> Alisen Chung has updated the pull request incrementally with one additional commit since the last revision:
>
> used jtreg.SkippedException, updated copyright years
test/jdk/java/awt/TrayIcon/ShowAfterDisposeTest.java line 77:
> 75: .build();
> 76: showFrameAndIcon();
> 77: passFailJFrame.awaitAndCheck();
May I suggest simplifying it even further?
Suggestion:
PassFailJFrame.builder()
.title("Test Instructions Frame")
.instructions(instructions)
.testTimeOut(10)
.rows(10)
.columns(45)
.testUI(ShowAfterDisposeTest::showFrameAndIcon)
.build()
.awaitAndCheck();
where `showFrameAndIcon` is modified like this:
private static JFrame showFrameAndIcon() {
JFrame frame = new JFrame("ShowAfterDisposeTest");
frame.setLayout(new BorderLayout());
// Rest of the code and no `invokeAndWait`
// You'll have to add a try block around `tray.add(icon)` to catch and
// wrap AWTException into RuntimeException.
return frame;
}
Essentially, the additional frame is not required at all, it can be dropped but I haven't explored it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17329#discussion_r1453427141
More information about the client-libs-dev
mailing list