From ab1224263d85c1d603a004083d3f9f97a1266894 Mon Sep 17 00:00:00 2001 From: Heiko Klare Date: Mon, 22 Sep 2025 17:18:47 +0200 Subject: [PATCH] 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. --- .../org/eclipse/swt/tests/win32/KeyboardLayoutTest.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/KeyboardLayoutTest.java b/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/KeyboardLayoutTest.java index 92f03373964..73566f48394 100644 --- a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/KeyboardLayoutTest.java +++ b/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/KeyboardLayoutTest.java @@ -249,11 +249,14 @@ public void setUp(TestInfo testInfo) { shell.setSize(100, 100); shell.open(); + shell.forceActive(); shell.forceFocus(); + processEvents(); } @AfterEach public void tearDown() { + emulateScanCode(UsScan.Esc); if (shell != null) { shell.dispose(); } @@ -360,6 +363,11 @@ protected void ensureShellFocused() { // Note that `Shell.isFocusControl()` still returns `true` even if a // different app is focused if (shell.handle != OS.GetForegroundWindow()) { + System.out.println("handle of current shell: " + OS.GetForegroundWindow()); + System.out.println("handle of tracked shell: " + shell.handle); + for (Shell shell : display.getShells()) { + System.out.println(shell.handle + ": " + shell.toString()); + } fail("Test Shell lost focus (did you use keyboard/mouse while the test was running?)"); } } @@ -501,6 +509,7 @@ protected void onKeyError(AssertionError error) { } protected void expectKeyEvents(String testName, Runnable runnable, Event... expectEvents) { + shell.forceActive(); events.clear(); runnable.run();