Skip to content

Commit e63c07d

Browse files
committed
Replace remaining usage of 'PLUGIN_PATH' system-property in tests
and remove definition of therefore now unused 'plugin-path' ANT property.
1 parent 2a00032 commit e63c07d

File tree

6 files changed

+10
-14
lines changed

6 files changed

+10
-14
lines changed

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/SwtTestUtil.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ public static boolean hasPixelNotMatching(Image image, Color nonMatchingColor, R
581581
return false;
582582
}
583583

584-
public static String getPath(String fileName, TemporaryFolder tempFolder) {
584+
public static Path getPath(String fileName, TemporaryFolder tempFolder) {
585585
Path filePath = tempFolder.getRoot().toPath().resolve("image-resources").resolve(Path.of(fileName));
586586
if (!Files.isRegularFile(filePath)) {
587587
// Extract resource on the classpath to a temporary file to ensure it's
@@ -594,6 +594,6 @@ public static String getPath(String fileName, TemporaryFolder tempFolder) {
594594
throw new IllegalArgumentException(e);
595595
}
596596
}
597-
return filePath.toString();
597+
return filePath;
598598
}
599599
}

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_browser_Browser.java

+6-9
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,12 @@
8484
import org.eclipse.swt.widgets.Text;
8585
import org.junit.Before;
8686
import org.junit.BeforeClass;
87+
import org.junit.ClassRule;
8788
import org.junit.FixMethodOrder;
8889
import org.junit.Ignore;
8990
import org.junit.Rule;
9091
import org.junit.Test;
92+
import org.junit.rules.TemporaryFolder;
9193
import org.junit.rules.TestName;
9294
import org.junit.runner.RunWith;
9395
import org.junit.runners.MethodSorters;
@@ -758,16 +760,11 @@ public void test_LocationListener_LocationListener_ordered_changing () {
758760
assertTrue("Change of locations do not fire in order", locations.get(0).equals("about:blank") && locations.get(1).contains("testWebsiteWithTitle.html"));
759761
}
760762

763+
@ClassRule
764+
public static TemporaryFolder tempFolder = new TemporaryFolder();
765+
761766
private String getValidUrl() {
762-
String pluginPath = System.getProperty("PLUGIN_PATH");
763-
testLogAppend("PLUGIN_PATH: " + pluginPath);
764-
// When test is run via Ant, URL needs to be acquired differently. In that case the PLUGIN_PATH property is set and used.
765-
if (pluginPath != null) {
766-
return Path.of(pluginPath, "data/testWebsiteWithTitle.html").toUri().toString();
767-
} else {
768-
// used when ran from Eclipse gui.
769-
return Test_org_eclipse_swt_browser_Browser.class.getClassLoader().getResource("testWebsiteWithTitle.html").toString();
770-
}
767+
return SwtTestUtil.getPath("testWebsiteWithTitle.html", tempFolder).toUri().toString();
771768
}
772769

773770
@Test

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_graphics_Image.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class Test_org_eclipse_swt_graphics_Image {
6464
public static TemporaryFolder tempFolder = new TemporaryFolder();
6565

6666
private static String getPath(String fileName) {
67-
return SwtTestUtil.getPath(fileName, tempFolder);
67+
return SwtTestUtil.getPath(fileName, tempFolder).toString();
6868
}
6969

7070
ImageFileNameProvider imageFileNameProvider = zoom -> {

tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit/Test_org_eclipse_swt_internal_SVGRasterizer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class Test_org_eclipse_swt_internal_SVGRasterizer {
3737
public static TemporaryFolder tempFolder = new TemporaryFolder();
3838

3939
private static String getPath(String fileName) {
40-
return SwtTestUtil.getPath(fileName, tempFolder);
40+
return SwtTestUtil.getPath(fileName, tempFolder).toString();
4141
}
4242

4343
@Test

tests/org.eclipse.swt.tests/test.xml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<!-- sets the properties eclipse-home, and library-file -->
1010
<property name="eclipse-home" value="${basedir}/../.."/>
1111
<property name="plugin-name" value="org.eclipse.swt.tests"/>
12-
<property name="plugin-path" value="${eclipse-home}/plugins/${org.eclipse.swt.tests}"/>
1312
<property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/>
1413

1514
<!-- This target holds all initialization code that needs to be done for -->

0 commit comments

Comments
 (0)