Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions binaries/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
</properties>

<modules>
<module>org.eclipse.swt.cocoa.macosx.x86_64</module>
<!--<module>org.eclipse.swt.cocoa.macosx.x86_64</module>
<module>org.eclipse.swt.cocoa.macosx.aarch64</module>
<module>org.eclipse.swt.gtk.linux.aarch64</module>
<module>org.eclipse.swt.gtk.linux.ppc64le</module>
<module>org.eclipse.swt.gtk.linux.riscv64</module>
<module>org.eclipse.swt.gtk.linux.x86_64</module>
<module>org.eclipse.swt.win32.win32.aarch64</module>
<module>org.eclipse.swt.win32.win32.aarch64</module>-->
<module>org.eclipse.swt.win32.win32.x86_64</module>
</modules>

Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@


<modules>
<module>bundles</module>
<module>binaries</module>
<module>bundles/org.eclipse.swt</module>
<module>binaries/org.eclipse.swt.win32.win32.x86_64</module>
<module>local-build/org.eclipse.swt.fragments.localbuild</module>
<module>examples/org.eclipse.swt.examples</module>
<!--<module>examples/org.eclipse.swt.examples</module>
<module>examples/org.eclipse.swt.examples.browser.demos</module>
<module>examples/org.eclipse.swt.examples.launcher</module>
<module>examples/org.eclipse.swt.examples.ole.win32</module>
<module>examples/org.eclipse.swt.examples.views</module>
<module>tests/org.eclipse.swt.tests</module>
<module>features/org.eclipse.swt.tools.feature</module>
<module>examples/org.eclipse.swt.examples.views</module>-->
<module>tests/org.eclipse.swt.tests.win32</module>
<!--<module>features/org.eclipse.swt.tools.feature</module>-->
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
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
*
* @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();
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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' ),
Expand Down Expand Up @@ -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;
}

Expand All @@ -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
*/
Expand Down
Loading