Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ public static boolean hasPixelNotMatching(Image image, Color nonMatchingColor, R
return false;
}

public static String getPath(String fileName, TemporaryFolder tempFolder) {
public static Path getPath(String fileName, TemporaryFolder tempFolder) {
Path filePath = tempFolder.getRoot().toPath().resolve("image-resources").resolve(Path.of(fileName));
if (!Files.isRegularFile(filePath)) {
// Extract resource on the classpath to a temporary file to ensure it's
Expand All @@ -594,6 +594,6 @@ public static String getPath(String fileName, TemporaryFolder tempFolder) {
throw new IllegalArgumentException(e);
}
}
return filePath.toString();
return filePath;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@
import org.eclipse.swt.widgets.Text;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.FixMethodOrder;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.rules.TestName;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
Expand Down Expand Up @@ -758,16 +760,11 @@ public void test_LocationListener_LocationListener_ordered_changing () {
assertTrue("Change of locations do not fire in order", locations.get(0).equals("about:blank") && locations.get(1).contains("testWebsiteWithTitle.html"));
}

@ClassRule
public static TemporaryFolder tempFolder = new TemporaryFolder();

private String getValidUrl() {
String pluginPath = System.getProperty("PLUGIN_PATH");
testLogAppend("PLUGIN_PATH: " + pluginPath);
// When test is run via Ant, URL needs to be acquired differently. In that case the PLUGIN_PATH property is set and used.
if (pluginPath != null) {
return Path.of(pluginPath, "data/testWebsiteWithTitle.html").toUri().toString();
} else {
// used when ran from Eclipse gui.
return Test_org_eclipse_swt_browser_Browser.class.getClassLoader().getResource("testWebsiteWithTitle.html").toString();
}
return SwtTestUtil.getPath("testWebsiteWithTitle.html", tempFolder).toUri().toString();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class Test_org_eclipse_swt_graphics_Image {
public static TemporaryFolder tempFolder = new TemporaryFolder();

private static String getPath(String fileName) {
return SwtTestUtil.getPath(fileName, tempFolder);
return SwtTestUtil.getPath(fileName, tempFolder).toString();
}

ImageFileNameProvider imageFileNameProvider = zoom -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class Test_org_eclipse_swt_internal_SVGRasterizer {
public static TemporaryFolder tempFolder = new TemporaryFolder();

private static String getPath(String fileName) {
return SwtTestUtil.getPath(fileName, tempFolder);
return SwtTestUtil.getPath(fileName, tempFolder).toString();
}

@Test
Expand Down
1 change: 0 additions & 1 deletion tests/org.eclipse.swt.tests/test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<!-- sets the properties eclipse-home, and library-file -->
<property name="eclipse-home" value="${basedir}/../.."/>
<property name="plugin-name" value="org.eclipse.swt.tests"/>
<property name="plugin-path" value="${eclipse-home}/plugins/${org.eclipse.swt.tests}"/>
<property name="library-file" value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/>

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