aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwwalker <[email protected]>2011-01-04 15:24:14 -0600
committerwwalker <[email protected]>2011-01-04 15:24:14 -0600
commit8bec14de2d0160a253518da8a57b93c0e62af986 (patch)
tree4a3c2abd959794439682c3efc8768a3e79513557
parentb50e75044196aa1f11e7b367b457163553ea373f (diff)
Fixed to work properly in the Ant junit.run.* tasks
Fixed the texture load to come from a resource stream so it'll work when run from inside a JAR by the junit.run.* Ant tasks. Also modified the test JAR build step to include any resource files in the test source code directory.
-rw-r--r--make/build-test.xml9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/texture/TestGrayTextureFromFileAWTBug417.java17
2 files changed, 15 insertions, 11 deletions
diff --git a/make/build-test.xml b/make/build-test.xml
index 40bdcf7a3..ae545df63 100644
--- a/make/build-test.xml
+++ b/make/build-test.xml
@@ -87,8 +87,15 @@
<fileset file="${jogl.test.jar}" />
</delete>
<jar destfile="${jogl.test.jar}" filesonly="true">
+ <!-- get all class files, but skip any resource files that external tools
+ might have copied into the class directory (otherwise, it's possible
+ to get the same resource file twice in the jar) -->
<fileset dir="${classes}">
- <include name="${java.part.test}"/>
+ <include name="${java.part.test}/*.class"/>
+ </fileset>
+ <!-- include any resource files that tests may requre -->
+ <fileset dir="${src.test}">
+ <exclude name="**/*.java"/>
</fileset>
</jar>
</target>
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestGrayTextureFromFileAWTBug417.java b/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestGrayTextureFromFileAWTBug417.java
index 8b47d5598..82cd91718 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestGrayTextureFromFileAWTBug417.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/texture/TestGrayTextureFromFileAWTBug417.java
@@ -32,22 +32,19 @@ import com.jogamp.opengl.test.junit.jogl.util.texture.gl2.TextureGL2ListenerDraw
import com.jogamp.opengl.test.junit.util.UITestCase;
-import javax.imageio.ImageIO;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLException;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.awt.GLCanvas;
-import com.jogamp.opengl.util.texture.TextureData;
import com.jogamp.opengl.util.texture.TextureIO;
-import com.jogamp.opengl.util.texture.awt.AWTTextureIO;
import com.jogamp.opengl.util.Animator;
import java.awt.Frame;
-import java.awt.image.BufferedImage;
-import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
+
import org.junit.Assert;
import org.junit.After;
import org.junit.Assume;
@@ -64,7 +61,7 @@ import org.junit.Test;
public class TestGrayTextureFromFileAWTBug417 extends UITestCase {
static GLProfile glp;
static GLCapabilities caps;
- File textureFile;
+ InputStream textureStream;
@BeforeClass
public static void initClass() {
@@ -77,13 +74,13 @@ public class TestGrayTextureFromFileAWTBug417 extends UITestCase {
@Before
public void initTest() {
- textureFile = new File( "src/test/com/jogamp/opengl/test/junit/jogl/texture/grayscale_texture.png" );
- Assert.assertNotNull(textureFile);
+ textureStream = TestGrayTextureFromFileAWTBug417.class.getResourceAsStream( "grayscale_texture.png" );
+ Assert.assertNotNull(textureStream);
}
@After
public void cleanupTest() {
- textureFile=null;
+ textureStream=null;
}
@Test
@@ -101,7 +98,7 @@ public class TestGrayTextureFromFileAWTBug417 extends UITestCase {
@Override
public void init(GLAutoDrawable drawable) {
try {
- setTexture( TextureIO.newTexture( textureFile, true ) );
+ setTexture( TextureIO.newTexture( textureStream, true, TextureIO.PNG ) );
}
catch(GLException glexception) {
glexception.printStackTrace();