Community
Participate
Working Groups
Build Identifier: ...for example, there is no way to type a # on an EN_GB keyboard layout[1], since the # ASCII code does not map to the keycode required. bug 280562 comment 1 suggests that it can be solved (for the AWTStrategy) using: addNaturalKeyMapping('#', KeyEvent.VK_NUMBER_SIGN); But there is no publicly accessible way to do this, and it shouldn't be necessary to modify SWTBot itself. It seems like a way to add these kind of mappings for the AWT and SWT keyboards is required. [1] This means you can't type '~' i.e. 'shift+#' which can cause trouble on older versions of Windows as it is used in the short DOS-friendly file names. Reproducible: Always
Tim, SWTBot does not need to be modified to support other keyboard layouts. There's a configuration file where you can provide keyboard mappings and point SWTBot to that file. See http://wiki.eclipse.org/SWTBot/Keyboard_Layouts for more information on creating these config files. I'm closing this bug as WORKSFORME. Please do not hesitate to reopen this bug if you feel that this is a mistake and the wiki page does not contain something you were looking for.
Thank you for the link to help generating a keyboard strategy. I tried to follow the instructions on the page - note I am working on Linux - and generated the to-be-attached files using KeyboardLayoutGenerator [keyboard.layout] and KeyboardLayoutFilter [keyboard.layout.filtered]. I don't know what the first one is supposed to look like, but the second looks very wrong to me. I can't check with SWTKeyboardTest or AWTKeyboardTest as they emit an exception when run (whether I run the test on the UI thread or not - it looks like you are using a 'trick' UI Thread in setup - perhaps this works on some systems?) [1]. I'll also attach the layout I produced manually... [EN_GB.keyboard]. The GB keyboard layout has a special key for '#', located to the lower left of the enter key. AIUI the keycode for this does not map to the ASCII code, so it needs to be specially defined, like certain keys are, in addNaturalKeyMapping(...). I've looked at the code and I can't see how any layout config file could possibly let me define this key, but perhaps I am mistaken? [1] Exception in thread "UI Thread" org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:3884) at org.eclipse.swt.SWT.error(SWT.java:3799) at org.eclipse.swt.SWT.error(SWT.java:3770) at org.eclipse.swt.widgets.Widget.error(Widget.java:450) at org.eclipse.swt.widgets.Shell.<init>(Shell.java:261) at org.eclipse.swt.widgets.Shell.<init>(Shell.java:252) at org.eclipse.swtbot.swt.finder.alltests.Setup.createShell(Setup.java:88) at org.eclipse.swtbot.swt.finder.alltests.Setup._setup(Setup.java:66) at org.eclipse.swtbot.swt.finder.alltests.Setup.access$0(Setup.java:64) at org.eclipse.swtbot.swt.finder.alltests.Setup$1.run(Setup.java:50)
Created attachment 174001 [details] Linux-generated layout
Created attachment 174002 [details] Linux-generated filtered layout
Created attachment 174003 [details] Manually generated keyboard
Hey Tim, do you think you could contribute these files to SWTBot using Gerrit? http://wiki.eclipse.org/SWTBot/Contributing