Skip to content

Commit d59d59a

Browse files
committed
Adapt Test_org_eclipse_swt_events_KeyEvent for Windows Server 2025 #2516
This is WiP to analyze the issue with the Test_org_eclipse_swt_events_KeyEvent tests on Windows Server 2025.
1 parent 35119f0 commit d59d59a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/KeyboardLayoutTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,17 @@ public void setUp(TestInfo testInfo) {
249249

250250
shell.setSize(100, 100);
251251
shell.open();
252+
shell.forceActive();
252253
shell.forceFocus();
254+
processEvents();
253255
}
254256

255257
@AfterEach
256258
public void tearDown() {
257259
if (shell != null) {
258260
shell.dispose();
259261
}
262+
processEvents();
260263
if (display != null) {
261264
display.dispose();
262265
}
@@ -360,6 +363,11 @@ protected void ensureShellFocused() {
360363
// Note that `Shell.isFocusControl()` still returns `true` even if a
361364
// different app is focused
362365
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+
}
363371
fail("Test Shell lost focus (did you use keyboard/mouse while the test was running?)");
364372
}
365373
}
@@ -501,6 +509,7 @@ protected void onKeyError(AssertionError error) {
501509
}
502510

503511
protected void expectKeyEvents(String testName, Runnable runnable, Event... expectEvents) {
512+
shell.forceActive();
504513
events.clear();
505514
runnable.run();
506515

0 commit comments

Comments
 (0)