File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32 Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -249,11 +249,14 @@ 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
258
public void tearDown () {
259
+ emulateScanCode (UsScan .Esc );
257
260
if (shell != null ) {
258
261
shell .dispose ();
259
262
}
@@ -360,6 +363,11 @@ protected void ensureShellFocused() {
360
363
// Note that `Shell.isFocusControl()` still returns `true` even if a
361
364
// different app is focused
362
365
if (shell .handle != OS .GetForegroundWindow ()) {
366
+ System .out .println ("handle of current shell: " + OS .GetForegroundWindow ());
367
+ System .out .println ("handle of tracked shell: " + shell .handle );
368
+ for (Shell shell : display .getShells ()) {
369
+ System .out .println (shell .handle + ": " + shell .toString ());
370
+ }
363
371
fail ("Test Shell lost focus (did you use keyboard/mouse while the test was running?)" );
364
372
}
365
373
}
@@ -501,6 +509,7 @@ protected void onKeyError(AssertionError error) {
501
509
}
502
510
503
511
protected void expectKeyEvents (String testName , Runnable runnable , Event ... expectEvents ) {
512
+ shell .forceActive ();
504
513
events .clear ();
505
514
runnable .run ();
506
515
You can’t perform that action at this time.
0 commit comments