use of org.eclipse.egit.ui.internal.search.RepositoryMatch in project egit by eclipse.
the class CommitSearchDialogTest method openCommitTabOnSearchDialog.
@Test
public void openCommitTabOnSearchDialog() throws Exception {
bot.menu("Search").menu("Search...").click();
SWTBotShell shell = bot.shell("Search");
if (!shell.isActive()) {
shell.activate();
}
TestUtil.processUIEvents();
shell.bot().tabItem("Git Search").activate();
shell.bot().comboBox().setText(commit.name());
SWTBotButton search = shell.bot().button("Search");
assertTrue(search.isEnabled());
search.click();
TestUtil.waitForJobs(500, 5000);
TestUtil.joinJobs(InternalSearchUI.FAMILY_SEARCH);
bot.viewById(NewSearchUI.SEARCH_VIEW_ID).show();
TestUtil.processUIEvents();
final SWTBotTreeItem[] repos = bot.activeView().bot().tree().getAllItems();
assertEquals(1, repos.length);
Object repoData = UIThreadRunnable.syncExec(new Result<Object>() {
@Override
public Object run() {
return repos[0].widget.getData();
}
});
assertTrue(repoData instanceof RepositoryMatch);
assertEquals(repository.getDirectory(), ((RepositoryMatch) repoData).getRepository().getDirectory());
final SWTBotTreeItem[] commits = TestUtil.expandAndWait(repos[0]).getItems();
assertEquals(1, commits.length);
Object commitData = UIThreadRunnable.syncExec(new Result<Object>() {
@Override
public Object run() {
return commits[0].widget.getData();
}
});
assertTrue(commitData instanceof RepositoryCommit);
assertEquals(commit, ((RepositoryCommit) commitData).getRevCommit());
}
Aggregations