--- /dev/null
- <pathelement location="build/classes"/>
+ <project>
+ <path id="master-classpath">
+ <fileset dir="lib">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="bin">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <target name="clean">
+ <delete dir="build"/>
+ <delete dir="testResults"/>
+ </target>
+
+ <target name="compile">
+ <mkdir dir="build/classes"/>
+
+ <javac sourcepath="" srcdir="src" destdir="build/classes" >
+ <include name="**/*.java"/>
+ <classpath refid="master-classpath"/>
+ </javac>
+ </target>
+
+ <target name="jar">
+ <mkdir dir="build/jar"/>
+ <jar destfile="build/jar/opencv-test.jar" basedir="build/classes">
+ <manifest>
+ <attribute name="Main-Class" value="org.opencv.test.OpenCVTestRunner"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="test">
+ <mkdir dir="testResults"/>
+ <junit printsummary="false" haltonfailure="false" haltonerror="false" showoutput="false" logfailedtests="true" maxmemory="256m">
+ <sysproperty key="java.library.path" path="${javaLibraryPath}"/>
+ <classpath refid="master-classpath"/>
+ <classpath>
++ <pathelement location="build/classes"/>
+ </classpath>
+
+ <formatter type="xml"/>
+
+ <batchtest fork="yes" todir="testResults">
+ <zipfileset src="build/jar/opencv-test.jar" includes="**/*.class" excludes="**/OpenCVTest*">
+ <exclude name="**/*$*.class"/>
+ </zipfileset>
+ </batchtest>
+ </junit>
+ </target>
+
+ <target name="buildAndTest">
+ <antcall target="compile"/>
+ <antcall target="jar"/>
+ <antcall target="test"/>
+ </target>
+ </project>
--- /dev/null
- return getTempFileName(name);
+ package org.opencv.test;
+
+ import java.io.File;
+ import java.io.IOException;
+ import junit.framework.Assert;
+
+ import org.opencv.core.Mat;
+
+ public class OpenCVTestRunner {
+ public static String LENA_PATH = "";
+ public static String CHESS_PATH = "";
+ public static String LBPCASCADE_FRONTALFACE_PATH = "";
+
+ private static String TAG = "opencv_test_java";
+
+
+ public static String getTempFileName(String extension)
+ {
+ if (!extension.startsWith("."))
+ extension = "." + extension;
+ try {
+ File tmp = File.createTempFile("OpenCV", extension);
+ String path = tmp.getAbsolutePath();
+ tmp.delete();
+ return path;
+ } catch (IOException e) {
+ Log("Failed to get temp file name. Exception is thrown: " + e);
+ }
+ return null;
+ }
+
+ static public void Log(String message) {
+ System.out.println(TAG + " :: " + message);
+ }
+
+ static public void Log(Mat m) {
+ System.out.println(TAG + " :: " + m + "\n " + m.dump());
+ }
+
+ public static String getOutputFileName(String name)
+ {
++ return getTempFileName(name);
+ }
+ }