File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32 Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -249,14 +249,20 @@ public void setUp(TestInfo testInfo) {
249
249
250
250
shell .setSize (100 , 100 );
251
251
shell .open ();
252
+ shell .forceActive ();
252
253
shell .forceFocus ();
254
+ processEvents ();
253
255
}
254
256
255
257
@ AfterEach
256
- public void tearDown () {
258
+ public void tearDown () throws InterruptedException {
257
259
if (shell != null ) {
258
260
shell .dispose ();
259
261
}
262
+ for (int i = 0 ; i < 10 ; i ++) {
263
+ processEvents ();
264
+ Thread .sleep (50 );
265
+ }
260
266
if (display != null ) {
261
267
display .dispose ();
262
268
}
@@ -360,6 +366,11 @@ protected void ensureShellFocused() {
360
366
// Note that `Shell.isFocusControl()` still returns `true` even if a
361
367
// different app is focused
362
368
if (shell .handle != OS .GetForegroundWindow ()) {
369
+ System .out .println ("handle of current shell: " + OS .GetForegroundWindow ());
370
+ System .out .println ("handle of tracked shell: " + shell .handle );
371
+ for (Shell shell : display .getShells ()) {
372
+ System .out .println (shell .handle + ": " + shell .toString ());
373
+ }
363
374
fail ("Test Shell lost focus (did you use keyboard/mouse while the test was running?)" );
364
375
}
365
376
}
@@ -501,6 +512,7 @@ protected void onKeyError(AssertionError error) {
501
512
}
502
513
503
514
protected void expectKeyEvents (String testName , Runnable runnable , Event ... expectEvents ) {
515
+ shell .forceActive ();
504
516
events .clear ();
505
517
runnable .run ();
506
518
You can’t perform that action at this time.
0 commit comments