Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 11:26 Go to next message
Matthias Bank is currently offline Matthias BankFriend
Messages: 6
Registered: September 2019
Junior Member
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 15:04 Go to previous messageGo to next message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 84
Registered: July 2009
Member
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 09:16 Go to previous message
Matthias Bank is currently offline Matthias BankFriend
Messages: 6
Registered: September 2019
Junior Member
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: Wed Apr 24 21:11:55 GMT 2024

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

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

Back to the top