diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index e56e888646c..540ec2da638 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -99,3 +99,9 @@ jobs:
path: |
${{ github.workspace }}/**/target/surefire-reports/*.xml
${{ github.workspace }}/**/hs_err_pid*.log
+ - name: Upload screenshots
+ if: always()
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+ with:
+ name: screenshots
+ path: tests/org.eclipse.swt.tests.win32/screenshots
diff --git a/binaries/pom.xml b/binaries/pom.xml
index 78946f0f1b8..3a07132562b 100644
--- a/binaries/pom.xml
+++ b/binaries/pom.xml
@@ -32,13 +32,13 @@
- org.eclipse.swt.cocoa.macosx.x86_64
+
org.eclipse.swt.win32.win32.x86_64
diff --git a/pom.xml b/pom.xml
index 89832b3b544..16d396ee011 100644
--- a/pom.xml
+++ b/pom.xml
@@ -183,15 +183,15 @@
- bundles
- binaries
+ bundles/org.eclipse.swt
+ binaries/org.eclipse.swt.win32.win32.x86_64
local-build/org.eclipse.swt.fragments.localbuild
- examples/org.eclipse.swt.examples
+
+ tests/org.eclipse.swt.tests.win32
+
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..380befe4622 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
@@ -15,9 +15,16 @@
import static org.junit.jupiter.api.Assertions.fail;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.ImageLoader;
import org.eclipse.swt.internal.win32.INPUT;
import org.eclipse.swt.internal.win32.KEYBDINPUT;
import org.eclipse.swt.internal.win32.OS;
@@ -221,9 +228,21 @@ public boolean isExtended() {
};
@BeforeEach
- public void setUp(TestInfo testInfo) {
+ public void setUp(TestInfo testInfo) throws IOException {
this.testName = testInfo.getDisplayName();
display = new Display();
+ GC gc = new GC(display);
+ Image image = new Image(display, display.getBounds().width, display.getBounds().height);
+ gc.copyArea(image, 0, 0);
+ ImageLoader loader = new ImageLoader();
+ loader.data = new ImageData[] {image.getImageData() };
+ File folder = new File("screenshots");
+ if (!folder.exists()) {
+ Files.createDirectory(folder.toPath());
+ }
+ String filePath = folder.getAbsolutePath();
+ loader.save(filePath + "/" + testName + ".png", SWT.IMAGE_PNG);
+
shell = new Shell();
Listener listener = event -> {
diff --git a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/Test_org_eclipse_swt_events_KeyEvent.java b/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/Test_org_eclipse_swt_events_KeyEvent.java
index 26c0a5406c3..063152a253b 100644
--- a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/Test_org_eclipse_swt_events_KeyEvent.java
+++ b/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/Test_org_eclipse_swt_events_KeyEvent.java
@@ -14,11 +14,12 @@
package org.eclipse.swt.tests.win32;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.internal.win32.INPUT;
+import org.eclipse.swt.internal.win32.MOUSEINPUT;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.widgets.Event;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
/**
* Automated Test Suite for class org.eclipse.swt.events.KeyEvent
@@ -26,7 +27,6 @@
* @see org.eclipse.swt.events.KeyEvent
*/
@SuppressWarnings("restriction")
-@DisabledIfEnvironmentVariable(named = "GITHUB_ACTIONS", matches = "true", disabledReason = "Windows Server 2025 incompatibility: https://github.com/eclipse-platform/eclipse.platform.swt/issues/2516")
public class Test_org_eclipse_swt_events_KeyEvent extends KeyboardLayoutTest {
// Windows layouts suitable for 'LoadKeyboardLayout()', obtained from 'GetKeyboardLayoutName()'
static char[] LAYOUT_BENGALI = "00020445\0".toCharArray();
@@ -81,6 +81,11 @@ private boolean isSystemHotkey(int state, UsScan scanCode) {
return true;
}
break;
+ case PrtScr:
+ switch (state) {
+ case ____: // Opens Snipping Tool
+ return true;
+ }
case _0:
if (state == __CS) {
// Windows bug. Ctrl+Shift+0 is assigned to switch to Japanese layout,
@@ -237,6 +242,8 @@ public void testEnglishUs_stdKeys() {
new KeyDescription(UsScan.F9, SWT.F9, '\0', '\0' ),
new KeyDescription(UsScan.F10, SWT.F10, '\0', '\0' ),
new KeyDescription(UsScan.PrtScr, SWT.PRINT_SCREEN,'\0', '\0' ),
+ // The repeated Esc here is necessary to ensure that the snipping tool started with PtrScr is closed again
+// new KeyDescription(UsScan.Esc, SWT.ESC, SWT.ESC, SWT.ESC),
new KeyDescription(UsScan.Oem102, '\\', '\\', '|' ),
new KeyDescription(UsScan.F11, SWT.F11, '\0', '\0' ),
new KeyDescription(UsScan.F12, SWT.F12, '\0', '\0' ),
@@ -298,6 +305,21 @@ public void testEnglishUs_stdKeys() {
() -> emulateScanCode(state, testKey.scanCode),
expectKeyUp(state, expectedChar, 0, testKey.keyCode)
);
+
+// for (int i = 0; i < 20; i++) {
+// processEvents();
+// try {
+// Thread.sleep(50);
+// } catch (InterruptedException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// }
+
+ // Snipping tool may open now, so click somewhere to close it and reactive the test shell
+// emulateMouseClick();
+// shell.forceActive();
+// shell.forceFocus();
continue;
}
@@ -315,6 +337,16 @@ public void testEnglishUs_stdKeys() {
});
}
+ private void emulateMouseClick() {
+ MOUSEINPUT mouseinput = new MOUSEINPUT();
+ mouseinput.dwFlags = OS.MOUSEEVENTF_LEFTUP;
+ INPUT pInputs = new INPUT ();
+ pInputs.type = OS.INPUT_MOUSE;
+ pInputs.mi = mouseinput;
+ OS.SendInput (1, pInputs, INPUT.sizeof);
+ processEvents();
+ }
+
/**
* Extensive test for English US layout
*/