diff --git a/.gitignore b/.gitignore index 6391d781c3a..57348d5f8f9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ bin/ +bin_test/ *.log target/ /.project diff --git a/binaries/.classpath_win32 b/binaries/.classpath_win32 index 983fe4f4ad8..d57ed0d923c 100644 --- a/binaries/.classpath_win32 +++ b/binaries/.classpath_win32 @@ -25,5 +25,11 @@ + + + + + + diff --git a/binaries/org.eclipse.swt.win32.win32.aarch64/.project b/binaries/org.eclipse.swt.win32.win32.aarch64/.project index b90f3ddaf24..2e8dd896042 100644 --- a/binaries/org.eclipse.swt.win32.win32.aarch64/.project +++ b/binaries/org.eclipse.swt.win32.win32.aarch64/.project @@ -107,6 +107,12 @@ 2 SWT_HOST_PLUGIN/Eclipse%20SWT%20WebKit + + Eclipse SWT Tests + 2 + + PARENT-2-PROJECT_LOC/bundles/org.eclipse.swt/Eclipse%20SWT%20Tests + diff --git a/binaries/org.eclipse.swt.win32.win32.x86_64/.project b/binaries/org.eclipse.swt.win32.win32.x86_64/.project index 5814b16ab64..261704a3c73 100644 --- a/binaries/org.eclipse.swt.win32.win32.x86_64/.project +++ b/binaries/org.eclipse.swt.win32.win32.x86_64/.project @@ -107,6 +107,12 @@ 2 SWT_HOST_PLUGIN/Eclipse%20SWT%20WebKit + + Eclipse SWT Tests + 2 + + PARENT-2-PROJECT_LOC/bundles/org.eclipse.swt/Eclipse%20SWT%20Tests + diff --git a/binaries/pom.xml b/binaries/pom.xml index 3c90d81a1ce..32558b41727 100644 --- a/binaries/pom.xml +++ b/binaries/pom.xml @@ -44,6 +44,25 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + + org.apache.maven.surefire + surefire-junit-platform + 3.2.5 + + + + + execute-tests + + test + + + + org.eclipse.tycho tycho-apitools-plugin diff --git a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/internal/DefaultSWTFontRegistryTests.java b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/DefaultSWTFontRegistryTests.java similarity index 96% rename from tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/internal/DefaultSWTFontRegistryTests.java rename to bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/DefaultSWTFontRegistryTests.java index ce5ebb55c8f..ba47470c0dc 100644 --- a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/internal/DefaultSWTFontRegistryTests.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/DefaultSWTFontRegistryTests.java @@ -22,6 +22,7 @@ import org.eclipse.swt.widgets.Display; import org.junit.After; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; public class DefaultSWTFontRegistryTests { @@ -29,6 +30,11 @@ public class DefaultSWTFontRegistryTests { private Display display; private SWTFontRegistry fontRegistry; + @BeforeClass + public static void assumeIsFittingPlatform() { + PlatformSpecificExecution.assumeIsFittingPlatform(); + } + @Before public void setUp() { this.display = Display.getDefault(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/PlatformSpecificExecution.java b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/PlatformSpecificExecution.java new file mode 100644 index 00000000000..09618424704 --- /dev/null +++ b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/PlatformSpecificExecution.java @@ -0,0 +1,28 @@ +package org.eclipse.swt.internal; + +import static org.junit.Assume.assumeTrue; + +import java.net.*; + +public final class PlatformSpecificExecution { + private PlatformSpecificExecution() { + } + + public static void assumeIsFittingPlatform() { + assumeTrue("test is specific for Windows", isFittingOS()); + assumeTrue("architecture of platform does not match", isFittingArchitecture()); + } + + private static boolean isFittingOS() { + return Library.os().equals("win32"); + } + + private static boolean isFittingArchitecture() { + Class thisClass = PlatformSpecificExecution.class; + String thisClassResourcePath = thisClass.getName().replace('.', '/') + ".class"; + URL thisClassURL = thisClass.getClassLoader().getResource(thisClassResourcePath); //$NON-NLS-1$ + return thisClassURL.toString().contains(Library.arch()); + } + +} + diff --git a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/internal/ScalingSWTFontRegistryTests.java b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/ScalingSWTFontRegistryTests.java similarity index 95% rename from tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/internal/ScalingSWTFontRegistryTests.java rename to bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/ScalingSWTFontRegistryTests.java index dcaf0e709e0..062d437b5cd 100644 --- a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/internal/ScalingSWTFontRegistryTests.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Tests/win32/org/eclipse/swt/internal/ScalingSWTFontRegistryTests.java @@ -23,12 +23,18 @@ import org.eclipse.swt.widgets.Display; import org.junit.After; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; public class ScalingSWTFontRegistryTests { private static String TEST_FONT = "Helvetica"; private SWTFontRegistry fontRegistry; + @BeforeClass + public static void assumeIsFittingPlatform() { + PlatformSpecificExecution.assumeIsFittingPlatform(); + } + @Before public void setUp() { this.fontRegistry = new ScalingSWTFontRegistry(Display.getDefault()); diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/DefaultSWTFontRegistry.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/DefaultSWTFontRegistry.java index 5113b14108d..e1b031de031 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/DefaultSWTFontRegistry.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/DefaultSWTFontRegistry.java @@ -25,16 +25,13 @@ * As this class is only intended to be used internally via {@code SWTFontProvider}, * it should neither be instantiated nor referenced in a client application. * The behavior can change any time in a future release. - * - * @noreference This class is not intended to be referenced by clients. - * @noinstantiate This class is not intended to be instantiated by clients. */ -public final class DefaultSWTFontRegistry implements SWTFontRegistry { +final class DefaultSWTFontRegistry implements SWTFontRegistry { private static FontData KEY_SYSTEM_FONTS = new FontData(); private Map fontsMap = new HashMap<>(); private Device device; - public DefaultSWTFontRegistry(Device device) { + DefaultSWTFontRegistry(Device device) { this.device = device; } diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ScalingSWTFontRegistry.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ScalingSWTFontRegistry.java index 0b7a5a6f6dd..0fd4b9aec2e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ScalingSWTFontRegistry.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/internal/ScalingSWTFontRegistry.java @@ -26,11 +26,8 @@ * As this class is only intended to be used internally via {@code SWTFontProvider}, * it should neither be instantiated nor referenced in a client application. * The behavior can change any time in a future release. - * - * @noreference This class is not intended to be referenced by clients. - * @noinstantiate This class is not intended to be instantiated by clients. */ -public final class ScalingSWTFontRegistry implements SWTFontRegistry { +final class ScalingSWTFontRegistry implements SWTFontRegistry { private class ScaledFontContainer { // the first (unknown) font to be requested as scaled variant // usually it is scaled to the primary monitor zoom, but that is not guaranteed @@ -72,7 +69,7 @@ private void addScaledFont(int targetZoom, Font scaledFont) { private Map fontKeyMap = new HashMap<>(); private Device device; - public ScalingSWTFontRegistry(Device device) { + ScalingSWTFontRegistry(Device device) { this.device = device; } diff --git a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/AllWin32Tests.java b/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/AllWin32Tests.java index ec36dc88fac..ac8f13bb787 100644 --- a/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/AllWin32Tests.java +++ b/tests/org.eclipse.swt.tests.win32/JUnit Tests/org/eclipse/swt/tests/win32/AllWin32Tests.java @@ -15,20 +15,15 @@ package org.eclipse.swt.tests.win32; import org.eclipse.swt.graphics.ImageWin32Tests; -import org.eclipse.swt.internal.DefaultSWTFontRegistryTests; -import org.eclipse.swt.internal.ScalingSWTFontRegistryTests; import org.eclipse.swt.tests.win32.widgets.TestTreeColumn; import org.eclipse.swt.tests.win32.widgets.Test_org_eclipse_swt_widgets_Display; import org.junit.runner.JUnitCore; import org.junit.runner.RunWith; import org.junit.runners.Suite; - @RunWith(Suite.class) @Suite.SuiteClasses({ - DefaultSWTFontRegistryTests.class, ImageWin32Tests.class, - ScalingSWTFontRegistryTests.class, Test_org_eclipse_swt_dnd_DND.class, Test_org_eclipse_swt_events_KeyEvent.class, Test_org_eclipse_swt_widgets_Display.class,