summaryrefslogtreecommitdiffstats
path: root/src/junit/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/junit/com')
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java33
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java111
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java12
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java2
4 files changed, 104 insertions, 54 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
index 8f56f6f46..fef0e5ad6 100644
--- a/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
+++ b/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
@@ -256,20 +256,25 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
Screen screen = win0.getScreen();
win0.setPosition(screen.getWidth()-150, 0);
win0.addGLEventListener(new Gears());
- Animator anim0 = new Animator(win0);
- anim0.start();
+ Animator anim = new Animator(win0);
+ anim.start();
GLWindow win1 = GLWindow.create(caps);
NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(win1);
- Animator anim1 = new Animator(win1);
- anim1.start();
+ anim.add(win1);
runTestGL(newtCanvasAWT, win1);
win0.destroy();
- Assert.assertEquals(false, anim0.isAnimating());
+ Assert.assertEquals(true, anim.isAnimating());
newtCanvasAWT.destroy();
- Assert.assertEquals(false, anim1.isAnimating());
+
+ win0.invalidate();
+ Assert.assertEquals(true, anim.isAnimating());
+ win1.invalidate();
+ Assert.assertEquals(false, anim.isAnimating());
+
+ anim.stop();
System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.test01NewtCanvasAWT(): End");
}
@@ -280,6 +285,9 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
GLProfile glp = GLProfile.getDefault();
GLCapabilities caps = new GLCapabilities(glp);
+ Animator anim = new Animator();
+ anim.start();
+
/**
* Using GLCanvas _and_ NEWT side by side currently causes a deadlock
* in AWT with AMD drivers !
@@ -290,23 +298,18 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
Screen screen = win0.getScreen();
win0.setPosition(screen.getWidth()-150, 0);
win0.addGLEventListener(new Gears());
- Animator anim0 = new Animator(win0);
- anim0.start();
+ anim.add(win0);
*/
GLCanvas glCanvas = new GLCanvas(caps);
- Animator anim1 = new Animator(glCanvas);
- anim1.start();
+ anim.add(glCanvas);
runTestGL(glCanvas, glCanvas);
- Thread.sleep(100); // wait 1/10Hz to allow animation to be paused
- Assert.assertEquals(false, anim1.isAnimating());
-
/**
win0.destroy();
- Assert.assertEquals(false, anim0.isAnimating());
+ Assert.assertEquals(true, anim.isAnimating());
*/
-
+ anim.stop();
System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.test02GLCanvas(): End");
}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
index e79d57a4f..a019de72d 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
@@ -28,19 +28,11 @@
package com.jogamp.test.junit.newt;
-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.After;
-import org.junit.AfterClass;
import org.junit.Test;
-import javax.media.nativewindow.*;
import javax.media.opengl.*;
import com.jogamp.opengl.util.Animator;
@@ -131,7 +123,8 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
Thread.sleep(100);
}
destroyWindow(window);
- Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(true, animator.isAnimating());
+ animator.stop();
}
@Test
@@ -146,7 +139,8 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
}
destroyWindow(window);
destroyWindow(window);
- Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(true, animator.isAnimating());
+ animator.stop();
}
@Test
@@ -167,20 +161,44 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
Assert.assertNotNull(window2);
window2.setPosition(screen.getWidth()-width, 0);
- Animator animator1 = new Animator(window1);
- animator1.start();
- Animator animator2 = new Animator(window2);
- animator2.start();
- while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) {
+ Animator animator = new Animator();
+ Assert.assertEquals(false, animator.isStarted());
+ Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+
+ animator.start();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+
+ animator.add(window1);
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+
+ animator.add(window2);
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+
+ while(animator.isAnimating() && animator.getDuration()<durationPerTest) {
Thread.sleep(100);
}
+ window1.invalidate();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
- destroyWindow(window1);
- Assert.assertEquals(false, animator1.isAnimating());
-
- destroyWindow(window2);
- Assert.assertEquals(false, animator2.isAnimating());
+ while(animator.isAnimating() && animator.getDuration()<2*durationPerTest) {
+ Thread.sleep(100);
+ }
+ window2.invalidate();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+ animator.stop();
}
+
@Test
public void testWindowDecor03TwoWinTwoDisplays() throws InterruptedException {
GLCapabilities caps = new GLCapabilities(glp);
@@ -204,19 +222,56 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
Assert.assertNotNull(window2);
window2.setPosition(screen2.getWidth()-width, 0);
- Animator animator1 = new Animator(window1);
- animator1.start();
- Animator animator2 = new Animator(window2);
- animator2.start();
- while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) {
+ Animator animator = new Animator();
+ Assert.assertEquals(false, animator.isStarted());
+ Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+
+ animator.start();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+
+ animator.add(window1);
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+
+ animator.add(window2);
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+
+ while(animator.isAnimating() && animator.getDuration()<durationPerTest) {
Thread.sleep(100);
}
-
destroyWindow(window1);
- Assert.assertEquals(false, animator1.isAnimating());
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+ while(animator.isAnimating() && animator.getDuration()<2*durationPerTest) {
+ Thread.sleep(100);
+ }
destroyWindow(window2);
- Assert.assertEquals(false, animator2.isAnimating());
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+
+ animator.pause();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(true, animator.isPaused());
+
+ animator.resume();
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
+
+ animator.stop();
+ Assert.assertEquals(false, animator.isStarted());
+ Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(false, animator.isPaused());
}
public static void setDemoFields(GLEventListener demo, GLWindow glWindow) {
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
index 1f45c6c1d..97589ed3a 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -709,17 +709,7 @@ public class TestParenting01NEWT extends UITestCase {
}
System.err.println("durationPerTest: "+durationPerTest);
String tstname = TestParenting01NEWT.class.getName();
- org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
- tstname,
- "filtertrace=true",
- "haltOnError=false",
- "haltOnFailure=false",
- "showoutput=true",
- "outputtoformatters=true",
- "logfailedtests=true",
- "logtestlistenerevents=true",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
+ org.junit.runner.JUnitCore.main(tstname);
}
}
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
index 2c3455cb0..fd52c86a1 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
@@ -216,6 +216,8 @@ public class TestParenting01aAWT extends UITestCase {
Animator animator1 = new Animator(glWindow1);
animator1.start();
+ Assert.assertEquals(true, animator1.isStarted());
+ Assert.assertEquals(true, animator1.isAnimating());
while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) {
Thread.sleep(100);
}