读书人

SWTBot中 dialogs的处置

发布时间: 2013-11-15 22:28:15 作者: rapoo

SWTBot中 dialogs的处理

????????????? 官方问题文档地址:

???????????????????????????? http://wiki.eclipse.org/SWTBot/FAQ

????????????? 官方文档描述如下:

????????????????????????? Why do tests run on a non-UI thread?

A lot of events that SWTBot sends to the UI are blocking. SWT

public void testDiagram() throws ExecutionException {// part of test that requires UI-threadDisplay.getDefault().syncExec(new Runnable() {public void run() {try {new NewProcessCommandHandler().execute(null); // requires UI-thread since it is gonna invoke PlatformUI.getWorkbench()} catch (Exception ex) {ex.printStackTrace();}}});?// Normal SWTBot executionSWTBotEditor botEditor = bot.activeEditor();SWTBotGefEditor gmfEditor = bot.gefEditor(botEditor.getTitle());gmfEditor.activateTool("Step");gmfEditor.mouseMoveLeftClick(200, 200);}

????????

读书人网 >开源软件

热点推荐