Fix CommandEnablementTest
commit79b8bb8e6896281c2796945ba46ab254abe289ec
authorThomas Wolf <thomas.wolf@paranor.ch>
Fri, 21 Apr 2017 22:06:51 +0000 (22 00:06 +0200)
committerThomas Wolf <thomas.wolf@paranor.ch>
Fri, 21 Apr 2017 22:08:06 +0000 (22 00:08 +0200)
treea726207538c05d98e92eb4e2ceb8d66c075f19d4
parent6c434a3a15d85258c25eec9eeb2c4fefaf8e9135
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>
org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/gitflow/CommandEnablementTest.java