aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-10-28 01:24:58 +0200
committerSven Gothel <[email protected]>2010-10-28 01:24:58 +0200
commit99d205d0c5f047ef9a6a6e21f351abe415ed3b15 (patch)
treee4d080682d90e7dd0d865383ba581101e018a6f4 /src/junit
parente6225fce71daa90a2a2b631550ba048c2a84ff25 (diff)
Animator Fix/Cleanup
- Fix AnimatorBase: Finally using 'com.jogamp.opengl.util.AWTAnimatorImpl', wrong FQN lead to never use it, hence deadlock in case of AWT usage (AWT-EDT). - Animator - remove volatile for synced state isAnimated - new state isPaused, since shouldPause give the wrong answer for isPaused() - Cleanup wait condition for lifecycle tasks (start/stop/pause/resume) - 'AnimatorImpl' -> 'DefaultAnimatorImpl implements AnimatorBase.AnimatorImpl' - 'AWTAnimatorImpl implements AnimatorBase.AnimatorImpl', hence no derivation of a complete overwritten AnimatorImpl needed. - GLWindow.destroyActionPreLock() - Stop animator if unrecoverable, else pause only. Tests: - No explicit animator stop, hence tests implicit stop/pause by GLDrawableHelper and/or GLWindow.
Diffstat (limited to 'src/junit')
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java25
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java3
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java4
3 files changed, 20 insertions, 12 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
index e77f4f8b0..fd1a15e52 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
@@ -146,6 +146,7 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
});
frame.setContentPane(panel);
frame.setSize(512, 512);
+ frame.setLocation(0, 0);
frame.pack();
frame.setVisible(true);
@@ -216,9 +217,6 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
colorPanel.setBackground(Color.blue);
drawable.addGLEventListener(new SwingGLAction());
- Animator animator = new Animator(drawable);
- animator.start();
-
Point p0 = canvas.getLocationOnScreen();
Rectangle r0 = canvas.getBounds();
robot.mouseMove( (int) ( p0.getX() + .5 ) ,
@@ -243,7 +241,6 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
frame.pack();
}
});
- Assert.assertEquals(false, animator.isAnimating());
}
@Test
@@ -257,19 +254,22 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
win0.setSize(100,100);
win0.setVisible(true);
Screen screen = win0.getScreen();
- win0.setPosition(screen.getWidth()-150, screen.getHeight()-150);
+ win0.setPosition(screen.getWidth()-150, 0);
win0.addGLEventListener(new Gears());
Animator anim0 = new Animator(win0);
anim0.start();
- NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(GLWindow.create(caps));
-
- runTestGL(newtCanvasAWT, (GLAutoDrawable)newtCanvasAWT.getNEWTChild());
+ GLWindow win1 = GLWindow.create(caps);
+ NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(win1);
+ Animator anim1 = new Animator(win1);
+ anim1.start();
+ runTestGL(newtCanvasAWT, win1);
win0.destroy(true);
Assert.assertEquals(false, anim0.isAnimating());
newtCanvasAWT.destroy(true);
+ Assert.assertEquals(false, anim1.isAnimating());
System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.test01NewtCanvasAWT(): End");
}
@@ -284,17 +284,22 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
win0.setSize(100,100);
win0.setVisible(true);
Screen screen = win0.getScreen();
- win0.setPosition(screen.getWidth()-150, screen.getHeight()-150);
+ win0.setPosition(screen.getWidth()-150, 0);
win0.addGLEventListener(new Gears());
Animator anim0 = new Animator(win0);
anim0.start();
GLCanvas glCanvas = new GLCanvas(caps);
-
+ Animator anim1 = new Animator(glCanvas);
+ anim1.start();
runTestGL(glCanvas, glCanvas);
+ Thread.sleep(100); // wait 1/10Hz to allow animation to be paused
+ Assert.assertEquals(false, anim1.isAnimating());
+
win0.destroy(true);
Assert.assertEquals(false, anim0.isAnimating());
+
System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.test02GLCanvas(): End");
}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
index f136b2a3c..7c06879b2 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
@@ -266,8 +266,7 @@ public class TestGLWindows01NEWT extends UITestCase {
Assert.assertNotNull(window2);
Assert.assertEquals(1,Display.getActiveDisplayNumber());
-
- Assert.assertEquals(2,display.getReferenceCount());
+ Assert.assertEquals(1,display.getReferenceCount());
Assert.assertEquals(true,display.isNativeValid());
Assert.assertNotNull(display.getEDTUtil());
Assert.assertEquals(true,display.getEDTUtil().isRunning());
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
index 12cc7875a..56730d42f 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
@@ -161,9 +161,11 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
Assert.assertNotNull(screen);
GLWindow window1 = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
Assert.assertNotNull(window1);
+ window1.setPosition(0, 0);
GLWindow window2 = createWindow(screen, caps, width-10, height-10, true /* onscreen */, false /* undecorated */);
Assert.assertNotNull(window2);
+ window2.setPosition(screen.getWidth()-width, 0);
Animator animator1 = new Animator(window1);
animator1.start();
@@ -194,11 +196,13 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
Assert.assertNotNull(screen1);
GLWindow window1 = createWindow(screen1, caps, width, height, true /* onscreen */, false /* undecorated */);
Assert.assertNotNull(window1);
+ window1.setPosition(0, 0);
Screen screen2 = NewtFactory.createScreen(display2, 0); // screen 0
Assert.assertNotNull(screen2);
GLWindow window2 = createWindow(screen2, caps, width-10, height-10, true /* onscreen */, false /* undecorated */);
Assert.assertNotNull(window2);
+ window2.setPosition(screen2.getWidth()-width, 0);
Animator animator1 = new Animator(window1);
animator1.start();