Skip to content

Commit

Permalink
tests: get images from jar on classpath [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
RaiMan committed Mar 13, 2020
1 parent 37eab0d commit 108f9ac
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
8 changes: 8 additions & 0 deletions API/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@
</properties>

<dependencies>
<dependency>
<!-- only for local tests in the IDE -->
<!-- not available in the world -->
<groupId>com.sikulix</groupId>
<artifactId>sikuliximages</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulix2opencv</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions API/src/main/java/org/sikuli/script/support/RunTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,19 @@ public static void start(RunTime.Type type, String[] args) {
cmd.addAll(finalArgs);

RunTime.startLog(3, "*********************** leaving start");
int exitCode = ProcessRunner.runBlocking(cmd);
System.exit(exitCode);

//TODO IDE detach: needed why?
/*
if (shouldDetach()) {
ProcessRunner.detach(cmd);
System.exit(0);
} else {
int exitCode = ProcessRunner.runBlocking(cmd);
System.exit(exitCode);
}
*/
}
}

Expand Down
21 changes: 20 additions & 1 deletion API/src/test/java/org/sikuli/script/test/ElementBasicsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

package org.sikuli.script.test;

import com.sikulix.SikulixImages;
import org.junit.*;
import org.junit.runners.MethodSorters;
import org.sikuli.script.Image;
Expand Down Expand Up @@ -101,12 +102,30 @@ public void test025_PatternImageFilename() {
@Test
public void test030_ImageFileResource() {
testIntro();
String resName = "class:///images/" + testName;
String resName = "class://Image::/images/" + testName;
Image image = new Image(org.sikuli.script.Image.class, "images/" + testName);
testOutro("%s (%s)", image, resName);
assertTrue("NotValid: " + image.toString(), image.isValid());
}

@Test
public void test031_ImageFileJarResource() {
testIntro();
String resName = "class://SikulixImages::/provided/images/" + testName;
Image image = new Image(com.sikulix.SikulixImages.class, "provided/images/" + testName);
testOutro("%s (%s)", image, resName);
assertTrue("NotValid: " + image.toString(), image.isValid());
}

@Test
public void test032_ImageFileJarGetResource() {
testIntro();
String resName = "getResource::SikulixImages::/provided/images/" + testName;
Image image = new Image(SikulixImages.class.getResource("/provided/images/" + testName + ".png"));
testOutro("%s (%s)", image, resName);
assertTrue("NotValid: " + image.toString(), image.isValid());
}

@Test
public void test040_ImageFileHTTP() {
testIntro();
Expand Down
8 changes: 8 additions & 0 deletions IDE/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@
</properties>

<dependencies>
<dependency>
<!-- only for local tests in the IDE -->
<!-- not available in the world -->
<groupId>com.sikulix</groupId>
<artifactId>sikuliximages</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.sikulix</groupId>
<artifactId>sikulixapi</artifactId>
Expand Down

0 comments on commit 108f9ac

Please sign in to comment.