diff options
-rw-r--r-- | make/build-test.xml | 13 | ||||
-rwxr-xr-x | make/build.xml | 2 | ||||
-rw-r--r-- | src/test/com/jogamp/openal/test/junit/ALTest.java | 5 | ||||
-rw-r--r-- | src/test/com/jogamp/openal/test/manual/OpenALTest.java | 5 | ||||
-rw-r--r-- | src/test/com/jogamp/openal/test/manual/Sound3DTest.java | 2 | ||||
-rw-r--r-- | src/test/com/jogamp/openal/test/resources/ResourceLocation.java | 26 |
6 files changed, 42 insertions, 11 deletions
diff --git a/make/build-test.xml b/make/build-test.xml index e543a1c..beead31 100644 --- a/make/build-test.xml +++ b/make/build-test.xml @@ -60,7 +60,7 @@ <property name="java.dir.manual" value="${java.dir.test}/manual"/> <property name="obj.all.paths" value="${gluegen.root}/build/obj${path.separator}${obj}"/> - <property name="classpath.all" value="${gluegen.root}/build/gluegen-rt.jar${path.separator}${build}/joal.jar${path.separator}${classes}${path.separator}${junit.path}"/> + <property name="classpath.all" value="${gluegen.root}/build/gluegen-rt.jar${path.separator}${build}/joal.jar${path.separator}${build}/joal-test.jar${path.separator}${junit.path}"/> <property name="batchtest.timeout" value="1800000"/> <!-- 30 min --> </target> @@ -71,6 +71,11 @@ <copy todir="${classes}"> <fileset dir="${src.test}" includes="**/*.wav"/> </copy> + <jar destfile="${build}/joal-test.jar"> + <fileset dir="${classes}"> + <include name="**" /> + </fileset> + </jar> </target> <target name="clean"> @@ -84,9 +89,10 @@ <junit forkmode="once" showoutput="true" fork="true" includeAntRuntime="true"> <env key="${system.env.library.path}" path="${obj.all.paths}"/> <jvmarg value="-Djava.library.path=${obj.all.paths}"/> + <!-- <jvmarg value="-Djogamp.debug.NativeLibrary=true"/> <jvmarg value="-Djogamp.debug.NativeLibrary.Lookup=true"/> - <jvmarg value="-Djogamp.debug.ProcAddressHelper=true"/> + <jvmarg value="-Djogamp.debug.ProcAddressHelper=true"/> --> <batchtest todir="${results.test}"> <fileset dir="${classes}"> <include name="${java.dir.junit}/**/*Test*"/> @@ -129,9 +135,10 @@ <env key="${system.env.library.path}" path="${obj.all.paths}"/> <env key="CLASSPATH" value="${classpath.all}"/> <arg value="-Djava.library.path=${obj.all.paths}"/> + <!-- <arg line="-Djogamp.debug.NativeLibrary=true"/> <arg line="-Djogamp.debug.NativeLibrary.Lookup=true"/> - <arg line="-Djogamp.debug.ProcAddressHelper=true"/> + <arg line="-Djogamp.debug.ProcAddressHelper=true"/> --> <srcfile/> <mappedresources> <fileset dir="${classes}" includes="${test.class.path}"/> diff --git a/make/build.xml b/make/build.xml index fe020f2..79e8b33 100755 --- a/make/build.xml +++ b/make/build.xml @@ -501,7 +501,7 @@ <antcall target="c.rename.joal.lib.mingw" inheritRefs="true" /> <antcall target="c.rename.joal.lib.macosx" inheritRefs="true" /> <!-- Create Java Web Start jar file from built file --> - <jar destfile="../${rootrel.build}/joal-natives-${os.and.arch}.jar"> + <jar destfile="${build}/joal-natives-${os.and.arch}.jar"> <fileset dir="../${rootrel.build}/obj"> <include name="*joal.${native.library.suffix}" /> </fileset> diff --git a/src/test/com/jogamp/openal/test/junit/ALTest.java b/src/test/com/jogamp/openal/test/junit/ALTest.java index 6a465f2..33d7b0d 100644 --- a/src/test/com/jogamp/openal/test/junit/ALTest.java +++ b/src/test/com/jogamp/openal/test/junit/ALTest.java @@ -382,10 +382,7 @@ public class ALTest { } private WAVData loadTestWAV() throws IOException, UnsupportedAudioFileException { - InputStream resource = ResourceLocation.class.getResourceAsStream(TEST_FILE); - if(resource == null) { - throw new FileNotFoundException(TEST_FILE+" not found"); - } + InputStream resource = ResourceLocation.getInputStream(TEST_FILE, true); return WAVLoader.loadFromStream(resource); } } diff --git a/src/test/com/jogamp/openal/test/manual/OpenALTest.java b/src/test/com/jogamp/openal/test/manual/OpenALTest.java index 98843c7..abd335c 100644 --- a/src/test/com/jogamp/openal/test/manual/OpenALTest.java +++ b/src/test/com/jogamp/openal/test/manual/OpenALTest.java @@ -42,7 +42,9 @@ import java.io.IOException; import java.nio.*; import com.jogamp.openal.eax.*; +import com.jogamp.openal.test.resources.ResourceLocation; import com.jogamp.openal.util.*; +import java.io.InputStream; import javax.sound.sampled.UnsupportedAudioFileException; /** @@ -50,7 +52,6 @@ import javax.sound.sampled.UnsupportedAudioFileException; * @author Michael Bien */ public class OpenALTest { - public static void main(String[] args) throws InterruptedException, UnsupportedAudioFileException, IOException { ALC alc = ALFactory.getALC(); ALCdevice device = alc.alcOpenDevice(null); @@ -76,7 +77,7 @@ public class OpenALTest { int[] buffers = new int[1]; al.alGenBuffers(1, buffers, 0); - WAVData wd = WAVLoader.loadFromStream(OpenALTest.class.getResourceAsStream("lewiscarroll.wav")); + WAVData wd = WAVLoader.loadFromStream(ResourceLocation.getTestStream0()); al.alBufferData(buffers[0], wd.format, wd.data, wd.size, wd.freq); int[] sources = new int[1]; diff --git a/src/test/com/jogamp/openal/test/manual/Sound3DTest.java b/src/test/com/jogamp/openal/test/manual/Sound3DTest.java index d91f0ec..55bf28a 100644 --- a/src/test/com/jogamp/openal/test/manual/Sound3DTest.java +++ b/src/test/com/jogamp/openal/test/manual/Sound3DTest.java @@ -63,7 +63,7 @@ public class Sound3DTest { listener.setPosition(0, 0, 0); // load a source and play it - Source source1 = AudioSystem3D.loadSource(ResourceLocation.class.getResourceAsStream("lewiscarroll.wav")); + Source source1 = AudioSystem3D.loadSource(ResourceLocation.getTestStream0()); source1.setPosition(0, 0, 0); source1.setLooping(true); source1.play(); diff --git a/src/test/com/jogamp/openal/test/resources/ResourceLocation.java b/src/test/com/jogamp/openal/test/resources/ResourceLocation.java index 74f1356..f223644 100644 --- a/src/test/com/jogamp/openal/test/resources/ResourceLocation.java +++ b/src/test/com/jogamp/openal/test/resources/ResourceLocation.java @@ -1,6 +1,32 @@ package com.jogamp.openal.test.resources; +import java.io.InputStream; + /** just a tag to locate the resources */ public class ResourceLocation { + public static final String lewiscarrol_wav = "lewiscarroll.wav"; + + static final ResourceLocation rl; + + static { + rl = new ResourceLocation(); + + } + + public static InputStream getTestStream0() { + return getInputStream(lewiscarrol_wav, true); + } + + public static InputStream getInputStream(String fileName) { + return getInputStream(fileName, false); + } + + public static InputStream getInputStream(String fileName, boolean throwException) { + InputStream stream = rl.getClass().getResourceAsStream(fileName); + if(throwException && null == stream) { + throw new RuntimeException("File '"+fileName+"' not found"); + } + return stream; + } } |