Skip to main content



      Home
Home » Eclipse Projects » SWTBot » How to press shortcuts containing numpad keys?
How to press shortcuts containing numpad keys? [message #1815683] Tue, 08 October 2019 07:26 Go to next message
Eclipse UserFriend
I want to test the shortcut Ctrl+Numpad_Subtract in my editor. I tried

SWTBotEditor editor = bot.editorByTitle("my.editor");
SWTBotTree tree = editor.bot().tree(0);
tree.pressShortcut(Keystrokes.CTRL, KeyStroke.getInstance("NUMPAD_SUBTRACT"));

This doesn't work. Other shortcuts without numpad keys work fine with the code above, e.g. Ctrl+M. Is this a bug or is there any trick to test shortcuts containing numpad keys?
Re: How to press shortcuts containing numpad keys? [message #1815708 is a reply to message #1815683] Tue, 08 October 2019 11:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi Matthias,

What you're doing seems correct, also equivalent to:

tree.pressShortcut(Keystrokes.CTRL, KeyStroke.getInstance(0, SWT.KEYPAD_SUBTRACT));

However, it does not work because AWTKeyboardStrategy in SWTBot is missing the natural key mapping for this key. (I assume you are using AWT keyboard)

It could be added (and, at the same time, Keystrokes.KEYPAD_SUBTRACT so you can use it directly). We should add all the other keypad keystrokes too...

Can you submit a patch, or else write a bug report?

Thanks,
Patrick
Re: How to press shortcuts containing numpad keys? [message #1815728 is a reply to message #1815708] Wed, 09 October 2019 05:16 Go to previous message
Eclipse UserFriend
Thanks for your hint, adding the missing mappings was straightforward. I am using SWT keyboard, which has the same bug.

I currently can't commit the fix because of our company policy. This policy will change hopefully before Christmas, then I will commit the fix.
Previous Topic:SWTBot with Cucumber
Next Topic:Open SWTBot test Recorder with RCP application
Goto Forum:
  


Current Time: Fri May 16 14:16:34 EDT 2025

Powered by FUDForum. Page generated in 0.04836 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top