diff options
author | Sven Gothel <[email protected]> | 2013-06-13 12:16:42 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-06-13 12:16:42 +0200 |
commit | 44469633e779d005e1e4a811fddd2c4a40143362 (patch) | |
tree | 9596dc735ac201147628651554d9bb73ca760d16 /src | |
parent | af097fb2d5d983eb703d01f56e471a64d5d2657c (diff) |
TestRedSquareES2NEWT: Cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java index a84eacb0d..0e5842b23 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java @@ -35,6 +35,7 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; +import com.jogamp.opengl.test.junit.util.UITestCase.SnapshotGLEventListener; import com.jogamp.opengl.util.Animator; @@ -70,15 +71,19 @@ public class TestRedSquareES2NEWT extends UITestCase { protected void runTestGL(GLCapabilities caps) throws InterruptedException { System.err.println("requested: vsync "+vsync+", "+caps); - GLWindow glWindow = GLWindow.create(caps); + final GLWindow glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); - glWindow.setTitle("Gears NEWT Test"); + glWindow.setTitle(getSimpleTestName(".")); glWindow.setSize(width, height); final RedSquareES2 demo = new RedSquareES2(vsync ? 1 : -1); demo.setDoRotation(doRotate); glWindow.addGLEventListener(demo); + final SnapshotGLEventListener snap = new SnapshotGLEventListener(); + snap.setPostSNDetail(demo.getClass().getSimpleName()); + glWindow.addGLEventListener(snap); + Animator animator = new Animator(glWindow); QuitAdapter quitAdapter = new QuitAdapter(); @@ -87,18 +92,17 @@ public class TestRedSquareES2NEWT extends UITestCase { glWindow.addKeyListener(quitAdapter); glWindow.addWindowListener(quitAdapter); - final GLWindow f_glWindow = glWindow; glWindow.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { if(e.getKeyChar()=='f') { new Thread() { public void run() { - f_glWindow.setFullscreen(!f_glWindow.isFullscreen()); + glWindow.setFullscreen(!glWindow.isFullscreen()); } }.start(); } else if(e.getKeyChar()=='d') { new Thread() { public void run() { - f_glWindow.setUndecorated(!f_glWindow.isUndecorated()); + glWindow.setUndecorated(!glWindow.isUndecorated()); } }.start(); } } @@ -113,6 +117,7 @@ public class TestRedSquareES2NEWT extends UITestCase { System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); animator.setUpdateFPSFrames(60, System.err); + snap.setMakeSnapshot(); while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { Thread.sleep(100); @@ -165,9 +170,7 @@ public class TestRedSquareES2NEWT extends UITestCase { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { i++; - try { - duration = Integer.parseInt(args[i]); - } catch (Exception ex) { ex.printStackTrace(); } + duration = MiscUtils.atol(args[i], duration); } else if(args[i].equals("-es2")) { forceES2 = true; } else if(args[i].equals("-gl3")) { |