本文整理汇总了Java中org.eclipse.swtbot.swt.finder.SWTBot.getDisplay方法的典型用法代码示例。如果您正苦于以下问题:Java SWTBot.getDisplay方法的具体用法?Java SWTBot.getDisplay怎么用?Java SWTBot.getDisplay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swtbot.swt.finder.SWTBot
的用法示例。
在下文中一共展示了SWTBot.getDisplay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openPreferencesDialogViaEvents
import org.eclipse.swtbot.swt.finder.SWTBot; //导入方法依赖的package包/类
private static void openPreferencesDialogViaEvents(SWTBot bot) {
Display display = bot.getDisplay();
Event event = new Event();
// Move to the "Apple" menu item (it catches 0, 0)
event.type = SWT.MouseMove;
event.x = 0;
event.y = 0;
display.post(event);
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
// Click
event.type = SWT.MouseDown;
event.button = 1;
display.post(event);
bot.sleep(SwtBotTestingUtilities.EVENT_DOWN_UP_DELAY_MS);
event.type = SWT.MouseUp;
display.post(event);
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
// Right to the "Eclipse" menu item
SwtBotTestingUtilities.sendKeyDownAndUp(bot, SWT.ARROW_RIGHT, '\0');
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
// Down two to the "Preferences..." menu item
SwtBotTestingUtilities.sendKeyDownAndUp(bot, SWT.ARROW_DOWN, '\0');
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
SwtBotTestingUtilities.sendKeyDownAndUp(bot, SWT.ARROW_DOWN, '\0');
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
// Press enter
SwtBotTestingUtilities.sendKeyDownAndUp(bot, 0, '\r');
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
}
示例2: openPreferencesDialogViaEvents
import org.eclipse.swtbot.swt.finder.SWTBot; //导入方法依赖的package包/类
private static void openPreferencesDialogViaEvents(SWTBot bot) {
Display display = bot.getDisplay();
Event ev = new Event();
// Move to the "Apple" menu item (it catches 0, 0)
ev.type = SWT.MouseMove;
ev.x = 0;
ev.y = 0;
display.post(ev);
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
// Click
ev.type = SWT.MouseDown;
ev.button = 1;
display.post(ev);
bot.sleep(SwtBotUtils.EVENT_DOWN_UP_DELAY_MS);
ev.type = SWT.MouseUp;
display.post(ev);
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
// Right to the "Eclipse" menu item
SwtBotUtils.sendKeyDownAndUp(bot, SWT.ARROW_RIGHT, '\0');
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
// Down two to the "Preferences..." menu item
SwtBotUtils.sendKeyDownAndUp(bot, SWT.ARROW_DOWN, '\0');
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
SwtBotUtils.sendKeyDownAndUp(bot, SWT.ARROW_DOWN, '\0');
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
// Press enter
SwtBotUtils.sendKeyDownAndUp(bot, 0, '\r');
bot.sleep(OPEN_PREFERENCES_DIALOG_DELAY_MS);
}