Pergunta

I'm trying to run SWTbot test case that uses keyboard short-cuts. I could not find any reference for how to do it.

I'm pretty sure that should not be that difficult. I'll appreciate it if someone can write a small snippet.

Thanks,

Ziv

Foi útil?

Solução

What about using the pressShortcut() methood?

For TreeItem:

final SWTBotTreeItem item = ...
item.select().pressShortcut(SWT.CTRL, 'F');

For TableItem:

final SWTBotTableItem item = ...
item.select().pressShortcut(SWT.CTRL, 'F');

For EclipseEditor

((SWTBotEclipseEditor)bot.activeEditor()).pressShortcut(SWT.CTRL, '1')

From Active Shell:

 bot.activeShell().pressShortcut(
        Keystrokes.CTRL, KeyStroke.getInstance("1"));

Outras dicas

For multiple modifiers keys you can use

item.select().pressShortcut(SWT.CTRL | SWT.ALT, 'F');
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top