import static junit.framework.Assert.assertTrue;
public class OpenCVTestCase extends TestCase {
+
+ public static class TestSkipException extends RuntimeException {
+ public TestSkipException() {}
+ }
+
//change to 'true' to unblock fail on fail("Not yet implemented")
public static final boolean passNYI = true;
protected void runTest() throws Throwable {
// Do nothing if the precondition does not hold.
if (isTestCaseEnabled) {
- super.runTest();
+ try {
+ super.runTest();
+ } catch (TestSkipException ex) {
+ Log.w(TAG, "Test case \"" + this.getClass().getName() + "\" skipped!");
+ assertTrue(true);
+ }
} else {
Log.e(TAG, "Test case \"" + this.getClass().getName() + "\" disabled!");
}
}
+ public void runBare() throws Throwable {
+ Throwable exception = null;
+ try {
+ setUp();
+ } catch (TestSkipException ex) {
+ Log.w(TAG, "Test case \"" + this.getClass().getName() + "\" skipped!");
+ assertTrue(true);
+ return;
+ }
+ try {
+ runTest();
+ } catch (Throwable running) {
+ exception = running;
+ } finally {
+ try {
+ tearDown();
+ } catch (Throwable tearingDown) {
+ if (exception == null) exception = tearingDown;
+ }
+ }
+ if (exception != null) throw exception;
+ }
+
protected Mat getMat(int type, double... vals)
{
return new Mat(matSize, matSize, type, new Scalar(vals));
}
}
catch(Exception ex) {
+ if (cname.startsWith(XFEATURES2D))
+ {
+ throw new TestSkipException();
+ }
message = TAG + " :: " + "could not instantiate " + cname + "! Exception: " + ex.getMessage();
}
<target name="test">
<mkdir dir="${test.dir}"/>
- <junit printsummary="true" haltonfailure="false" haltonerror="false" showoutput="false" logfailedtests="true" maxmemory="256m">
+ <junit printsummary="true" haltonfailure="false" haltonerror="false" showoutput="true" logfailedtests="true" maxmemory="256m">
<sysproperty key="java.library.path" path="${opencv.lib.path}"/>
<env key="PATH" path="${opencv.lib.path}"/>
<classpath refid="master-classpath"/>
import org.opencv.imgcodecs.Imgcodecs;
public class OpenCVTestCase extends TestCase {
+
+ public static class TestSkipException extends RuntimeException {
+ public TestSkipException() {}
+ }
+
//change to 'true' to unblock fail on fail("Not yet implemented")
public static final boolean passNYI = true;
protected void runTest() throws Throwable {
// Do nothing if the precondition does not hold.
if (isTestCaseEnabled) {
- super.runTest();
+ try {
+ super.runTest();
+ } catch (TestSkipException ex) {
+ OpenCVTestRunner.Log(TAG + " :: " + "Test case \"" + this.getClass().getName() + "\" skipped!");
+ assertTrue(true);
+ }
} else {
OpenCVTestRunner.Log(TAG + " :: " + "Test case \"" + this.getClass().getName() + "\" disabled!");
}
}
+ public void runBare() throws Throwable {
+ Throwable exception = null;
+ try {
+ setUp();
+ } catch (TestSkipException ex) {
+ OpenCVTestRunner.Log(TAG + " :: " + "Test case \"" + this.getClass().getName() + "\" skipped!");
+ assertTrue(true);
+ return;
+ }
+ try {
+ runTest();
+ } catch (Throwable running) {
+ exception = running;
+ } finally {
+ try {
+ tearDown();
+ } catch (Throwable tearingDown) {
+ if (exception == null) exception = tearingDown;
+ }
+ }
+ if (exception != null) throw exception;
+ }
+
protected Mat getMat(int type, double... vals)
{
return new Mat(matSize, matSize, type, new Scalar(vals));
}
}
catch(Exception ex) {
+ if (cname.startsWith(XFEATURES2D))
+ {
+ throw new TestSkipException();
+ }
message = TAG + " :: " + "could not instantiate " + cname + "! Exception: " + ex.getMessage();
}