Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2017-04-21 22:06:51 +0000
committerThomas Wolf2017-04-21 22:08:06 +0000
commit79b8bb8e6896281c2796945ba46ab254abe289ec (patch)
treea726207538c05d98e92eb4e2ceb8d66c075f19d4 /org.eclipse.egit.ui.test/src
parent6c434a3a15d85258c25eec9eeb2c4fefaf8e9135 (diff)
downloadegit-79b8bb8e6896281c2796945ba46ab254abe289ec.tar.gz
egit-79b8bb8e6896281c2796945ba46ab254abe289ec.tar.xz
egit-79b8bb8e6896281c2796945ba46ab254abe289ec.zip
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] https://git.eclipse.org/r/#/c/87761/ Change-Id: Ib46803eb58ea23208cc87b34421711455bc94290 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui.test/src')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/CommandEnablementTest.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/CommandEnablementTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/CommandEnablementTest.java
index 69cbceab72..fc8a55ba0a 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/CommandEnablementTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/CommandEnablementTest.java
@@ -62,12 +62,14 @@ public class CommandEnablementTest extends AbstractGitflowHandlerTest {
private void selectPackageExplorerItem(int index) {
SWTBotTree explorerTree = TestUtil.getExplorerTree();
- explorerTree.select(index);
+ PlatformUI.getWorkbench().getDisplay()
+ .syncExec(() -> explorerTree.select(index));
}
private void selectRepositoryInView(int index) {
- SWTBotTree explorerTree = getRepositoryTree();
- explorerTree.select(index);
+ SWTBotTree repoTree = getRepositoryTree();
+ PlatformUI.getWorkbench().getDisplay()
+ .syncExec(() -> repoTree.select(index));
}
private void assertAllCommandsEnabledAndExecutable() throws Exception {

Back to the top