aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-02-01 12:41:53 +0100
committerSven Gothel <[email protected]>2013-02-01 12:41:53 +0100
commitfeebfdea24f8ac98282751824aa4d3569bb71d93 (patch)
treefb4cf4ffca10223f0eccabbe547cc1baed120405
parenta37dc59993dc6f3ad925d7ba1a2febccd8ee5e9d (diff)
Fix Animator resume() wait-condition (drawablesEmpty didn't wait for pausedIssued); Update TestGLWindows02NEWTAnimated (isPaused())
-rwxr-xr-xmake/scripts/tests.sh15
-rw-r--r--src/jogl/classes/com/jogamp/opengl/util/Animator.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java46
3 files changed, 41 insertions, 24 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index cd8d37b47..d00e3c133 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -414,9 +414,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyEventAutoRepeatAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyPressReleaseUnmaskRepeatAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
-#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
-testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodesAWT $*
+#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodesAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodeModifiersAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNEWTWindowAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersAWTCanvas $*
@@ -536,9 +534,18 @@ testawt com.jogamp.opengl.test.junit.newt.event.TestNewtKeyCodesAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $*
#linux:
-#testawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol01AWT $*
+# ATI/Linux: XCB Unknown request in queue while dequeuing
+# Most likely this is a multi-threaded client and XInitThreads has not been called
+# ../../src/xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed
+testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext01VSyncAnimNEWT $*
+# this one works - though !
+#testnoawt com.jogamp.opengl.test.junit.jogl.acore.ect.TestExclusiveContext02FPSAnimNEWT $*
+# ATI/Linux XCB Unknown request in queue while dequeuing
+# Most likely this is a multi-threaded client and XInitThreads has not been called
+# ../../src/xcb_io.c:178: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
+#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT $*
$spath/count-edt-start.sh java-run.log
diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
index 22832f6bd..673ec895e 100644
--- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java
+++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java
@@ -307,7 +307,7 @@ public class Animator extends AnimatorBase {
private final Condition waitForPausedCondition = new Condition() {
public boolean eval() {
// end waiting if stopped as well
- return isAnimating && isStartedImpl();
+ return isStartedImpl() && isAnimating;
} };
public synchronized boolean resume() {
@@ -320,6 +320,6 @@ public class Animator extends AnimatorBase {
private final Condition waitForResumeCondition = new Condition() {
public boolean eval() {
// end waiting if stopped as well
- return !drawablesEmpty && !isAnimating && isStartedImpl();
+ return isStartedImpl() && ( !drawablesEmpty && !isAnimating || drawablesEmpty && !pauseIssued ) ;
} };
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java
index 6f4ced53c..64c5e9c8d 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows02NEWTAnimated.java
@@ -132,7 +132,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
animator.remove(window);
Assert.assertEquals(false, animator.isAnimating());
- Assert.assertEquals(false, animator.isPaused());
+ Assert.assertEquals(true, animator.isPaused()); // zero drawables
Assert.assertEquals(true, animator.isStarted());
Assert.assertTrue(animator.stop());
}
@@ -142,21 +142,24 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */, true /* vsync */);
- Animator animator = new Animator(window);
+ Animator animator = new Animator();
animator.setUpdateFPSFrames(1, null);
Assert.assertTrue(animator.start());
+ Assert.assertEquals(false, animator.isAnimating()); // zero drawables
+ Assert.assertEquals(true, animator.isPaused()); // zero drawables
+ animator.add(window);
while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest) {
Thread.sleep(100);
}
destroyWindow(window);
destroyWindow(window);
Assert.assertEquals(true, animator.isAnimating());
- Assert.assertEquals(false, animator.isPaused());
Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(false, animator.isPaused());
animator.remove(window);
Assert.assertEquals(false, animator.isAnimating());
- Assert.assertEquals(false, animator.isPaused());
Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isPaused()); // zero drawables
Assert.assertTrue(animator.stop());
}
@@ -181,13 +184,13 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
Animator animator = new Animator();
animator.setUpdateFPSFrames(1, null);
Assert.assertEquals(false, animator.isStarted());
- Assert.assertEquals(false, animator.isAnimating());
- Assert.assertEquals(false, animator.isPaused());
+ Assert.assertEquals(false, animator.isAnimating()); // zero drawables
+ Assert.assertEquals(false, animator.isPaused()); // zero drawables, but not started
Assert.assertTrue(animator.start());
Assert.assertEquals(true, animator.isStarted());
- Assert.assertEquals(false, animator.isAnimating());
- Assert.assertEquals(false, animator.isPaused());
+ Assert.assertEquals(false, animator.isAnimating()); // zero drawables
+ Assert.assertEquals(true, animator.isPaused()); // zero drawables
animator.add(window1);
Assert.assertEquals(true, animator.isStarted());
@@ -214,8 +217,8 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
window2.destroy();
animator.remove(window2);
Assert.assertEquals(true, animator.isStarted());
- Assert.assertEquals(false, animator.isAnimating());
- Assert.assertEquals(false, animator.isPaused());
+ Assert.assertEquals(false, animator.isAnimating()); // zero drawables
+ Assert.assertEquals(true, animator.isPaused()); // zero drawables
Assert.assertTrue(animator.stop());
}
@@ -250,8 +253,8 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
Assert.assertTrue(animator.start());
Assert.assertEquals(true, animator.isStarted());
- Assert.assertEquals(false, animator.isAnimating());
- Assert.assertEquals(false, animator.isPaused());
+ Assert.assertEquals(false, animator.isAnimating()); // zero drawables
+ Assert.assertEquals(true, animator.isPaused()); // zero drawables
animator.add(window1);
Assert.assertEquals(true, animator.isStarted());
@@ -275,21 +278,28 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
while(animator.isAnimating() && animator.getTotalFPSDuration()<durationPerTest+durationPerTest/10) {
Thread.sleep(100);
}
- destroyWindow(window2);
- animator.remove(window2);
- Assert.assertEquals(true, animator.isStarted());
- Assert.assertEquals(false, animator.isAnimating());
+
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(true, animator.isAnimating());
Assert.assertEquals(false, animator.isPaused());
-
+
Assert.assertEquals(true, animator.pause());
+
Assert.assertEquals(true, animator.isStarted());
Assert.assertEquals(false, animator.isAnimating());
Assert.assertEquals(true, animator.isPaused());
Assert.assertEquals(true, animator.resume());
+
Assert.assertEquals(true, animator.isStarted());
- Assert.assertEquals(false, animator.isAnimating());
+ Assert.assertEquals(true, animator.isAnimating());
Assert.assertEquals(false, animator.isPaused());
+
+ destroyWindow(window2);
+ animator.remove(window2);
+ Assert.assertEquals(true, animator.isStarted());
+ Assert.assertEquals(false, animator.isAnimating()); // zero drawables
+ Assert.assertEquals(true, animator.isPaused()); // zero drawables
Assert.assertTrue(animator.stop());
Assert.assertEquals(false, animator.isStarted());