Skip to content

Commit 85879e7

Browse files
[Win32] Add PrtScr hotkey check for KeyEvent tests #2516
The Win32 KeyEvent tests started to fail on GitHub Actions when the environment was updated to Windows Server 2025. Using the print screen button opens the Windows snipping tools which, for yet unknown reason, now receives the focus and does not close automatically when processing further key events, like it did before and does on Windows 11 systems. To keep the tests working properly, this change excludes the PtrScr key as a system hotkey when not combined with any modifier key. Fixes #2516 Co-authored-by: Jonah Graham <[email protected]>
1 parent 65b962b commit 85879e7

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@
1818
import org.eclipse.swt.widgets.Event;
1919
import org.junit.jupiter.api.Disabled;
2020
import org.junit.jupiter.api.Test;
21-
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
2221

2322
/**
2423
* Automated Test Suite for class org.eclipse.swt.events.KeyEvent
2524
*
2625
* @see org.eclipse.swt.events.KeyEvent
2726
*/
2827
@SuppressWarnings("restriction")
29-
@DisabledIfEnvironmentVariable(named = "GITHUB_ACTIONS", matches = "true", disabledReason = "Windows Server 2025 incompatibility: https://github.com/eclipse-platform/eclipse.platform.swt/issues/2516")
3028
public class Test_org_eclipse_swt_events_KeyEvent extends KeyboardLayoutTest {
3129
// Windows layouts suitable for 'LoadKeyboardLayout()', obtained from 'GetKeyboardLayoutName()'
3230
static char[] LAYOUT_BENGALI = "00020445\0".toCharArray();
@@ -111,6 +109,11 @@ private boolean isSystemHotkey(int state, UsScan scanCode) {
111109
return true;
112110
}
113111
break;
112+
case PrtScr:
113+
switch (state) {
114+
case ____: // Opens snipping tool
115+
return true;
116+
}
114117
case F4:
115118
switch (state) {
116119
case A___: // Closes current Shell

tests/org.eclipse.swt.tests.win32/META-INF/MANIFEST.MF

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Eclipse-BundleShape: dir
99
Bundle-RequiredExecutionEnvironment: JavaSE-17
1010
Automatic-Module-Name: org.eclipse.swt.tests.win32
1111
Import-Package: org.junit.jupiter.api;version="[5.13.0,6.0.0)",
12-
org.junit.jupiter.api.condition;version="[5.13.0,6.0.0)",
1312
org.junit.jupiter.params;version="[5.13.0,6.0.0)",
1413
org.junit.jupiter.params.provider;version="[5.13.0,6.0.0)",
1514
org.junit.platform.suite.api;version="[1.13.0,2.0.0)"

0 commit comments

Comments
 (0)