On Thu, 31 Jul 2025 16:21:46 GMT, Abhishek Kumar <abhis...@openjdk.org> wrote:
> > > If I am right, the main bug is about underline drawing and not about > > > mnemonic. Yet mnemonic is used to check underline drawing under the > > > string, I guess you can think of using the code mentioned in > > > [JDK-4967768](https://bugs.openjdk.org/browse/JDK-4967768) in the test > > > which would be fine for all L&F. > > > > > > Good point. I second this if possible. > > Yes, the main bug is about the underline drawing and not mnemonic but the > underline i.e. mnemonic visibility depends on the platform the test is > running. It depends on the current L&F as well. In case of Metal, Motif and > Nimbus, the underline is visible always whereas if the test ran with Windows > or GTK L&F, underline visibility depends on the how the underlying platform > handle the underline. If the underline drawing is invisible then I don't see > any way to verify it's position. > > > I guess you can think of using the code mentioned in > > [JDK-4967768](https://bugs.openjdk.org/browse/JDK-4967768) in the test > > which would be fine for all L&F. > > The code you mentioned is already implemented in [SwingUtilities's > drawStringUnderlineCharAt](https://github.com/kumarabhi006/jdk/blob/04c0b130f09c093797895cc928fe020d7e584cb9/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java#L694) > method and I checked on Windows and macOS that this code path is executed > and that impact the underline drawing. If it is commented then there is no > underline drawing for the mnemonics and vice-versa. > > The underline drawing is correct as it has drawn just below the baseline and > not below the character "P". > > So, I think the fix requires an instruction change to let the tester know > that the "ALT" key press is a requirement to make the mnemonic visible and > then the underline position can be verified further. I got the point. I'm suggesting that instead of relying on "ALT" key press which in turn draw underline that has some dependency on L&F, drawing underline to verify the test would be better. ------------- PR Comment: https://git.openjdk.org/jdk/pull/26546#issuecomment-3142183359