File tree 1 file changed +14
-2
lines changed
src/test/java/net/imagej/legacy
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 46
46
import org .scijava .plugin .Plugin ;
47
47
import org .scijava .ui .UIService ;
48
48
49
- import java .awt .GraphicsEnvironment ;
49
+ import java .awt .*;
50
+ import java .lang .reflect .InvocationTargetException ;
50
51
51
52
import static org .junit .Assert .assertArrayEquals ;
52
53
import static org .junit .Assume .assumeFalse ;
@@ -110,7 +111,18 @@ private void showLegacyUI() {
110
111
// TODO: This should be improved. The test should also work in headless mode, without the legacy ui visible.
111
112
assumeFalse (GraphicsEnvironment .isHeadless ());
112
113
UIService service = context .service (UIService .class );
113
- service .showUI ();
114
+ Runnable showUI = new Runnable () {
115
+ @ Override
116
+ public void run () {
117
+ service .showUI ();
118
+ }
119
+ };
120
+ try {
121
+ EventQueue .invokeAndWait (showUI );
122
+ }
123
+ catch (InterruptedException | InvocationTargetException e ) {
124
+ throw new RuntimeException (e );
125
+ }
114
126
}
115
127
116
128
/** Simple command that outputs a {@link Dataset}. Used for testing. */
You can’t perform that action at this time.
0 commit comments