| Summary: | DE_DE keyboard not found | ||
|---|---|---|---|
| Product: | [Technology] SWTBot | Reporter: | Carsten.Ditze |
| Component: | Keyboard Layouts | Assignee: | Project Inbox <swtbot-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | daniel.kruegler, dmigowski, Frank.Sommer, mark-roesler, mistria |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| See Also: |
https://git.eclipse.org/r/54980 https://git.eclipse.org/r/57767 |
||
| Whiteboard: | |||
| Attachments: | |||
|
Description
Carsten.Ditze
Hi Carsten, Feel free to contribute support for German keyboard: http://wiki.eclipse.org/SWTBot/Keyboard_Layouts#Creating_keyboard_layouts *** Bug 344367 has been marked as a duplicate of this bug. *** Created attachment 233021 [details]
new DE_De.keyboard file
Hi i use WinXp and SWTBot 2.1.0
I tryed to type a folder path with the awt keyboard strategy
I could not type ':' so I created a new DE_DE.keyboard File (see attachment)
I removed the following lines from the file because one of them leads to an exception
Ä shift+Ä
Ü shift+Ü
Ö shift+Ö
I debug the parse of the file and some characters are not correct displayed in the viariables view (example ß)
Thanks Mark, Could you please contribute this file using Gerrit? http://wiki.eclipse.org/SWTBot/Contributing#Provide_a_contribution_using_Gerrit Created attachment 233028 [details]
changes in the AbstractKeyboardStrategy to handle multiple modifiers (proof of concept)
to write a [ you need to press AltGr (alt+ctrl) + 8 (on a german keyboard)
I figured out that the AWTKeyboardStrategy#pressKey(KeyStroke key) has problems if the KeyStroke#getModifierKeys() return multiple modifiers.
My proof of concept solution (in the attechment) modifed AbstractKeyboardStrategy#pressKeys(KeyStroke... keys) and AbstractKeyboardStrategy#releaseKeys(KeyStroke... keys).
If the key (keyStroke) in the loop has multiple modifiers I split the modifier in seperate KeyStrokes and call
AbstractKeyboardStrategy#pressKey(KeyStroke key) or AbstractKeyboardStrategy#releaseKey(KeyStroke key) for each.
Created attachment 233031 [details] Stacktrace tray to type \ and ß the next problem i ran into is this (stacktrace in attachment 1 [details]) java.lang.IllegalArgumentException: Invalid key code at sun.awt.windows.WRobotPeer.keyPress(Native Method) if I try to type \ (backslash) alt+ctrl+ß and if I try ß (stacktrace in attachment 2 [details]) java.lang.IllegalArgumentException: no stroke available for character 'ß' at org.eclipse.swtbot.swt.finder.keyboard.KeyboardLayout.keyStrokeFor(KeyboardLayout.java:60) I could not fix this. I dont know if this is only a display thing but the ß has during the file parse phase the "i have no symboly for this" symbole � (the @ too) @Mickael Istria: I added the keys that were logical to me and the ":" thing works but I have not tested all the keys I added. if you still want I can try to contribute. I am still pretty new at git. @Mark: it would really be easier for me to review and merge it if you can make put this on Gerrit. If you can do it soon, this DE_DE keyboard could be part of upcoming 2.1.1 release. Mark, DE_DE support was included a while ago (see bug 322186 ). Do you have any hint why you can't use this layout? Also, about support for Alt-Gr or Ctrl+Alt, this issue is already reported in bug 280562 . >Also, about support for Alt-Gr or Ctrl+Alt, this issue is already reported in bug 280562 . then i wrote my comments in the wrong bug sorry >Mark, DE_DE support was included a while ago (see bug 322186 ). Do you have any hint why you can't use this layout? the current DE_DE file lacking some keys (compare with the attachment) but in general it works (note awt robot limitation). like in Bug 280562 German keyboards need AltGr+<key> or Ctrl+Alt+<key> to type all characters. - awt robot cannot use the KeyEvent.VK_ALT_GRAPH - and cannot type all characters like ß for example - and cannot deal with keystrokes that have multiple modifier. workaround for AltGr: use Ctrl+Alt+<key> instead of AltGr+<key> in the keyboard file workaround for multiple modifier: swtbot have to split up the modifier befor pressed/released by awt robot workaround for spezial characters (only an idea): use alt codes http://www.alt-codes.net/ //? = alt+(225) rob.keyPress(KeyEvent.VK_ALT); rob.keyPress(KeyEvent.VK_NUMPAD2); rob.keyRelease(KeyEvent.VK_NUMPAD2); rob.keyPress(KeyEvent.VK_NUMPAD2); rob.keyRelease(KeyEvent.VK_NUMPAD2); rob.keyPress(KeyEvent.VK_NUMPAD5); rob.keyRelease(KeyEvent.VK_NUMPAD5); rob.keyRelease(KeyEvent.VK_ALT); i am not sure about dead keys so i think you can safely put this in: _ shift+- ; shift+, : shift+. A test of our product must cover special characters, since they are allowed in general, but not for naming certain objects. I patched the org.eclipse.swtbot.swt.finder_xxx.jar with the keyboard file and a change in SWTKeyboardStrategy.java as shown in the attachments. Together with the options -Dorg.eclipse.swtbot.keyboard.layout=DE_DE and -Dorg.eclipse.swtbot.keyboard.strategy=org.eclipse.swtbot.swt.finder.keyboard.SWTKeyboardStrategy in the launch configuration things are working well for me. Created attachment 256214 [details]
Comprehensive DE_DE-keyboard file
Created attachment 256215 [details]
SWTKeyboardStrategy with splitted combined key stroke modifiers
Multiple keyboard modifiers (ALT, CTRL, ...) result currently in additional characters instead of modifying the natural key. This change works well when used together with typeText.
Can you please submit this as a Gerrit patch? https://wiki.eclipse.org/SWTBot/Contributing#Provide_a_contribution_using_Gerrit New Gerrit change created: https://git.eclipse.org/r/54980 New Gerrit change created: https://git.eclipse.org/r/57767 (In reply to Eclipse Genie from comment #16) > New Gerrit change created: https://git.eclipse.org/r/57767 I just wanted to file an issue regarding the missing key combinations for the DE_DE.layout file. The suggested additions look necessary to me except that the mapping for the backslash character is incorrect. Instead of alt+ctrl+\ it needs to be alt+ctrl+ß I would like to point out that IMO the DE_DE.layout file changes are the only ones needed as part of the issue. Please note that currently non working multi-modifier key combinations are due to bug 569685. I suggest to first fix bug 569685 as suggested there and then to add the missing DE_DE.layout combinations, because they would have no observable effects when using the normal org.eclipse.swtbot.swt.finder.keyboard.Keyboard#typeText functionality. |