On Tue, 19 Sep 2023 19:50:25 GMT, Martin Fox <d...@openjdk.org> wrote:
>> You could try this code (using this PR's code): >> >> >> public class KeyboardLayoutTest extends TextInputBehaviorRobotTest<TextArea> >> { >> >> public KeyboardLayoutTest() { >> super(new TextArea()); >> } >> >> @BeforeEach >> @Override >> public void beforeEach() { >> super.beforeEach(); >> control.setWrapText(true); >> } >> >> @Test >> public void testTyping() throws Exception { >> KeyCode[] codes = { >> KeyCode.A >> }; >> >> execute( >> exe(() -> { >> control.addEventFilter(KeyEvent.ANY, (ev) -> { >> System.out.println(ev); >> ev.consume(); >> }); >> }) >> ); >> >> for(KeyCode cd: codes) { >> Util.runAndWait(() -> { >> robot.keyPress(cd); >> robot.keyRelease(cd); >> }); >> } >> } >> } > > I tried your test code and couldn't reproduce the problem. Both U.S. English > and French layouts gave me the expected result (an 'a' character). I also > tried a Russian keyboard just to verify that it would generate a Cyrillic > character which it did. I'm running the tests against JavaFX built using the > sources in your pull request. > > French > > > KeyEvent [source = TextArea@7237703[styleClass=text-input text-area], target > = TextArea@7237703[styleClass=text-input text-area], eventType = KEY_PRESSED, > consumed = false, character = ?, text = a, code = A] > KeyEvent [source = TextArea@7237703[styleClass=text-input text-area], target > = TextArea@7237703[styleClass=text-input text-area], eventType = KEY_TYPED, > consumed = false, character = a, text = , code = UNDEFINED] > KeyEvent [source = TextArea@7237703[styleClass=text-input text-area], target > = TextArea@7237703[styleClass=text-input text-area], eventType = > KEY_RELEASED, consumed = false, character = ?, text = a, code = A] > > > U.S. English > > > KeyEvent [source = TextArea@73459ba5[styleClass=text-input text-area], target > = TextArea@73459ba5[styleClass=text-input text-area], eventType = > KEY_PRESSED, consumed = false, character = ?, text = a, code = A] > KeyEvent [source = TextArea@73459ba5[styleClass=text-input text-area], target > = TextArea@73459ba5[styleClass=text-input text-area], eventType = KEY_TYPED, > consumed = false, character = a, text = , code = UNDEFINED] > KeyEvent [source = TextArea@73459ba5[styleClass=text-input text-area], target > = TextArea@73459ba5[styleClass=text-input text-area], eventType = > KEY_RELEASED, consumed = false, character = ?, text = a, code = A] Thank you for your help! I can confirm that the latest code does indeed generate the right key event. I suspect there was something in my setup that got corrupted - I had to install the latest eclipse, found out it's pretty much unusable due to https://github.com/eclipse-jdt/eclipse.jdt.debug/issues/309 , had to revert back to 2023-06 just to discover that my macOS happily suggested that 'your application is damaged and can't be opened' and do I want to move it to Trash? So after some xattr'ing, restoring proxy settings, etc., etc. I am back online and the issue is gone. I did remove the offending characters and modified the tests, so thank you once again - your help was invaluable. ------------- PR Review Comment: https://git.openjdk.org/jfx/pull/1221#discussion_r1330746672