summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/junit/com/jogamp')
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java4
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java4
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/demos/es1/RedSquare.java7
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java5
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java4
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java4
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java4
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java4
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java4
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java4
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java152
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java230
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java7
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java1
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/GLRunnableDummy.java (renamed from src/junit/com/jogamp/test/junit/newt/GLRunnableDummy.java)3
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/KeyAction.java (renamed from src/junit/com/jogamp/test/junit/newt/KeyAction.java)2
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java (renamed from src/junit/com/jogamp/test/junit/newt/TestParenting01NEWT.java)6
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java (renamed from src/junit/com/jogamp/test/junit/newt/TestParenting01aAWT.java)38
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java (renamed from src/junit/com/jogamp/test/junit/newt/TestParenting01bAWT.java)6
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java (renamed from src/junit/com/jogamp/test/junit/newt/TestParenting01cAWT.java)70
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java (renamed from src/junit/com/jogamp/test/junit/newt/TestParenting01cSwingAWT.java)11
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java (renamed from src/junit/com/jogamp/test/junit/newt/TestParenting02AWT.java)6
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java (renamed from src/junit/com/jogamp/test/junit/newt/TestParenting02NEWT.java)21
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/WindowAction.java (renamed from src/junit/com/jogamp/test/junit/newt/WindowAction.java)2
24 files changed, 523 insertions, 76 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
index 1652acd82..f10218509 100755
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
@@ -48,6 +48,10 @@ import org.junit.After;
import org.junit.Test;
public class TestAWT01GLn {
+ static {
+ GLProfile.initSingleton();
+ }
+
Frame frame=null;
GLCanvas glCanvas=null;
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java
index ed8a5dd0f..6144a6308 100755
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java
@@ -56,6 +56,10 @@ import static javax.swing.SwingUtilities.*;
* @author Michael Bien
*/
public class TestSwingAWT01GLn {
+ static {
+ GLProfile.initSingleton();
+ }
+
private Window[] windows;
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/es1/RedSquare.java b/src/junit/com/jogamp/test/junit/jogl/demos/es1/RedSquare.java
index 9b8982ed4..be416f01d 100755
--- a/src/junit/com/jogamp/test/junit/jogl/demos/es1/RedSquare.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/es1/RedSquare.java
@@ -44,6 +44,7 @@ public class RedSquare implements GLEventListener {
private FloatBuffer vertices;
public void init(GLAutoDrawable drawable) {
+ System.out.println("RedSquare: Init");
GL _gl = drawable.getGL();
if(glDebugEmu) {
@@ -119,6 +120,7 @@ public class RedSquare implements GLEventListener {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ System.out.println("RedSquare: Reshape");
GL2ES1 gl = drawable.getGL().getGL2ES1();
// Set location in front of camera
gl.glMatrixMode(gl.GL_PROJECTION);
@@ -147,6 +149,7 @@ public class RedSquare implements GLEventListener {
}
public void dispose(GLAutoDrawable drawable) {
+ System.out.println("RedSquare: Dispose");
GL2ES1 gl = drawable.getGL().getGL2ES1();
if(debug) {
System.out.println(Thread.currentThread()+" RedSquare.dispose: "+gl.getContext());
@@ -163,8 +166,4 @@ public class RedSquare implements GLEventListener {
System.out.println(Thread.currentThread()+" RedSquare.dispose: FIN");
}
}
-
- public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
- }
-
}
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 1fa49be8c..ef5cf134a 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
@@ -25,6 +25,7 @@ public class Gears implements GLEventListener {
private boolean mouseRButtonDown = false;
public void init(GLAutoDrawable drawable) {
+ System.out.println("Gears: Init");
// Use debug pipeline
// drawable.setGL(new DebugGL(drawable.getGL()));
@@ -77,6 +78,7 @@ public class Gears implements GLEventListener {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
+ System.out.println("Gears: Reshape");
GL2 gl = drawable.getGL().getGL2();
float h = (float)height / (float)width;
@@ -91,6 +93,7 @@ public class Gears implements GLEventListener {
}
public void dispose(GLAutoDrawable drawable) {
+ System.out.println("Gears: Dispose");
}
public void display(GLAutoDrawable drawable) {
@@ -144,8 +147,6 @@ public class Gears implements GLEventListener {
gl.glPopMatrix();
}
- public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {}
-
public static void gear(GL2 gl,
float inner_radius,
float outer_radius,
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
index 2df3f0de9..b191dbbaf 100755
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
@@ -51,6 +51,10 @@ import org.junit.After;
import org.junit.Test;
public class TestGearsAWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static GLProfile glp;
static int width, height;
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java
index e50ffbde9..bafa8a1fb 100755
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java
@@ -48,6 +48,10 @@ import org.junit.After;
import org.junit.Test;
public class TestGearsNEWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static GLProfile glp;
static int width, height;
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java
index 51977d6d3..316c9edb4 100755
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java
@@ -49,6 +49,10 @@ import org.junit.After;
import org.junit.Test;
public class TestGearsNewtAWTWrapper {
+ static {
+ GLProfile.initSingleton();
+ }
+
static GLProfile glp;
static int width, height;
diff --git a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
index cd0c7c0e0..8a9c960c1 100755
--- a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
@@ -45,6 +45,10 @@ import com.jogamp.newt.*;
import java.io.IOException;
public class TestDrawable01NEWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static GLProfile glp;
static GLDrawableFactory factory;
static int width, height;
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
index bae727019..ad198fca8 100755
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
@@ -57,6 +57,10 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import java.io.IOException;
public class TestOffscreen01NEWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static GLProfile glpDefault;
static GLDrawableFactory glDrawableFactory;
static int width, height;
diff --git a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
index 7fdbd59c8..b34023bee 100755
--- a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
@@ -56,6 +56,10 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class TestTexture01AWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static GLProfile glp;
static GLCapabilities caps;
BufferedImage textureImage;
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
index 4fd7744db..3a36a1132 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
@@ -47,8 +47,8 @@ import org.junit.Test;
import javax.media.nativewindow.*;
import javax.media.opengl.*;
-import com.jogamp.opengl.util.Animator;
import com.jogamp.newt.*;
+import com.jogamp.newt.event.*;
import com.jogamp.newt.opengl.*;
import java.io.IOException;
@@ -56,9 +56,13 @@ import com.jogamp.test.junit.util.MiscUtils;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestGLWindows01NEWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static GLProfile glp;
static int width, height;
- static long duration = 100; // ms
+ static long durationPerTest = 100; // ms
@BeforeClass
public static void initClass() {
@@ -67,7 +71,11 @@ public class TestGLWindows01NEWT {
glp = GLProfile.getDefault();
}
- static GLWindow createWindow(Screen screen, GLCapabilities caps, int width, int height, boolean onscreen, boolean undecorated) {
+ static GLWindow createWindow(Screen screen, GLCapabilities caps,
+ int width, int height, boolean onscreen, boolean undecorated,
+ boolean addGLEventListenerAfterVisible)
+ throws InterruptedException
+ {
Assert.assertNotNull(caps);
caps.setOnscreen(onscreen);
// System.out.println("Requested: "+caps);
@@ -84,12 +92,23 @@ public class TestGLWindows01NEWT {
glWindow = GLWindow.create(caps, onscreen && undecorated);
}
Assert.assertNotNull(glWindow);
+ Assert.assertEquals(false,glWindow.isVisible());
Assert.assertEquals(false,glWindow.isNativeWindowValid());
+
+ GLEventListener demo = new Gears();
+ setDemoFields(demo, glWindow);
+ if(!addGLEventListenerAfterVisible) {
+ glWindow.addGLEventListener(demo);
+ }
+ glWindow.addWindowListener(new TraceWindowAdapter());
+
glWindow.setSize(width, height);
- Assert.assertEquals(false,glWindow.isVisible());
+
glWindow.setVisible(true);
Assert.assertEquals(true,glWindow.isVisible());
Assert.assertEquals(true,glWindow.isNativeWindowValid());
+ while(glWindow.getTotalFrames()<1) { Thread.sleep(100); }
+ Assert.assertEquals(1,glWindow.getTotalFrames()); // native expose ..
// Assert.assertEquals(width,glWindow.getWidth());
// Assert.assertEquals(height,glWindow.getHeight());
// System.out.println("Created: "+glWindow);
@@ -105,9 +124,10 @@ public class TestGLWindows01NEWT {
Assert.assertTrue(caps.getRedBits()>5);
Assert.assertEquals(caps.isOnscreen(),onscreen);
- GLEventListener demo = new Gears();
- setDemoFields(demo, glWindow);
- glWindow.addGLEventListener(demo);
+ if(addGLEventListenerAfterVisible) {
+ glWindow.addGLEventListener(demo);
+ glWindow.display();
+ }
return glWindow;
}
@@ -115,17 +135,21 @@ public class TestGLWindows01NEWT {
static void destroyWindow(GLWindow glWindow, boolean deep) {
if(null!=glWindow) {
glWindow.destroy(deep);
+ Assert.assertEquals(false,glWindow.isNativeWindowValid());
}
}
@Test
- public void testWindowNativeRecreate01Simple() throws InterruptedException {
+ public void testWindowNativeRecreate01aSimple() throws InterruptedException {
GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
- GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */);
+ GLWindow window = createWindow(null, caps, width, height,
+ true /* onscreen */, false /* undecorated */,
+ false /*addGLEventListenerAfterVisible*/);
- window.display();
- window.destroy();
+ Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isVisible());
+ window.destroy(false);
Assert.assertEquals(false,window.isNativeWindowValid());
Assert.assertEquals(false,window.isVisible());
@@ -136,28 +160,70 @@ public class TestGLWindows01NEWT {
window.setVisible(true);
Assert.assertEquals(true,window.isNativeWindowValid());
Assert.assertEquals(true,window.isVisible());
+
+ window.setVisible(false);
+ Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(false,window.isVisible());
+
+ destroyWindow(window, true);
+ }
+
+ @Test
+ public void testWindowNativeRecreate01bSimple() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ GLWindow window = createWindow(null, caps, width, height,
+ true /* onscreen */, false /* undecorated */,
+ true /*addGLEventListenerAfterVisible*/);
+
+ Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isVisible());
+ window.destroy(false);
+ Assert.assertEquals(false,window.isNativeWindowValid());
+ Assert.assertEquals(false,window.isVisible());
+
window.display();
+ Assert.assertEquals(false,window.isNativeWindowValid());
+ Assert.assertEquals(false,window.isVisible());
+
+ window.setVisible(true);
+ Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isVisible());
- Animator animator = new Animator(window);
- animator.start();
- while(animator.isAnimating() && animator.getDuration()<duration) {
+ window.setVisible(false);
+ Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(false,window.isVisible());
+
+ destroyWindow(window, true);
+ }
+
+ @Test
+ public void testWindowDecor01aSimple() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ GLWindow window = createWindow(null, caps, width, height,
+ true /* onscreen */, false /* undecorated */,
+ false /*addGLEventListenerAfterVisible*/);
+ System.out.println("Created: "+window);
+ while(window.getDuration()<durationPerTest) {
Thread.sleep(100);
}
- animator.stop();
+ System.out.println("duration: "+window.getDuration());
destroyWindow(window, true);
}
@Test
- public void testWindowDecor01Simple() throws InterruptedException {
+ public void testWindowDecor01bSimple() throws InterruptedException {
GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
- GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */);
- Animator animator = new Animator(window);
- animator.start();
- while(animator.isAnimating() && animator.getDuration()<duration) {
+ GLWindow window = createWindow(null, caps, width, height,
+ true /* onscreen */, false /* undecorated */,
+ true /*addGLEventListenerAfterVisible*/);
+ System.out.println("Created: "+window);
+ while(window.getDuration()<durationPerTest) {
Thread.sleep(100);
}
- animator.stop();
+ System.out.println("duration: "+window.getDuration());
destroyWindow(window, true);
}
@@ -165,13 +231,13 @@ public class TestGLWindows01NEWT {
public void testWindowDecor02DestroyWinTwiceA() throws InterruptedException {
GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
- GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */);
- Animator animator = new Animator(window);
- animator.start();
- while(animator.isAnimating() && animator.getDuration()<duration) {
+ GLWindow window = createWindow(null, caps, width, height,
+ true /* onscreen */, false /* undecorated */,
+ false /*addGLEventListenerAfterVisible*/);
+ while(window.getDuration()<durationPerTest) {
Thread.sleep(100);
}
- animator.stop();
+ System.out.println("duration: "+window.getDuration());
destroyWindow(window, false);
destroyWindow(window, true);
}
@@ -189,28 +255,26 @@ public class TestGLWindows01NEWT {
Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0
Assert.assertNotNull(screen1);
- GLWindow window1 = createWindow(screen1, caps, width, height, true /* onscreen */, false /* undecorated */);
+ GLWindow window1 = createWindow(screen1, caps, width, height,
+ true /* onscreen */, false /* undecorated */,
+ false /*addGLEventListenerAfterVisible*/);
Assert.assertNotNull(window1);
Screen screen2 = NewtFactory.createScreen(display2, 0); // screen 0
Assert.assertNotNull(screen2);
- GLWindow window2 = createWindow(screen2, caps, width, height, true /* onscreen */, false /* undecorated */);
+ GLWindow window2 = createWindow(screen2, caps, width, height,
+ true /* onscreen */, false /* undecorated */,
+ false /*addGLEventListenerAfterVisible*/);
Assert.assertNotNull(window2);
- Animator animator1 = new Animator(window1);
- animator1.start();
- Animator animator2 = new Animator(window2);
- animator2.start();
- while(animator1.isAnimating() && animator1.getDuration()<duration) {
+ while(window1.getDuration()<durationPerTest) {
Thread.sleep(100);
}
+ System.out.println("duration1: "+window1.getDuration());
+ System.out.println("duration2: "+window2.getDuration());
- animator2.stop();
- Assert.assertEquals(false, animator2.isAnimating());
destroyWindow(window2, true);
- animator1.stop();
- Assert.assertEquals(false, animator1.isAnimating());
destroyWindow(window1, true);
}
@@ -222,7 +286,21 @@ public class TestGLWindows01NEWT {
}
}
+ 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]);
+ }
+ }
+ System.out.println("durationPerTest: "+durationPerTest);
String tstname = TestGLWindows01NEWT.class.getName();
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
tstname,
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
new file mode 100755
index 000000000..0677bc82c
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * - Redistribution of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistribution 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.
+ *
+ * Neither the name Sven Gothel or the names of
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * This software is provided "AS IS," without a warranty of any kind. ALL
+ * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+ * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+ * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+ * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
+ * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
+ * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+ * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+ * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+ * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+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;
+import com.jogamp.newt.*;
+import com.jogamp.newt.event.*;
+import com.jogamp.newt.opengl.*;
+import java.io.IOException;
+
+import com.jogamp.test.junit.util.MiscUtils;
+import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
+
+public class TestGLWindows02NEWTAnimated {
+ static {
+ GLProfile.initSingleton();
+ }
+
+ static GLProfile glp;
+ static int width, height;
+ static long durationPerTest = 100; // ms
+
+ @BeforeClass
+ public static void initClass() {
+ width = 640;
+ height = 480;
+ glp = GLProfile.getDefault();
+ }
+
+ static GLWindow createWindow(Screen screen, GLCapabilities caps, int width, int height, boolean onscreen, boolean undecorated) {
+ Assert.assertNotNull(caps);
+ caps.setOnscreen(onscreen);
+ // System.out.println("Requested: "+caps);
+
+ //
+ // Create native windowing resources .. X11/Win/OSX
+ //
+ GLWindow glWindow;
+ if(null!=screen) {
+ Window window = NewtFactory.createWindow(screen, caps, onscreen && undecorated);
+ Assert.assertNotNull(window);
+ glWindow = GLWindow.create(window);
+ } else {
+ glWindow = GLWindow.create(caps, onscreen && undecorated);
+ }
+ Assert.assertNotNull(glWindow);
+ GLEventListener demo = new Gears();
+ setDemoFields(demo, glWindow);
+ glWindow.addGLEventListener(demo);
+ glWindow.addWindowListener(new TraceWindowAdapter());
+ Assert.assertEquals(false,glWindow.isNativeWindowValid());
+
+ glWindow.setSize(width, height);
+ Assert.assertEquals(false,glWindow.isVisible());
+ glWindow.setVisible(true);
+ Assert.assertEquals(true,glWindow.isVisible());
+ Assert.assertEquals(true,glWindow.isNativeWindowValid());
+ // Assert.assertEquals(width,glWindow.getWidth());
+ // Assert.assertEquals(height,glWindow.getHeight());
+ // System.out.println("Created: "+glWindow);
+
+ //
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // equivalent to GLAutoDrawable methods: setVisible(true)
+ //
+ caps = (GLCapabilities) glWindow.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ Assert.assertNotNull(caps);
+ Assert.assertTrue(caps.getGreenBits()>5);
+ Assert.assertTrue(caps.getBlueBits()>5);
+ Assert.assertTrue(caps.getRedBits()>5);
+ Assert.assertEquals(caps.isOnscreen(),onscreen);
+
+ return glWindow;
+ }
+
+ static void destroyWindow(GLWindow glWindow, boolean deep) {
+ if(null!=glWindow) {
+ glWindow.destroy(deep);
+ }
+ }
+
+ @Test
+ public void testWindowDecor01Simple() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */);
+ Animator animator = new Animator(window);
+ animator.start();
+ while(animator.isAnimating() && animator.getDuration()<durationPerTest) {
+ Thread.sleep(100);
+ }
+ animator.stop();
+ destroyWindow(window, true);
+ }
+
+ @Test
+ public void testWindowDecor02DestroyWinTwiceA() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ GLWindow window = createWindow(null, caps, width, height, true /* onscreen */, false /* undecorated */);
+ Animator animator = new Animator(window);
+ animator.start();
+ while(animator.isAnimating() && animator.getDuration()<durationPerTest) {
+ Thread.sleep(100);
+ }
+ animator.stop();
+ destroyWindow(window, false);
+ destroyWindow(window, true);
+ }
+
+ @Test
+ public void testWindowDecor03TwoWin() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+
+ Display display1 = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display1);
+ Display display2 = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display2);
+ Assert.assertEquals(display1, display2); // must be equal: same thread - same display
+
+ Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0
+ Assert.assertNotNull(screen1);
+ GLWindow window1 = createWindow(screen1, caps, width, height, true /* onscreen */, false /* undecorated */);
+ Assert.assertNotNull(window1);
+
+ 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);
+
+ Animator animator1 = new Animator(window1);
+ animator1.start();
+ Animator animator2 = new Animator(window2);
+ animator2.start();
+ while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) {
+ Thread.sleep(100);
+ }
+
+ animator2.stop();
+ Assert.assertEquals(false, animator2.isAnimating());
+ destroyWindow(window2, false);
+
+ animator1.stop();
+ Assert.assertEquals(false, animator1.isAnimating());
+ destroyWindow(window1, true);
+ }
+
+ public static void setDemoFields(GLEventListener demo, GLWindow glWindow) {
+ Assert.assertNotNull(demo);
+ Assert.assertNotNull(glWindow);
+ if(!MiscUtils.setFieldIfExists(demo, "window", glWindow.getInnerWindow())) {
+ 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]);
+ }
+ }
+ String tstname = TestGLWindows02NEWTAnimated.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" } );
+ }
+
+}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java b/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
index 495b8bb3e..5a67bbc15 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
@@ -65,9 +65,12 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestListenerCom01AWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static int width, height;
static long durationPerTest = 500;
- static long waitReparent = 300;
static boolean verbose = false;
@BeforeClass
@@ -152,8 +155,6 @@ public class TestListenerCom01AWT {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
durationPerTest = atoi(args[++i]);
- } else if(args[i].equals("-wait")) {
- waitReparent = atoi(args[++i]);
}
}
String tstname = TestListenerCom01AWT.class.getName();
diff --git a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
index 58ea235df..89d9c1ca2 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
@@ -120,6 +120,7 @@ public class TestWindows01NEWT {
window.setVisible(true);
Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isVisible());
Thread.sleep(100); // 100 ms
destroyWindow(display, screen, window);
diff --git a/src/junit/com/jogamp/test/junit/newt/GLRunnableDummy.java b/src/junit/com/jogamp/test/junit/newt/parenting/GLRunnableDummy.java
index 990a0c37d..1940616ad 100644
--- a/src/junit/com/jogamp/test/junit/newt/GLRunnableDummy.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/GLRunnableDummy.java
@@ -30,7 +30,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.test.junit.newt;
+package com.jogamp.test.junit.newt.parenting;
import org.junit.Assert;
import org.junit.Before;
@@ -47,7 +47,6 @@ public class GLRunnableDummy implements GLRunnable {
float d=0.001f;
public void run(GLAutoDrawable drawable) {
- // nop ..
GL2ES1 gl = drawable.getGL().getGL2ES1();
gl.glClearColor(r, g, b, 1f);
r+=d;
diff --git a/src/junit/com/jogamp/test/junit/newt/KeyAction.java b/src/junit/com/jogamp/test/junit/newt/parenting/KeyAction.java
index 3ca12a840..c9e1db074 100644
--- a/src/junit/com/jogamp/test/junit/newt/KeyAction.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/KeyAction.java
@@ -31,7 +31,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.test.junit.newt;
+package com.jogamp.test.junit.newt.parenting;
import com.jogamp.newt.event.*;
diff --git a/src/junit/com/jogamp/test/junit/newt/TestParenting01NEWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
index b1d57e793..421f74aa4 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestParenting01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -30,7 +30,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.test.junit.newt;
+package com.jogamp.test.junit.newt.parenting;
import java.lang.reflect.*;
import java.util.ArrayList;
@@ -60,6 +60,10 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting01NEWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static int width, height;
static long durationPerTest = 500;
static long waitReparent = 0;
diff --git a/src/junit/com/jogamp/test/junit/newt/TestParenting01aAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
index d88e7157a..28b95884d 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestParenting01aAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
@@ -30,7 +30,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.test.junit.newt;
+package com.jogamp.test.junit.newt.parenting;
import java.lang.reflect.*;
import java.util.ArrayList;
@@ -47,6 +47,7 @@ import org.junit.Test;
import java.awt.Button;
import java.awt.BorderLayout;
import java.awt.Canvas;
+import java.awt.Container;
import java.awt.Frame;
import java.awt.Dimension;
@@ -66,6 +67,10 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting01aAWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static int width, height;
static long durationPerTest = 800;
static long waitReparent = 0;
@@ -101,13 +106,26 @@ public class TestParenting01aAWT {
Assert.assertEquals(false, glWindow1.isNativeWindowValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
- Frame frame = new Frame("AWT Parent Frame");
- Assert.assertNotNull(frame);
- frame.add(newtCanvasAWT);
- frame.setSize(width, height);
+ Frame frame1 = new Frame("AWT Parent Frame");
+ frame1.setLayout(new BorderLayout());
+ frame1.add(new Button("North"), BorderLayout.NORTH);
+ frame1.add(new Button("South"), BorderLayout.SOUTH);
+ frame1.add(new Button("East"), BorderLayout.EAST);
+ frame1.add(new Button("West"), BorderLayout.WEST);
+
+ Container container1 = new Container();
+ container1.setLayout(new BorderLayout());
+ container1.add(new Button("north"), BorderLayout.NORTH);
+ container1.add(new Button("south"), BorderLayout.SOUTH);
+ container1.add(new Button("east"), BorderLayout.EAST);
+ container1.add(new Button("west"), BorderLayout.WEST);
+ container1.add(newtCanvasAWT, BorderLayout.CENTER);
+
+ frame1.add(container1, BorderLayout.CENTER);
+ frame1.setSize(width, height);
// visible test
- frame.setVisible(true);
+ frame1.setVisible(true);
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow());
Animator animator1 = new Animator(glWindow1);
@@ -118,17 +136,17 @@ public class TestParenting01aAWT {
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
- frame.setVisible(false);
+ frame1.setVisible(false);
Assert.assertEquals(false, glWindow1.isDestroyed());
- frame.setVisible(true);
+ frame1.setVisible(true);
Assert.assertEquals(false, glWindow1.isDestroyed());
- frame.remove(newtCanvasAWT);
+ frame1.remove(newtCanvasAWT);
// Assert.assertNull(glWindow1.getParentNativeWindow());
Assert.assertEquals(false, glWindow1.isDestroyed());
- frame.dispose();
+ frame1.dispose();
Assert.assertEquals(false, glWindow1.isDestroyed());
glWindow1.destroy(true);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestParenting01bAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java
index 227744296..f95ad1c14 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestParenting01bAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java
@@ -30,7 +30,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.test.junit.newt;
+package com.jogamp.test.junit.newt.parenting;
import java.lang.reflect.*;
import java.util.ArrayList;
@@ -66,6 +66,10 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting01bAWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static int width, height;
static long durationPerTest = 800;
static long waitReparent = 0;
diff --git a/src/junit/com/jogamp/test/junit/newt/TestParenting01cAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
index 7559390fa..0233a6aad 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestParenting01cAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
@@ -30,7 +30,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.test.junit.newt;
+package com.jogamp.test.junit.newt.parenting;
import java.lang.reflect.*;
import java.util.ArrayList;
@@ -67,6 +67,10 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting01cAWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static int width, height;
static long durationPerTest = 800;
static long waitReparent = 0;
@@ -124,13 +128,9 @@ public class TestParenting01cAWT {
frame1.setVisible(true);
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow());
- Animator animator1 = new Animator(glWindow1);
- animator1.start();
- while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) {
+ while(glWindow1.getDuration()<durationPerTest) {
Thread.sleep(100);
}
- animator1.stop();
- Assert.assertEquals(false, animator1.isAnimating());
frame1.setVisible(false);
Assert.assertEquals(false, glWindow1.isDestroyed());
@@ -149,6 +149,64 @@ public class TestParenting01cAWT {
//Assert.assertEquals(true, glWindow1.isDestroyed());
}
+ @Test
+ public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException {
+ int x = 0;
+ int y = 0;
+
+ NEWTEventFiFo eventFifo = new NEWTEventFiFo();
+
+ GLWindow glWindow1 = GLWindow.create(glCaps, true);
+ GLEventListener demo1 = new RedSquare();
+ setDemoFields(demo1, glWindow1, false);
+ glWindow1.addGLEventListener(demo1);
+
+ NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
+
+ Frame frame1 = new Frame("AWT Parent Frame");
+ frame1.setLayout(new BorderLayout());
+ frame1.add(new Button("North"), BorderLayout.NORTH);
+ frame1.add(new Button("South"), BorderLayout.SOUTH);
+ frame1.add(new Button("East"), BorderLayout.EAST);
+ frame1.add(new Button("West"), BorderLayout.WEST);
+ frame1.setSize(width, height);
+ frame1.setLocation(0, 0);
+ frame1.setVisible(true);
+
+ Frame frame2 = new Frame("AWT Parent Frame");
+ frame2.setLayout(new BorderLayout());
+ frame2.add(new Button("North"), BorderLayout.NORTH);
+ frame2.add(new Button("South"), BorderLayout.SOUTH);
+ frame2.add(new Button("East"), BorderLayout.EAST);
+ frame2.add(new Button("West"), BorderLayout.WEST);
+ frame2.setSize(width, height);
+ frame2.setLocation(640, 480);
+ frame2.setVisible(true);
+
+ frame1.add(newtCanvasAWT, BorderLayout.CENTER);
+ Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow());
+
+ int state = 0;
+ while(glWindow1.getDuration()<3*durationPerTest) {
+ Thread.sleep(durationPerTest);
+ switch(state) {
+ case 0:
+ frame1.remove(newtCanvasAWT);
+ frame2.add(newtCanvasAWT, BorderLayout.CENTER);
+ break;
+ case 1:
+ frame2.remove(newtCanvasAWT);
+ frame1.add(newtCanvasAWT, BorderLayout.CENTER);
+ break;
+ }
+ state++;
+ }
+
+ frame1.dispose();
+ frame2.dispose();
+ glWindow1.destroy(true);
+ }
+
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
Assert.assertNotNull(glWindow);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestParenting01cSwingAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
index a3a06aea3..07e60ed1c 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestParenting01cSwingAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
@@ -30,7 +30,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.test.junit.newt;
+package com.jogamp.test.junit.newt.parenting;
import java.lang.reflect.*;
import java.util.ArrayList;
@@ -70,6 +70,10 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting01cSwingAWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static int width, height;
static long durationPerTest = 800;
static long waitReparent = 0;
@@ -147,6 +151,7 @@ public class TestParenting01cSwingAWT {
jFrame1.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // equivalent to Frame, use windowClosing event!
jFrame1.setContentPane(jPanel1);
jFrame1.setSize(width, height);
+ System.out.println("Demos: 1 - Visible");
jFrame1.setVisible(true); // from here on, we need to run modifications on EDT
final JFrame _jFrame1 = jFrame1;
@@ -159,23 +164,27 @@ public class TestParenting01cSwingAWT {
while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) {
Thread.sleep(100);
}
+ System.out.println("Demos: 2 - StopAnimator");
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
+ System.out.println("Demos: 3 - !Visible");
_jFrame1.setVisible(false);
} });
Assert.assertEquals(false, glWindow1.isDestroyed());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
+ System.out.println("Demos: 4 - Visible");
_jFrame1.setVisible(true);
} });
Assert.assertEquals(false, glWindow1.isDestroyed());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
+ System.out.println("Demos: 5 - X Container");
_jPanel1.remove(_container1);
} });
// Assert.assertNull(glWindow1.getParentNativeWindow());
diff --git a/src/junit/com/jogamp/test/junit/newt/TestParenting02AWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
index 8d9a0f380..08a3dc425 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestParenting02AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
@@ -30,7 +30,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.test.junit.newt;
+package com.jogamp.test.junit.newt.parenting;
import java.lang.reflect.*;
import java.util.ArrayList;
@@ -65,6 +65,10 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting02AWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static int width, height;
static long durationPerTest = 500;
static long waitReparent = 300;
diff --git a/src/junit/com/jogamp/test/junit/newt/TestParenting02NEWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java
index 5be04fcc2..0f25d2275 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestParenting02NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java
@@ -30,7 +30,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.test.junit.newt;
+package com.jogamp.test.junit.newt.parenting;
import java.lang.reflect.*;
import java.util.ArrayList;
@@ -59,6 +59,10 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting02NEWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
static int width, height;
static long durationPerTest = 500;
@@ -122,6 +126,11 @@ public class TestParenting02NEWT {
glWindow1.setPosition(x,y);
glWindow1.addKeyListener(new TraceKeyAdapter(new KeyAction(eventFifo)));
glWindow1.addWindowListener(new TraceWindowAdapter());
+
+ GLEventListener demo1 = new RedSquare();
+ setDemoFields(demo1, window1, glWindow1, false);
+ // glWindow1.addGLEventListener(demo1);
+
glWindow1.setVisible(true);
Capabilities capsChosen = glWindow1.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
Assert.assertNotNull(capsChosen);
@@ -139,17 +148,17 @@ public class TestParenting02NEWT {
glWindow2.addKeyListener(new TraceKeyAdapter(new KeyAction(eventFifo)));
glWindow2.addWindowListener(new TraceWindowAdapter(new WindowAction(eventFifo)));
// glWindow2.addMouseListener(new TraceMouseAdapter());
+
+ GLEventListener demo2 = new Gears();
+ setDemoFields(demo2, window2, glWindow2, false);
+ // glWindow2.addGLEventListener(demo2);
+
glWindow2.setVisible(true);
capsChosen = glWindow2.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
Assert.assertNotNull(capsChosen);
Assert.assertTrue(capsChosen.isOnscreen()==true);
- GLEventListener demo1 = new RedSquare();
- setDemoFields(demo1, window1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
-
- GLEventListener demo2 = new Gears();
- setDemoFields(demo2, window2, glWindow2, false);
glWindow2.addGLEventListener(demo2);
boolean shouldQuit = false;
diff --git a/src/junit/com/jogamp/test/junit/newt/WindowAction.java b/src/junit/com/jogamp/test/junit/newt/parenting/WindowAction.java
index c52b895e6..387a06006 100644
--- a/src/junit/com/jogamp/test/junit/newt/WindowAction.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/WindowAction.java
@@ -30,7 +30,7 @@
* SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-package com.jogamp.test.junit.newt;
+package com.jogamp.test.junit.newt.parenting;
import com.jogamp.newt.event.*;