RFR: JDK-8348302 : [Test bug] Update FileDialogIconTest.java
Harshitha Onkar
honkar at openjdk.org
Fri Feb 7 20:38:21 UTC 2025
On Fri, 7 Feb 2025 19:50:03 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:
> FileDialogIconTest.java has been updated.
>
> Following changes were made.
>
> - Test instructions updated
> - BugID associated with the test is updated to the correct one
> - setIconBufferedImagesToFrame and setIconBufferedImagesToDialog btns added to the frame.
> - other minor cleanups
test/jdk/java/awt/Dialog/FileDialogIconTest/FileDialogIconTest.java line 45:
> 43: * @summary Test to verify that PIT File Dialog icon not matching with
> 44: * the new java icon (frame Icon) - PIT build
> 45: * @requires (os.family == "windows")
The original test was created to check if the Frame and FileDialog icons match - [JDK-6425126](https://bugs.openjdk.org/browse/JDK-6425126)
There are some things that are not clear about the expected behavior for FileDialog icons.
- At present the FileDialog inherits the Frame icon (owner window) and does not change when the icon is explicit set to dialog using `dialog.setIconImage()/.setIconImages()`
- The JavaDoc for setIconImage() states - _"Ownerless windows with no icon specified use platform-default icon. The icon of an owned window may be inherited from the owner **unless explicitly overridden**."_
- In the test, the FileDialog icon is overridden but it still inherits the owner window icon (Frame). This is because the WindowPeer is null in case of FileDialog, thus updateIconImage() is not executed (updateIconImage() is not overriden in WFileDialogPeer). Is this the expected behavior?
https://github.com/openjdk/jdk/blob/f0ea38b3874ac627766768cbcd13f4be68c53797/src/java.desktop/share/classes/java/awt/Window.java#L674C1-L677C10
- There is also the question of additional buttons in the test that are meant to explicitly set icons to the FileDialog (but don't work). FileDialog icon gets updated only works when the Frame icon is updated (owner) and then Dialog is opened (via Load/Save/Simple dialog btn).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23523#discussion_r1947147492
More information about the client-libs-dev
mailing list