aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java49
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java18
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java14
4 files changed, 64 insertions, 31 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java
index 99e81af04..dc08229c4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java
@@ -40,7 +40,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import java.awt.Frame;
-import javax.swing.SwingUtilities;
+import java.lang.reflect.InvocationTargetException;
import org.junit.Assert;
import org.junit.Assume;
@@ -78,12 +78,18 @@ public class TestSharedContextListAWT extends UITestCase {
Assert.assertNotNull(sharedDrawable);
sharedDrawable.destroy();
}
- protected Frame createFrame(int x, int y, boolean useShared) {
- return new Frame("Shared Gears AWT Test: "+x+"/"+y+" shared "+useShared);
+
+ protected void setFrameTitle(final Frame f, final boolean useShared)
+ throws InterruptedException, InvocationTargetException {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f.setTitle("Shared Gears AWT Test: "+f.getX()+"/"+f.getY()+" shared "+useShared);
+ }
+ });
}
protected GLCanvas runTestGL(final Frame frame, final Animator animator, final int x, final int y, final boolean useShared, final boolean vsync)
- throws InterruptedException
+ throws InterruptedException, InvocationTargetException
{
final GLCanvas glCanvas = new GLCanvas(caps, useShared ? sharedDrawable.getContext() : null);
Assert.assertNotNull(glCanvas);
@@ -99,26 +105,41 @@ public class TestSharedContextListAWT extends UITestCase {
animator.add(glCanvas);
- frame.setVisible(true);
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(true);
+ } } );
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true));
return glCanvas;
}
@Test
- public void test01() throws InterruptedException {
+ public void test01() throws InterruptedException, InvocationTargetException {
initShared();
-
- final Frame f1 = createFrame(0, 0, true);
- final Frame f2 = createFrame(width, 0, true);
- final Frame f3 = createFrame(0, height, false);
-
+ final Frame f1 = new Frame();
+ final Frame f2 = new Frame();
+ final Frame f3 = new Frame();
Animator animator = new Animator();
final GLCanvas glc1 = runTestGL(f1, animator, 0, 0, true, false);
- final GLCanvas glc2 = runTestGL(f2, animator, width, 0, true, false);
- final GLCanvas glc3 = runTestGL(f3, animator, 0, height, false, true);
-
+ int x0 = f1.getX();
+ int y0 = f1.getY();
+
+ final GLCanvas glc2 = runTestGL(f2, animator,
+ x0+width,
+ y0+0,
+ true, false);
+
+ final GLCanvas glc3 = runTestGL(f3, animator,
+ x0+0,
+ y0+height,
+ false, true);
+
+ setFrameTitle(f1, true);
+ setFrameTitle(f2, true);
+ setFrameTitle(f3, false);
+
animator.setUpdateFPSFrames(1, null);
animator.start();
while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java
index a37b4cc61..f8f835c3b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java
@@ -39,6 +39,7 @@ import javax.media.opengl.GLPbuffer;
import javax.media.opengl.GLProfile;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
@@ -77,9 +78,10 @@ public class TestSharedContextListNEWT extends UITestCase {
private void releaseShared() {
Assert.assertNotNull(sharedDrawable);
sharedDrawable.destroy();
+ sharedDrawable = null;
}
- protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) {
+ protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException {
GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared);
@@ -98,9 +100,9 @@ public class TestSharedContextListNEWT extends UITestCase {
animator.add(glWindow);
glWindow.setVisible(true);
-
- /** insets (if supported) are available only if window is set visible and hence is created */
- glWindow.setTopLevelPosition(x, y);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
+ glWindow.setPosition(x, y);
return glWindow;
}
@@ -111,8 +113,10 @@ public class TestSharedContextListNEWT extends UITestCase {
Animator animator = new Animator();
GLWindow f1 = runTestGL(animator, 0, 0, true, false);
InsetsImmutable insets = f1.getInsets();
- GLWindow f2 = runTestGL(animator, width+insets.getTotalWidth(), 0, true, false);
- GLWindow f3 = runTestGL(animator, 0, height+insets.getTotalHeight(), false, true);
+ GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, true, false);
+ GLWindow f3 = runTestGL(animator, f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), false, true);
animator.setUpdateFPSFrames(1, null);
animator.start();
while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
@@ -121,7 +125,7 @@ public class TestSharedContextListNEWT extends UITestCase {
animator.stop();
// here we go again: On AMD/X11 the create/destroy sequence must be the same
- // even though this is agains the chicken/egg logic here ..
+ // even though this is against the chicken/egg logic here ..
releaseShared();
f1.destroy();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java
index e78efb396..5d76702ea 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java
@@ -37,6 +37,7 @@ import javax.media.opengl.GLPbuffer;
import javax.media.opengl.GLProfile;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
@@ -77,7 +78,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
sharedDrawable.destroy();
}
- protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) {
+ protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException {
GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared);
@@ -96,9 +97,10 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
animator.add(glWindow);
glWindow.setVisible(true);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
- /** insets (if supported) are available only if window is set visible and hence is created */
- glWindow.setTopLevelPosition(x, y);
+ glWindow.setPosition(x, y);
return glWindow;
}
@@ -109,8 +111,10 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
Animator animator = new Animator();
GLWindow f1 = runTestGL(animator, 0, 0, true, false);
InsetsImmutable insets = f1.getInsets();
- GLWindow f2 = runTestGL(animator, width+insets.getTotalWidth(), 0, true, false);
- GLWindow f3 = runTestGL(animator, 0, height+insets.getTotalHeight(), false, true);
+ GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, true, false);
+ GLWindow f3 = runTestGL(animator, f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), false, true);
animator.setUpdateFPSFrames(1, null);
animator.start();
while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java
index a37c43c58..dd3e1f347 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT.java
@@ -37,6 +37,7 @@ import javax.media.opengl.GLPbuffer;
import javax.media.opengl.GLProfile;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -77,7 +78,7 @@ public class TestSharedContextVBOES2NEWT extends UITestCase {
sharedDrawable.destroy();
}
- protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) {
+ protected GLWindow runTestGL(Animator animator, int x, int y, boolean useShared, boolean vsync) throws InterruptedException {
GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("Shared Gears NEWT Test: "+x+"/"+y+" shared "+useShared);
@@ -96,9 +97,10 @@ public class TestSharedContextVBOES2NEWT extends UITestCase {
animator.add(glWindow);
glWindow.setVisible(true);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
- /** insets (if supported) are available only if window is set visible and hence is created */
- glWindow.setTopLevelPosition(x, y);
+ glWindow.setPosition(x, y);
return glWindow;
}
@@ -109,8 +111,10 @@ public class TestSharedContextVBOES2NEWT extends UITestCase {
Animator animator = new Animator();
GLWindow f1 = runTestGL(animator, 0, 0, true, false);
InsetsImmutable insets = f1.getInsets();
- GLWindow f2 = runTestGL(animator, width+insets.getTotalWidth(), 0, true, false);
- GLWindow f3 = runTestGL(animator, 0, height+insets.getTotalHeight(), false, true);
+ GLWindow f2 = runTestGL(animator, f1.getX()+width+insets.getTotalWidth(),
+ f1.getY()+0, true, false);
+ GLWindow f3 = runTestGL(animator, f1.getX()+0,
+ f1.getY()+height+insets.getTotalHeight(), false, true);
animator.setUpdateFPSFrames(1, null);
animator.start();
while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) {