Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/StagingViewTester.java7
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java20
2 files changed, 27 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/StagingViewTester.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/StagingViewTester.java
index 35db1d2cfa..e7ce95c0d2 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/StagingViewTester.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/common/StagingViewTester.java
@@ -40,6 +40,7 @@ public class StagingViewTester {
SWTBotView view = TestUtil.showView(StagingView.VIEW_ID);
TestUtil.joinJobs(org.eclipse.egit.core.JobFamilies.INDEX_DIFF_CACHE_UPDATE);
+ TestUtil.processUIEvents();
return new StagingViewTester(view);
}
@@ -61,13 +62,19 @@ public class StagingViewTester {
public void stageFile(String path) {
SWTBotTree unstagedTree = stagingView.bot().tree(0);
+
+ TestUtil.waitUntilTreeHasNodeContainsText(stagingView.bot(),
+ unstagedTree, path, 10000);
+
TestUtil.getNode(unstagedTree.getAllItems(), path).select();
JobJoiner jobJoiner = JobJoiner.startListening(
org.eclipse.egit.core.JobFamilies.INDEX_DIFF_CACHE_UPDATE, 30,
TimeUnit.SECONDS);
+
ContextMenuHelper.clickContextMenu(unstagedTree,
UIText.StagingView_StageItemMenuLabel);
+
jobJoiner.join();
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
index b71c1da62f..36b5c27886 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
@@ -167,6 +167,25 @@ public class TestUtil {
}
/**
+ * Process all queued UI events. If called from background thread, blocks
+ * until all pending events are processed in UI thread.
+ */
+ public static void processUIEvents() {
+ if (Display.getCurrent() != null) {
+ while (Display.getCurrent().readAndDispatch()) {
+ // process queued ui events
+ }
+ } else {
+ // synchronously refresh UI
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ processUIEvents();
+ }
+ });
+ }
+ }
+
+ /**
* Appends content to given file.
*
* @param file
@@ -569,6 +588,7 @@ public class TestUtil {
IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
try {
workbenchPage.showView(viewId);
+ processUIEvents();
} catch (PartInitException e) {
throw new RuntimeException("Showing view with ID " + viewId
+ " failed.", e);

Back to the top