aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-13 08:15:21 +0200
committerSven Gothel <[email protected]>2013-04-13 08:15:21 +0200
commit9d78ea65a6bf1064887bc7524c01a689a1fc2a5c (patch)
treefdd85fcce8cc5d55898b93ee13a25779b4cda215 /src/test
parent5606dd12f8086b506f33030072af5095a5871f9c (diff)
NEWT/AWT: Fix 'AWT driver' to work w/ OSX CALayer ; WindowImpl: 'Object getWrappedWindow()' -> 'NativeSurface getWrappedSurface()'
WindowImpl: 'Object getWrappedWindow()' -> 'NativeSurface getWrappedSurface()' - AWT driver itself instantiates the JAWTWindow for eager initialization at createNative(). Fix 'AWT driver' to work w/ OSX CALayer - See above - size reconfig changed to ease OSX CALayer, i.e. set frame's size if already visible reducing CALayer artefacts.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java68
2 files changed, 43 insertions, 27 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
index 5e523c780..9bbbbce05 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
@@ -270,7 +270,7 @@ public class GearsES2 implements GLEventListener {
public void display(GLAutoDrawable drawable) {
GLAnimatorControl anim = drawable.getAnimator();
if( verbose && ( null == anim || !anim.isAnimating() ) ) {
- System.err.println(Thread.currentThread()+" GearsES2.display"+drawable.getWidth()+"x"+drawable.getHeight()+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(drawable.getHandle()));
+ System.err.println(Thread.currentThread()+" GearsES2.display "+drawable.getWidth()+"x"+drawable.getHeight()+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(drawable.getHandle()));
}
// Turn the gears' teeth
if(doRotate) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java
index cc20cc27e..0b907d5ee 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java
@@ -34,6 +34,7 @@ import javax.media.opengl.*;
import com.jogamp.opengl.util.Animator;
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.jogl.demos.es2.GearsES2;
@@ -49,6 +50,9 @@ import org.junit.Test;
public class TestGearsNewtAWTWrapper extends UITestCase {
static GLProfile glp;
static int width, height;
+ static boolean useAnimator = true;
+ static boolean doResizeTest = true;
+ static long duration = 500; // ms
@BeforeClass
public static void initClass() {
@@ -73,39 +77,50 @@ public class TestGearsNewtAWTWrapper extends UITestCase {
glWindow.addGLEventListener(new GearsES2(1));
- Animator animator = new Animator(glWindow);
+ Animator animator = useAnimator ? new Animator(glWindow) : null;
QuitAdapter quitAdapter = new QuitAdapter();
glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
+ if( useAnimator ) {
+ animator.start();
+ }
+
int div = 3;
glWindow.setSize(width/div, height/div);
glWindow.setVisible(true);
- glWindow.display();
- Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getWidth()+"x"+glWindow.getHeight(),
- AWTRobotUtil.waitForSize(glWindow, width/div, height/div));
-
- div = 2;
- glWindow.setSize(width/div, height/div);
- glWindow.display();
- Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getWidth()+"x"+glWindow.getHeight(),
- AWTRobotUtil.waitForSize(glWindow, width/div, height/div));
-
- div = 1;
- glWindow.setSize(width/div, height/div);
- glWindow.display();
- Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getWidth()+"x"+glWindow.getHeight(),
- AWTRobotUtil.waitForSize(glWindow, width/div, height/div));
-
- animator.setUpdateFPSFrames(1, null);
- animator.start();
+ if( doResizeTest ) {
+ glWindow.display();
+ Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getWidth()+"x"+glWindow.getHeight(),
+ AWTRobotUtil.waitForSize(glWindow, width/div, height/div));
+ Thread.sleep(600);
+
+ div = 2;
+ glWindow.setSize(width/div, height/div);
+ glWindow.display();
+ Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getWidth()+"x"+glWindow.getHeight(),
+ AWTRobotUtil.waitForSize(glWindow, width/div, height/div));
+ Thread.sleep(600);
+
+ div = 1;
+ glWindow.setSize(width/div, height/div);
+ glWindow.display();
+ Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getWidth()+"x"+glWindow.getHeight(),
+ AWTRobotUtil.waitForSize(glWindow, width/div, height/div));
+ Thread.sleep(600);
+ }
- while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
+ final long t0 = System.currentTimeMillis();
+ long t1 = t0;
+ while(!quitAdapter.shouldQuit() && t1-t0<duration) {
Thread.sleep(100);
+ t1 = System.currentTimeMillis();
}
- animator.stop();
+ if( useAnimator ) {
+ animator.stop();
+ }
glWindow.destroy();
}
@@ -115,17 +130,18 @@ public class TestGearsNewtAWTWrapper extends UITestCase {
runTestGL(caps);
}
- static long duration = 500; // ms
-
public static void main(String args[]) {
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("-noanim")) {
+ useAnimator = false;
+ } else if(args[i].equals("-noresize")) {
+ doResizeTest = false;
}
}
+ System.err.println("useAnimator "+useAnimator);
org.junit.runner.JUnitCore.main(TestGearsNewtAWTWrapper.class.getName());
}
}