RFR: 8346753: Test javax/swing/JMenuItem/RightLeftOrientation/RightLeftOrientation.java fails on Windows Server 2025 x64 because the icons of RBMenuItem and CBMenuItem are not visible in Nimbus LookAndFeel [v2]
Abhishek Kumar
abhiscxk at openjdk.org
Mon Jul 7 03:14:46 UTC 2025
On Mon, 7 Jul 2025 02:27:30 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> Issue is RadioButtonMenuItem and CheckBoxMenuItem bullet/checkmark icon is not displayed in WindowsL&F when the test is run with NimbusL&F.
>> This is because `WindowsIconFactory#VistaMenuItemCheckIcon.paintIcon` called `getLaFIcon()` which returns a empty NimbusIcon which causes no icons to be drawn. This is because the test after setting WIndows L&F of the menuitem reverts back the Windows L&F to Nimbus L&F via `UIManager.setLookAndFeel(save);` call in the test so when frame is made visible, the L&F resets back to Nimbus L&F resulting in null NimbusIcon.
>>
>> Fix is made to make sure the whole frame is updated to cater to L&F change via `SwingUtilities.updateComponentTreeUI(frame);` call and keep the L&F without reverting back to original L&F..
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> L&F run as different test
test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java line 44:
> 42: * @build PassFailJFrame
> 43: * @run main/manual RightLeftOrientation motif
> 44: */
Test can be extended for "Nimbus" L&F also as it is supported for all platforms.
test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java line 86:
> 84:
> 85: The menu is divided into two halves. The upper half is oriented
> 86: left-to-right and the lower half is oriented right-to-left.
Is it better ?
Suggestion:
The menu is divided into two halves. The upper half is
left-to-right oriented and the lower half is right-to-left oriented.
test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java line 113:
> 111: System.out.println("Test for LookAndFeel " + lafClassName);
> 112: PassFailJFrame.builder()
> 113: .title("RightLeftOrientation Instructions")
Setting title explicitly is not required.
test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java line 119:
> 117: .build()
> 118: .awaitAndCheck();
> 119: System.out.println("Test passed for LookAndFeel " + lafClassName);
jtr file is available for each L&F testing and by default "Test Passed!" output is available. This doesn't seem to be useful.
Test for LookAndFeel javax.swing.plaf.metal.MetalLookAndFeel
Test passed!
Test passed for LookAndFeel javax.swing.plaf.metal.MetalLookAndFeel
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25907#discussion_r2188876818
PR Review Comment: https://git.openjdk.org/jdk/pull/25907#discussion_r2188877605
PR Review Comment: https://git.openjdk.org/jdk/pull/25907#discussion_r2188867260
PR Review Comment: https://git.openjdk.org/jdk/pull/25907#discussion_r2188879974
More information about the client-libs-dev
mailing list