summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/junit/com/jogamp/test')
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java26
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2File.java35
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2Screen.java12
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferBase.java8
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferUtil.java3
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java30
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java7
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java75
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java20
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java27
-rw-r--r--src/junit/com/jogamp/test/junit/util/MiscUtils.java12
11 files changed, 111 insertions, 144 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
index c2661ed3c..0320c50ae 100755
--- a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
@@ -32,23 +32,17 @@
package com.jogamp.test.junit.jogl.drawable;
-import java.lang.reflect.*;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.AfterClass;
-import org.junit.After;
import org.junit.Test;
import javax.media.opengl.*;
-import javax.media.nativewindow.*;
import com.jogamp.newt.*;
-import com.jogamp.newt.opengl.*;
+import java.io.IOException;
public class TestDrawable01NEWT {
static GLProfile glp;
@@ -160,26 +154,21 @@ public class TestDrawable01NEWT {
}
@Test
- public void testOnScreenDecorated() {
+ public void testOnScreenDecorated() throws InterruptedException {
createWindow(true, false, false);
- try {
- Thread.sleep(1000); // 1000 ms
- } catch (Exception e) {}
+ Thread.sleep(1000); // 1000 ms
destroyWindow();
}
@Test
- public void testOnScreenUndecorated() {
+ public void testOnScreenUndecorated() throws InterruptedException {
createWindow(true, false, true);
- try {
- Thread.sleep(1000); // 1000 ms
- } catch (Exception e) {}
+ Thread.sleep(1000); // 1000 ms
destroyWindow();
}
- public static void main(String args[]) {
+ public static void main(String args[]) throws IOException {
String tstname = TestDrawable01NEWT.class.getName();
- try {
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
tstname,
"filtertrace=true",
@@ -191,9 +180,6 @@ public class TestDrawable01NEWT {
"logtestlistenerevents=true",
"formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
"formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
- } catch (Exception e) {
- e.printStackTrace();
- }
}
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2File.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2File.java
index 4970cbbdf..de7c8d43a 100755
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2File.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2File.java
@@ -29,46 +29,45 @@
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-
package com.jogamp.test.junit.jogl.offscreen;
-import java.nio.*;
+import java.io.IOException;
import javax.media.opengl.*;
-import com.jogamp.opengl.util.texture.TextureData;
import com.jogamp.opengl.util.texture.TextureIO;
import java.io.File;
-import java.io.IOException;
-
-import javax.media.nativewindow.*;
public class ReadBuffer2File extends ReadBufferBase {
- public ReadBuffer2File (GLDrawable externalRead) {
+ public ReadBuffer2File(GLDrawable externalRead) {
super(externalRead);
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
super.dispose(drawable);
}
+ int shotNum = 0;
- int shotNum=0;
-
- void copyTextureData2File() {
- if(!readBufferUtil.isValid()) return;
+ void copyTextureData2File() throws IOException {
+ if (!readBufferUtil.isValid()) {
+ return;
+ }
- try {
- File file = File.createTempFile("shot"+shotNum+"-", ".ppm");
+ File file = File.createTempFile("shot" + shotNum + "-", ".ppm");
TextureIO.write(readBufferUtil.getTextureData(), file);
- System.out.println("Wrote: "+file.getAbsolutePath()+", ...");
+ System.out.println("Wrote: " + file.getAbsolutePath() + ", ...");
shotNum++;
- } catch (IOException ioe) { ioe.printStackTrace(); }
- readBufferUtil.rewindPixelBuffer();
+ readBufferUtil.rewindPixelBuffer();
}
+ @Override
public void display(GLAutoDrawable drawable) {
super.display(drawable);
- copyTextureData2File();
+ try {
+ copyTextureData2File();
+ } catch (IOException ex) {
+ throw new RuntimeException("can not read buffer to file", ex);
+ }
}
}
-
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2Screen.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2Screen.java
index 1166cc1e5..030a7e173 100755
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2Screen.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBuffer2Screen.java
@@ -54,6 +54,7 @@ public class ReadBuffer2Screen extends ReadBufferBase {
super(externalRead);
}
+ @Override
public void init(GLAutoDrawable drawable) {
super.init(drawable);
@@ -84,6 +85,7 @@ public class ReadBuffer2Screen extends ReadBufferBase {
gl.glClearColor(0.5f, 0.5f, 0.5f, 0.4f);
}
+ @Override
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
super.reshape(drawable, x, y, width, height);
@@ -103,24 +105,25 @@ public class ReadBuffer2Screen extends ReadBufferBase {
}
// Identity ..
- pmvMatrix.glMatrixMode(pmvMatrix.GL_MODELVIEW);
+ pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW);
pmvMatrix.glLoadIdentity();
pmvMatrix.glTranslatef(0, 0, -2.5f);
if(null!=glM) {
- glM.glMatrixMode(pmvMatrix.GL_MODELVIEW);
+ glM.glMatrixMode(PMVMatrix.GL_MODELVIEW);
glM.glLoadMatrixf(pmvMatrix.glGetMvMatrixf());
}
// Set location in front of camera
- pmvMatrix.glMatrixMode(pmvMatrix.GL_PROJECTION);
+ pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
pmvMatrix.gluPerspective(45.0f, (float)width / (float)height, 1.0f, 100.0f);
if(null!=glM) {
- glM.glMatrixMode(pmvMatrix.GL_PROJECTION);
+ glM.glMatrixMode(PMVMatrix.GL_PROJECTION);
glM.glLoadMatrixf(pmvMatrix.glGetPMatrixf());
}
}
+ @Override
public void dispose(GLAutoDrawable drawable) {
super.dispose(drawable);
}
@@ -172,6 +175,7 @@ public class ReadBuffer2Screen extends ReadBufferBase {
}
}
+ @Override
public void display(GLAutoDrawable drawable) {
super.display(drawable);
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferBase.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferBase.java
index 597b21782..4841d33e9 100755
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferBase.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferBase.java
@@ -54,13 +54,17 @@ public class ReadBufferBase implements GLEventListener {
if(glDebug) {
try {
_gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) );
- } catch (Exception e) {e.printStackTrace();}
+ } catch (Exception e) {
+ throw new RuntimeException("can not set debug pipeline", e);
+ }
}
if(glTrace) {
try {
_gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) );
- } catch (Exception e) {e.printStackTrace();}
+ } catch (Exception e) {
+ throw new RuntimeException("can not set trace pipeline", e);
+ }
}
System.out.println(_gl);
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferUtil.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferUtil.java
index d409093f4..ff3b9b58a 100755
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferUtil.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/ReadBufferUtil.java
@@ -76,10 +76,10 @@ public class ReadBufferUtil {
null /* Flusher */);
newData = true;
} catch (Exception e) {
- e.printStackTrace();
readTextureData = null;
readPixelBuffer = null;
readPixelSizeLast = 0;
+ throw new RuntimeException("can not fetch offscreen texture", e);
}
}
if(null!=readPixelBuffer) {
@@ -98,6 +98,7 @@ public class ReadBufferUtil {
}
}
+ @SuppressWarnings("deprecation")
public void dispose() {
readTexture.dispose();
readTextureData = null;
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java
index b4f1ba743..2799d72c4 100755
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java
@@ -29,7 +29,6 @@
* ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-
package com.jogamp.test.junit.jogl.offscreen;
import javax.media.opengl.*;
@@ -44,37 +43,40 @@ import javax.media.nativewindow.*;
public class Surface2File implements SurfaceUpdatedListener {
ReadBufferUtil readBufferUtil = new ReadBufferUtil();
- int shotNum=0;
+ int shotNum = 0;
public void dispose() {
readBufferUtil.dispose();
}
public void surfaceUpdated(Object updater, NativeWindow window, long when) {
- if(updater instanceof GLDrawable) {
+ if (updater instanceof GLDrawable) {
GLDrawable drawable = (GLDrawable) updater;
GLContext ctx = GLContext.getCurrent();
- if(null!=ctx && ctx.getGLDrawable()==drawable) {
+ if (null != ctx && ctx.getGLDrawable() == drawable) {
GL gl = ctx.getGL();
// FIXME glFinish() is an expensive paranoia sync, should not be necessary due to spec
- gl.glFinish();
+ gl.glFinish();
readBufferUtil.fetchOffscreenTexture(drawable, gl);
gl.glFinish();
- surface2File("shot");
+ try {
+ surface2File("shot");
+ } catch (IOException ex) {
+ throw new RuntimeException("can not write survace to file", ex);
+ }
}
}
}
- public void surface2File(String basename) {
- if(!readBufferUtil.isValid()) return;
+ public void surface2File(String basename) throws IOException {
+ if (!readBufferUtil.isValid()) {
+ return;
+ }
- try {
- File file = File.createTempFile(basename+shotNum+"-", ".ppm");
+ File file = File.createTempFile(basename + shotNum + "-", ".ppm");
TextureIO.write(readBufferUtil.getTextureData(), file);
- System.out.println("Wrote: "+file.getAbsolutePath()+", ...");
+ System.out.println("Wrote: " + file.getAbsolutePath() + ", ...");
shotNum++;
- } catch (IOException ioe) { ioe.printStackTrace(); }
- readBufferUtil.rewindPixelBuffer();
+ readBufferUtil.rewindPixelBuffer();
}
}
-
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
index e5e7c4a52..ec03bec95 100755
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
@@ -52,6 +52,7 @@ import com.jogamp.newt.opengl.*;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
+import java.io.IOException;
public class TestOffscreen01NEWT {
static GLProfile glp;
@@ -357,9 +358,8 @@ public class TestOffscreen01NEWT {
display.destroy();
}
}
- public static void main(String args[]) {
+ public static void main(String args[]) throws IOException {
String tstname = TestOffscreen01NEWT.class.getName();
- try {
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
tstname,
"filtertrace=true",
@@ -371,9 +371,6 @@ public class TestOffscreen01NEWT {
"logtestlistenerevents=true",
"formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
"formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
- } catch (Exception e) {
- e.printStackTrace();
- }
}
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java
index 7afa7b1e5..1a0553ded 100755
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java
@@ -36,7 +36,6 @@ import com.jogamp.test.junit.util.*;
import org.junit.Assert;
-import java.lang.reflect.*;
import javax.media.opengl.*;
import javax.media.nativewindow.*;
import com.jogamp.newt.*;
@@ -56,8 +55,8 @@ public class WindowUtilNEWT {
Assert.assertNotNull(demo);
Assert.assertNotNull(window);
if(debug) {
- MiscUtils.setField(demo, "glDebug", new Boolean(true));
- MiscUtils.setField(demo, "glTrace", new Boolean(true));
+ MiscUtils.setField(demo, "glDebug", true);
+ MiscUtils.setField(demo, "glTrace", true);
}
if(!MiscUtils.setField(demo, "window", window)) {
MiscUtils.setField(demo, "glWindow", glWindow);
@@ -67,52 +66,48 @@ public class WindowUtilNEWT {
public static void run(GLWindow windowOffScreen, GLEventListener demo,
GLWindow windowOnScreen, WindowListener wl, MouseListener ml,
SurfaceUpdatedListener ul, int frames, boolean snapshot, boolean debug) {
- try {
- Assert.assertNotNull(windowOffScreen);
- Assert.assertNotNull(demo);
-
- setDemoFields(demo, windowOffScreen, windowOffScreen, debug);
- windowOffScreen.addGLEventListener(demo);
-
- if ( null != windowOnScreen ) {
- if(null!=wl) {
- windowOnScreen.addWindowListener(wl);
- }
- if(null!=ml) {
- windowOnScreen.addMouseListener(ml);
- }
- windowOnScreen.setVisible(true);
- }
+ Assert.assertNotNull(windowOffScreen);
+ Assert.assertNotNull(demo);
- GLDrawable readDrawable = windowOffScreen.getContext().getGLDrawable() ;
+ setDemoFields(demo, windowOffScreen, windowOffScreen, debug);
+ windowOffScreen.addGLEventListener(demo);
- if ( null == windowOnScreen ) {
- if(snapshot) {
- Surface2File s2f = new Surface2File();
- windowOffScreen.addSurfaceUpdatedListener(s2f);
- }
- } else {
- ReadBuffer2Screen readDemo = new ReadBuffer2Screen( readDrawable ) ;
- windowOnScreen.addGLEventListener(readDemo);
+ if ( null != windowOnScreen ) {
+ if(null!=wl) {
+ windowOnScreen.addWindowListener(wl);
}
- if(null!=ul) {
- windowOffScreen.addSurfaceUpdatedListener(ul);
+ if(null!=ml) {
+ windowOnScreen.addMouseListener(ml);
}
+ windowOnScreen.setVisible(true);
+ }
- if(debug) {
- System.out.println("+++++++++++++++++++++++++++");
- System.out.println(windowOffScreen);
- System.out.println("+++++++++++++++++++++++++++");
- }
+ GLDrawable readDrawable = windowOffScreen.getContext().getGLDrawable() ;
- while ( windowOffScreen.getTotalFrames() < frames) {
- windowOffScreen.display();
+ if ( null == windowOnScreen ) {
+ if(snapshot) {
+ Surface2File s2f = new Surface2File();
+ windowOffScreen.addSurfaceUpdatedListener(s2f);
}
- windowOffScreen.removeAllSurfaceUpdatedListener();
+ } else {
+ ReadBuffer2Screen readDemo = new ReadBuffer2Screen( readDrawable ) ;
+ windowOnScreen.addGLEventListener(readDemo);
+ }
+ if(null!=ul) {
+ windowOffScreen.addSurfaceUpdatedListener(ul);
+ }
- } catch (GLException e) {
- e.printStackTrace();
+ if(debug) {
+ System.out.println("+++++++++++++++++++++++++++");
+ System.out.println(windowOffScreen);
+ System.out.println("+++++++++++++++++++++++++++");
}
+
+ while ( windowOffScreen.getTotalFrames() < frames) {
+ windowOffScreen.display();
+ }
+ windowOffScreen.removeAllSurfaceUpdatedListener();
+
}
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
index d83e064bf..563c7f88e 100755
--- a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
@@ -36,16 +36,8 @@ import com.jogamp.test.junit.jogl.util.texture.gl2.TextureGL2ListenerDraw1;
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL2ES1;
-import javax.media.opengl.GL2;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLEventListener;
import javax.media.opengl.awt.GLCanvas;
-import com.jogamp.opengl.util.texture.Texture;
-import com.jogamp.opengl.util.texture.TextureCoords;
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;
@@ -54,15 +46,9 @@ import java.awt.Color;
import java.awt.Frame;
import java.awt.GradientPaint;
import java.awt.Graphics2D;
-import java.awt.Rectangle;
import java.awt.image.BufferedImage;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import org.junit.Assert;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.Test;
public class TestTexture01AWT {
@@ -93,7 +79,7 @@ public class TestTexture01AWT {
}
@Test
- public void test1() {
+ public void test1() throws InterruptedException {
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2GL3));
GLCanvas glCanvas = new GLCanvas(caps);
frame.add(glCanvas);
@@ -107,9 +93,7 @@ public class TestTexture01AWT {
frame.setVisible(true);
animator.start();
- try {
- Thread.sleep(1000); // 1000 ms
- } catch (Exception e) {}
+ Thread.sleep(1000); // 1000 ms
animator.stop();
frame.setVisible(false);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
index 91760ae80..4969a685f 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
@@ -47,6 +47,7 @@ import org.junit.Test;
import javax.media.nativewindow.*;
import com.jogamp.newt.*;
+import java.io.IOException;
public class TestWindows01NEWT {
static int width, height;
@@ -79,7 +80,7 @@ public class TestWindows01NEWT {
// Create native OpenGL resources .. XGL/WGL/CGL ..
// equivalent to GLAutoDrawable methods: setVisible(true)
//
- caps = (Capabilities) window.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ caps = window.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
Assert.assertNotNull(caps);
Assert.assertTrue(caps.getGreenBits()>5);
Assert.assertTrue(caps.getBlueBits()>5);
@@ -102,7 +103,7 @@ public class TestWindows01NEWT {
}
@Test
- public void testWindowDecor01Simple() {
+ public void testWindowDecor01Simple() throws InterruptedException {
Capabilities caps = new Capabilities();
Assert.assertNotNull(caps);
Display display = NewtFactory.createDisplay(null); // local display
@@ -111,14 +112,12 @@ public class TestWindows01NEWT {
Assert.assertNotNull(screen);
Window window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
- try {
- Thread.sleep(1000); // 1000 ms
- } catch (Exception e) {}
+ Thread.sleep(1000); // 1000 ms
destroyWindow(display, screen, window);
}
@Test
- public void testWindowDecor02DestroyWinTwiceA() {
+ public void testWindowDecor02DestroyWinTwiceA() throws InterruptedException {
Capabilities caps = new Capabilities();
Assert.assertNotNull(caps);
Display display = NewtFactory.createDisplay(null); // local display
@@ -127,15 +126,13 @@ public class TestWindows01NEWT {
Assert.assertNotNull(screen);
Window window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
- try {
- Thread.sleep(1000); // 1000 ms
- } catch (Exception e) {}
+ Thread.sleep(1000); // 1000 ms
destroyWindow(null, null, window);
destroyWindow(display, screen, window);
}
@Test
- public void testWindowDecor03TwoWin() {
+ public void testWindowDecor03TwoWin() throws InterruptedException {
Capabilities caps = new Capabilities();
Assert.assertNotNull(caps);
Display display = NewtFactory.createDisplay(null); // local display
@@ -145,16 +142,13 @@ public class TestWindows01NEWT {
Window window1 = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
Window window2 = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
- try {
- Thread.sleep(1000); // 1000 ms
- } catch (Exception e) {}
+ Thread.sleep(1000); // 1000 ms
destroyWindow(null, null, window2);
destroyWindow(display, screen, window1);
}
- public static void main(String args[]) {
+ public static void main(String args[]) throws IOException {
String tstname = TestWindows01NEWT.class.getName();
- try {
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
tstname,
"filtertrace=true",
@@ -166,9 +160,6 @@ public class TestWindows01NEWT {
"logtestlistenerevents=true",
"formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
"formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
- } catch (Exception e) {
- e.printStackTrace();
- }
}
}
diff --git a/src/junit/com/jogamp/test/junit/util/MiscUtils.java b/src/junit/com/jogamp/test/junit/util/MiscUtils.java
index 5114c3a84..8e53d9255 100644
--- a/src/junit/com/jogamp/test/junit/util/MiscUtils.java
+++ b/src/junit/com/jogamp/test/junit/util/MiscUtils.java
@@ -35,10 +35,14 @@ package com.jogamp.test.junit.util;
import java.lang.reflect.*;
public class MiscUtils {
+ @Deprecated
public static int str2int(String str, int def) {
try {
return Integer.parseInt(str);
- } catch (Exception ex) { ex.printStackTrace(); }
+ } catch (Exception ex) {
+ // FIXME
+ ex.printStackTrace();
+ }
return def;
}
@@ -51,10 +55,10 @@ public class MiscUtils {
} else {
System.out.println(instance.getClass()+" '"+fieldName+"' field not assignable with "+value.getClass()+", it's a: "+f.getType());
}
+ } catch (IllegalAccessException ex) {
+ throw new RuntimeException(ex);
} catch (NoSuchFieldException nsfe) {
- System.out.println(instance.getClass()+" has no '"+fieldName+"' field");
- } catch (Throwable t) {
- t.printStackTrace();
+ throw new RuntimeException(instance.getClass()+" has no '"+fieldName+"' field", nsfe);
}
return false;
}