aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit
diff options
context:
space:
mode:
Diffstat (limited to 'src/junit')
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java5
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java21
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java8
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java83
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java258
6 files changed, 307 insertions, 70 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 2f4a95646..4de0f8f45 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
@@ -39,6 +39,7 @@ import javax.media.opengl.GLCapabilities;
import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.newt.Screen;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.awt.NewtCanvasAWT;
@@ -254,6 +255,8 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
GLWindow win0 = GLWindow.create(caps);
win0.setSize(100,100);
win0.setVisible(true);
+ Screen screen = win0.getScreen();
+ win0.setPosition(screen.getWidth()-150, screen.getHeight()-150);
win0.addGLEventListener(new Gears());
Animator anim0 = new Animator(win0);
anim0.start();
@@ -277,6 +280,8 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
GLWindow win0 = GLWindow.create(caps);
win0.setSize(100,100);
win0.setVisible(true);
+ Screen screen = win0.getScreen();
+ win0.setPosition(screen.getWidth()-150, screen.getHeight()-150);
win0.addGLEventListener(new Gears());
Animator anim0 = new Animator(win0);
anim0.start();
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
index 3a3823d96..e8d07682c 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
@@ -22,10 +22,19 @@ public class Gears implements GLEventListener {
private float view_rotx = 20.0f, view_roty = 30.0f, view_rotz = 0.0f;
private int gear1, gear2, gear3;
private float angle = 0.0f;
+ private int swapInterval;
private int prevMouseX, prevMouseY;
private boolean mouseRButtonDown = false;
+ public Gears(int swapInterval) {
+ this.swapInterval = swapInterval;
+ }
+
+ public Gears() {
+ this.swapInterval = 1;
+ }
+
public static void main(String[] args) {
// set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example
// <application-desc main-class="demos.j2d.TextCube"/>
@@ -69,12 +78,12 @@ public class Gears implements GLEventListener {
GL2 gl = drawable.getGL().getGL2();
- gl.setSwapInterval(1);
+ gl.setSwapInterval(swapInterval);
float pos[] = { 5.0f, 5.0f, 10.0f, 0.0f };
- float red[] = { 0.8f, 0.1f, 0.0f, 1.0f };
- float green[] = { 0.0f, 0.8f, 0.2f, 1.0f };
- float blue[] = { 0.2f, 0.2f, 1.0f, 1.0f };
+ float red[] = { 0.8f, 0.1f, 0.0f, 0.7f };
+ float green[] = { 0.0f, 0.8f, 0.2f, 0.7f };
+ float blue[] = { 0.2f, 0.2f, 1.0f, 0.7f };
gl.glLightfv(GL2.GL_LIGHT0, GL2.GL_POSITION, pos, 0);
gl.glEnable(GL2.GL_CULL_FACE);
@@ -116,7 +125,7 @@ public class Gears implements GLEventListener {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- System.err.println("Gears: Reshape");
+ System.err.println("Gears: Reshape "+x+"/"+y+" "+width+"x"+height);
GL2 gl = drawable.getGL().getGL2();
float h = (float)height / (float)width;
@@ -141,6 +150,8 @@ public class Gears implements GLEventListener {
// Get the GL corresponding to the drawable we are animating
GL2 gl = drawable.getGL().getGL2();
+ gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+
// Special handling for the case where the GLJPanel is translucent
// and wants to be composited with other Java 2D content
if ((drawable instanceof GLJPanel) &&
diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
index 072ebafd6..2a7c32204 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
@@ -115,7 +115,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase {
Assert.assertEquals(0,Display.getActiveDisplayNumber());
Assert.assertEquals(0,display.getReferenceCount());
Assert.assertEquals(false,display.isNativeValid());
- Assert.assertEquals(false,display.getEDTUtil().isRunning());
+ Assert.assertEquals(true,display.getEDTUtil().isRunning());
Assert.assertEquals(0,screen.getReferenceCount());
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,window.isNativeValid());
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 2d1bb82a6..5c9b23ded 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -90,7 +90,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0,display.getReferenceCount());
Assert.assertEquals(false,display.isNativeValid());
Assert.assertNotNull(display.getEDTUtil());
- Assert.assertEquals(false,display.getEDTUtil().isRunning());
+ Assert.assertEquals(true,display.getEDTUtil().isRunning());
Assert.assertEquals(0,screen.getReferenceCount());
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(0,Display.getActiveDisplayNumber());
@@ -355,7 +355,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0,display1.getReferenceCount());
Assert.assertEquals(false,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
- Assert.assertEquals(false,display1.getEDTUtil().isRunning());
+ Assert.assertEquals(true,display1.getEDTUtil().isRunning());
Assert.assertEquals(0,screen1.getReferenceCount());
Assert.assertEquals(false,screen1.isNativeValid());
Assert.assertEquals(0,Display.getActiveDisplayNumber());
@@ -372,7 +372,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0,display2.getReferenceCount());
Assert.assertEquals(false,display2.isNativeValid());
Assert.assertNotNull(display2.getEDTUtil());
- Assert.assertEquals(false,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(true,display2.getEDTUtil().isRunning());
Assert.assertEquals(0,screen2.getReferenceCount());
Assert.assertEquals(false,screen2.isNativeValid());
Assert.assertEquals(0,Display.getActiveDisplayNumber());
@@ -630,7 +630,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0,display1.getReferenceCount());
Assert.assertEquals(false,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
- Assert.assertEquals(false,display1.getEDTUtil().isRunning());
+ Assert.assertEquals(true,display1.getEDTUtil().isRunning());
Assert.assertEquals(0,screen1.getReferenceCount());
Assert.assertEquals(false,screen1.isNativeValid());
Assert.assertEquals(0,Display.getActiveDisplayNumber());
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java
index 6130a5fcd..7909b0320 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java
@@ -65,8 +65,8 @@ import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting03AWT extends UITestCase {
static Dimension size;
- static long durationPerTest = 800;
- static long waitAdd2nd = 500;
+ static long durationPerTest = 400;
+ static long waitAdd2nd = 200;
static GLCapabilities glCaps;
@BeforeClass
@@ -74,6 +74,8 @@ public class TestParenting03AWT extends UITestCase {
GLProfile.initSingleton(true);
size = new Dimension(400,200);
glCaps = new GLCapabilities(null);
+ glCaps.setAlphaBits(8);
+ glCaps.setBackgroundOpaque(false);
}
@Test
@@ -88,67 +90,48 @@ public class TestParenting03AWT extends UITestCase {
NEWTEventFiFo eventFifo = new NEWTEventFiFo();
GLWindow glWindow1 = GLWindow.create(glCaps);
+ glWindow1.enablePerfLog(true);
glWindow1.setUndecorated(true);
- GLEventListener demo1 = new Gears();
+ NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1);
+ newtCanvasAWT1.setPreferredSize(size);
+
+ GLEventListener demo1 = new Gears(1);
setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
+ final NewtCanvasAWT f_newtCanvasAWT1 = newtCanvasAWT1;
final GLWindow f_glWindow1 = glWindow1;
glWindow1.addKeyListener(new KeyAdapter() {
public void keyTyped(KeyEvent e) {
- if(e.getKeyChar()=='f') {
- f_glWindow1.invoke(false, new GLRunnable() {
- public void run(GLAutoDrawable drawable) {
- GLWindow win = (GLWindow)drawable;
- win.setFullscreen(!win.isFullscreen());
- } });
+ if(e.getKeyChar()=='d') {
+ f_glWindow1.setUndecorated(!f_glWindow1.isUndecorated());
+ } else if(e.getKeyChar()=='f') {
+ f_glWindow1.setFullscreen(!f_glWindow1.isFullscreen());
+ } else if(e.getKeyChar()=='r') {
+ if(f_glWindow1.getParent()==null) {
+ System.err.println("XXX glWin1 -> home");
+ f_glWindow1.reparentWindow(f_newtCanvasAWT1.getNativeWindow());
+ } else {
+ System.err.println("XXX glWin1 -> TOP");
+ f_glWindow1.reparentWindow(null);
+ }
}
}
});
GLAnimatorControl animator1 = new Animator(glWindow1);
animator1.start();
- GLWindow glWindow2 = GLWindow.create(glCaps);
- glWindow2.setUndecorated(true);
- GLEventListener demo2 = new Gears();
- setDemoFields(demo2, glWindow2, false);
- glWindow2.addGLEventListener(demo2);
- final GLWindow f_glWindow2 = glWindow2;
- glWindow2.addKeyListener(new KeyAdapter() {
- public void keyTyped(KeyEvent e) {
- if(e.getKeyChar()=='f') {
- f_glWindow2.invoke(false, new GLRunnable() {
- public void run(GLAutoDrawable drawable) {
- GLWindow win = (GLWindow)drawable;
- win.setFullscreen(!win.isFullscreen());
- } });
- }
- }
- });
- GLAnimatorControl animator2 = new Animator(glWindow2);
- animator2.start();
-
- NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1);
- newtCanvasAWT1.setPreferredSize(size);
Container cont1 = new Container();
cont1.setLayout(new BorderLayout());
cont1.add(newtCanvasAWT1, BorderLayout.CENTER);
cont1.setVisible(true);
final Container f_cont1 = cont1;
- NewtCanvasAWT newtCanvasAWT2 = new NewtCanvasAWT(glWindow2);
- newtCanvasAWT2.setPreferredSize(size);
- Container cont2 = new Container();
- cont2.setLayout(new BorderLayout());
- cont2.add(newtCanvasAWT2, BorderLayout.CENTER);
- cont2.setVisible(true);
- final Container f_cont2 = cont2;
-
Frame frame1 = new Frame("AWT Parent Frame");
frame1.setLayout(new BorderLayout());
frame1.add(cont1, BorderLayout.EAST);
frame1.add(new Label("center"), BorderLayout.CENTER);
frame1.setLocation(0, 0);
- frame1.setSize((int)size.getWidth()*2, (int)size.getHeight()*2);
+ frame1.setSize((int)size.getWidth(), (int)size.getHeight());
final Frame f_frame1 = frame1;
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -157,24 +140,10 @@ public class TestParenting03AWT extends UITestCase {
}});
Assert.assertEquals(newtCanvasAWT1.getNativeWindow(),glWindow1.getParent());
- Assert.assertEquals(newtCanvasAWT2.getNativeWindow(),glWindow2.getParent());
-
Assert.assertEquals(true, animator1.isAnimating());
Assert.assertEquals(false, animator1.isPaused());
Assert.assertNotNull(animator1.getThread());
- Assert.assertEquals(true, animator2.isAnimating());
- Assert.assertEquals(false, animator2.isPaused());
- Assert.assertNotNull(animator2.getThread());
-
- Thread.sleep(waitAdd2nd);
-
- javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- f_frame1.add(f_cont2, BorderLayout.WEST);
- f_frame1.pack();
- }});
-
Thread.sleep(durationPerTest);
animator1.stop();
@@ -182,14 +151,8 @@ public class TestParenting03AWT extends UITestCase {
Assert.assertEquals(false, animator1.isPaused());
Assert.assertEquals(null, animator1.getThread());
- animator2.stop();
- Assert.assertEquals(false, animator2.isAnimating());
- Assert.assertEquals(false, animator2.isPaused());
- Assert.assertEquals(null, animator2.getThread());
-
frame1.dispose();
glWindow1.destroy(true);
- glWindow2.destroy(true);
}
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java
new file mode 100644
index 000000000..2c2049ea0
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java
@@ -0,0 +1,258 @@
+/**
+ * Copyright 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.test.junit.newt.parenting;
+
+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 java.awt.Button;
+import java.awt.BorderLayout;
+import java.awt.Canvas;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Label;
+
+import javax.media.opengl.*;
+import javax.media.nativewindow.*;
+
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.FPSAnimator;
+import com.jogamp.newt.*;
+import com.jogamp.newt.event.*;
+import com.jogamp.newt.opengl.*;
+import com.jogamp.newt.awt.NewtCanvasAWT;
+
+import java.io.IOException;
+
+import com.jogamp.test.junit.util.*;
+import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
+
+public class TestParenting03bAWT extends UITestCase {
+ static Dimension size;
+ static long durationPerTest = 800;
+ static long waitAdd2nd = 500;
+ static GLCapabilities glCaps;
+
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton(true);
+ size = new Dimension(400,200);
+ glCaps = new GLCapabilities(null);
+ }
+
+ @Test
+ public void testWindowParenting1AWT2NewtChilds01() throws InterruptedException, InvocationTargetException {
+ testWindowParenting1AWT2NewtChilds(true);
+ }
+
+ public void testWindowParenting1AWT2NewtChilds(boolean visibleChild2) throws InterruptedException, InvocationTargetException {
+ int x = 0;
+ int y = 0;
+
+ NEWTEventFiFo eventFifo = new NEWTEventFiFo();
+
+ GLWindow glWindow1 = GLWindow.create(glCaps);
+ glWindow1.enablePerfLog(true);
+ glWindow1.setUndecorated(true);
+ NewtCanvasAWT newtCanvasAWT1 = new NewtCanvasAWT(glWindow1);
+ newtCanvasAWT1.setPreferredSize(size);
+
+ GLEventListener demo1 = new Gears(1);
+ setDemoFields(demo1, glWindow1, false);
+ glWindow1.addGLEventListener(demo1);
+ final NewtCanvasAWT f_newtCanvasAWT1 = newtCanvasAWT1;
+ final GLWindow f_glWindow1 = glWindow1;
+ glWindow1.addKeyListener(new KeyAdapter() {
+ public void keyTyped(KeyEvent e) {
+ if(e.getKeyChar()=='d') {
+ f_glWindow1.setUndecorated(!f_glWindow1.isUndecorated());
+ } else if(e.getKeyChar()=='f') {
+ f_glWindow1.setFullscreen(!f_glWindow1.isFullscreen());
+ } else if(e.getKeyChar()=='r') {
+ if(f_glWindow1.getParent()==null) {
+ System.err.println("XXX glWin1 -> home");
+ f_glWindow1.reparentWindow(f_newtCanvasAWT1.getNativeWindow());
+ } else {
+ System.err.println("XXX glWin1 -> TOP");
+ f_glWindow1.reparentWindow(null);
+ }
+ }
+ }
+ });
+ GLAnimatorControl animator1 = new Animator(glWindow1);
+ animator1.start();
+
+ GLWindow glWindow2 = GLWindow.create(glCaps);
+ glWindow2.enablePerfLog(true);
+ glWindow2.setUndecorated(true);
+ NewtCanvasAWT newtCanvasAWT2 = new NewtCanvasAWT(glWindow2);
+ newtCanvasAWT2.setPreferredSize(size);
+
+ GLEventListener demo2 = new Gears(1);
+ setDemoFields(demo2, glWindow2, false);
+ glWindow2.addGLEventListener(demo2);
+ final NewtCanvasAWT f_newtCanvasAWT2 = newtCanvasAWT2;
+ final GLWindow f_glWindow2 = glWindow2;
+ glWindow2.addKeyListener(new KeyAdapter() {
+ public void keyTyped(KeyEvent e) {
+ if(e.getKeyChar()=='d') {
+ f_glWindow2.setUndecorated(!f_glWindow2.isUndecorated());
+ } else if(e.getKeyChar()=='f') {
+ f_glWindow2.setFullscreen(!f_glWindow2.isFullscreen());
+ } else if(e.getKeyChar()=='r') {
+ if(f_glWindow2.getParent()==null) {
+ System.err.println("XXX glWin2 -> home");
+ f_glWindow2.reparentWindow(f_newtCanvasAWT2.getNativeWindow());
+ } else {
+ System.err.println("XXX glWin2 -> TOP");
+ f_glWindow2.reparentWindow(null);
+ }
+ }
+ }
+ });
+ GLAnimatorControl animator2 = new Animator(glWindow2);
+ animator2.start();
+
+ Container cont1 = new Container();
+ cont1.setLayout(new BorderLayout());
+ cont1.add(newtCanvasAWT1, BorderLayout.CENTER);
+ cont1.setVisible(true);
+ final Container f_cont1 = cont1;
+
+ Container cont2 = new Container();
+ cont2.setLayout(new BorderLayout());
+ cont2.add(newtCanvasAWT2, BorderLayout.CENTER);
+ cont2.setVisible(true);
+ final Container f_cont2 = cont2;
+
+ Frame frame1 = new Frame("AWT Parent Frame");
+ frame1.setLayout(new BorderLayout());
+ frame1.add(cont1, BorderLayout.EAST);
+ frame1.add(new Label("center"), BorderLayout.CENTER);
+ frame1.setLocation(0, 0);
+ frame1.setSize((int)size.getWidth()*2, (int)size.getHeight()*2);
+ final Frame f_frame1 = frame1;
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f_frame1.pack();
+ f_frame1.setVisible(true);
+ }});
+
+ Assert.assertEquals(newtCanvasAWT1.getNativeWindow(),glWindow1.getParent());
+ Assert.assertEquals(newtCanvasAWT2.getNativeWindow(),glWindow2.getParent());
+
+ Assert.assertEquals(true, animator1.isAnimating());
+ Assert.assertEquals(false, animator1.isPaused());
+ Assert.assertNotNull(animator1.getThread());
+
+ Assert.assertEquals(true, animator2.isAnimating());
+ Assert.assertEquals(false, animator2.isPaused());
+ Assert.assertNotNull(animator2.getThread());
+
+ Thread.sleep(waitAdd2nd);
+
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ f_frame1.add(f_cont2, BorderLayout.WEST);
+ f_frame1.pack();
+ }});
+
+ Thread.sleep(durationPerTest);
+
+ animator1.stop();
+ Assert.assertEquals(false, animator1.isAnimating());
+ Assert.assertEquals(false, animator1.isPaused());
+ Assert.assertEquals(null, animator1.getThread());
+
+ animator2.stop();
+ Assert.assertEquals(false, animator2.isAnimating());
+ Assert.assertEquals(false, animator2.isPaused());
+ Assert.assertEquals(null, animator2.getThread());
+
+ frame1.dispose();
+ glWindow1.destroy(true);
+ glWindow2.destroy(true);
+ }
+
+ public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
+ Assert.assertNotNull(demo);
+ Assert.assertNotNull(glWindow);
+ Window window = glWindow.getWindow();
+ if(debug) {
+ MiscUtils.setFieldIfExists(demo, "glDebug", true);
+ MiscUtils.setFieldIfExists(demo, "glTrace", true);
+ }
+ if(!MiscUtils.setFieldIfExists(demo, "window", window)) {
+ MiscUtils.setFieldIfExists(demo, "glWindow", glWindow);
+ }
+ }
+
+ static int atoi(String a) {
+ int i=0;
+ try {
+ i = Integer.parseInt(a);
+ } catch (Exception ex) { ex.printStackTrace(); }
+ return i;
+ }
+
+ public static void main(String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ durationPerTest = atoi(args[++i]);
+ } else if(args[i].equals("-wait")) {
+ waitAdd2nd = atoi(args[++i]);
+ }
+ }
+ String tstname = TestParenting03bAWT.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);
+ }
+
+}