Skip to main content
diff options
authorThomas Wolf2017-04-21 18:06:51 -0400
committerThomas Wolf2017-04-21 18:08:06 -0400
commit79b8bb8e6896281c2796945ba46ab254abe289ec (patch)
treea726207538c05d98e92eb4e2ceb8d66c075f19d4 /org.eclipse.egit.ui.test/src/org/eclipse/egit
parent6c434a3a15d85258c25eec9eeb2c4fefaf8e9135 (diff)
Fix CommandEnablementTest
SWTbot was changed today to do selections in trees differently, and also to do event notification differently.[1] This makes these tests fail consistently because evidently the command enablement has not been recomputed yet when we test it, and command.isHandled() is still false. It's a timing issue; running in the debugger the tests can be made to succeed. With [1], SWTbot sends event notifications inside an asyncExec. Previously, it sent them outside. I don't know if our test was broken all along and succeeded just by chance, or whether [1] introduced a bug in SWTbot. In any case selecting the the tree node inside a Display.syncExec() ensures that the selection is done and event notifications have occurred before the test proceeds. [1] Change-Id: Ib46803eb58ea23208cc87b34421711455bc94290 Signed-off-by: Thomas Wolf <>
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit')
1 files changed, 5 insertions, 3 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/
index 69cbceab7..fc8a55ba0 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/
@@ -62,12 +62,14 @@ public class CommandEnablementTest extends AbstractGitflowHandlerTest {
private void selectPackageExplorerItem(int index) {
SWTBotTree explorerTree = TestUtil.getExplorerTree();
+ PlatformUI.getWorkbench().getDisplay()
+ .syncExec(() ->;
private void selectRepositoryInView(int index) {
- SWTBotTree explorerTree = getRepositoryTree();
+ SWTBotTree repoTree = getRepositoryTree();
+ PlatformUI.getWorkbench().getDisplay()
+ .syncExec(() ->;
private void assertAllCommandsEnabledAndExecutable() throws Exception {

Back to the top