summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/junit/com/jogamp')
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java316
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java26
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java4
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java8
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java54
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java26
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java14
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java24
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java10
9 files changed, 399 insertions, 83 deletions
diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
new file mode 100644
index 000000000..f0ceba606
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
@@ -0,0 +1,316 @@
+/*
+ * 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.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 TestDisplayLifecycle01NEWT {
+ static {
+ GLProfile.initSingleton();
+ }
+
+ static GLProfile glp;
+ static GLCapabilities caps;
+ static int width, height;
+ static long durationPerTest = 100; // ms
+
+ @BeforeClass
+ public static void initClass() {
+ width = 640;
+ height = 480;
+ glp = GLProfile.getDefault();
+ caps = new GLCapabilities(glp);
+ }
+
+ static GLWindow createWindow(Screen screen, GLCapabilities caps, int width, int height)
+ throws InterruptedException
+ {
+ Assert.assertNotNull(caps);
+
+ //
+ // Create native windowing resources .. X11/Win/OSX
+ //
+ GLWindow glWindow;
+ if(null!=screen) {
+ Window window = NewtFactory.createWindow(screen, caps, false);
+ Assert.assertNotNull(window);
+ glWindow = GLWindow.create(window);
+ } else {
+ glWindow = GLWindow.create(caps, false);
+ }
+
+ GLEventListener demo = new Gears();
+ setDemoFields(demo, glWindow);
+ glWindow.addGLEventListener(demo);
+ glWindow.addWindowListener(new TraceWindowAdapter());
+ glWindow.setSize(width, height);
+ return glWindow;
+ }
+
+ private void testDisplayCreate01(Display display, Screen screen, boolean destroyWhenUnused) throws InterruptedException {
+ // start-state == end-state
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+ Assert.assertEquals(0,display.getReferenceCount());
+ Assert.assertEquals(false,display.isNativeValid());
+ Assert.assertNotNull(display.getEDTUtil());
+ Assert.assertEquals(false,display.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen.getReferenceCount());
+ Assert.assertEquals(false,screen.isNativeValid());
+
+ // Setup/Verify default DestroyWhenUnused behavior
+ if(destroyWhenUnused) {
+ screen.setDestroyWhenUnused(true);
+ }
+ Assert.assertEquals(destroyWhenUnused,display.getDestroyWhenUnused());
+ Assert.assertEquals(destroyWhenUnused,screen.getDestroyWhenUnused());
+
+ // Create Window, pending lazy native creation
+ GLWindow window = createWindow(screen, caps, width, height);
+ Assert.assertEquals(screen,window.getScreen());
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+ Assert.assertEquals(0,display.getReferenceCount());
+ Assert.assertEquals(false,display.isNativeValid());
+ Assert.assertEquals(false,display.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen.getReferenceCount());
+ Assert.assertEquals(false,screen.isNativeValid());
+ Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+
+ // lazy native creation sequence: Display, Screen and Window
+ window.setVisible(true);
+ window.display();
+ int wait=0;
+ while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; }
+ System.out.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
+
+ Assert.assertEquals(screen,window.getScreen());
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ Assert.assertEquals(1,display.getReferenceCount());
+ Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertEquals(true,display.getEDTUtil().isRunning());
+ Assert.assertEquals(1,screen.getReferenceCount());
+ Assert.assertEquals(true,screen.isNativeValid());
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+
+ while(window.getDuration()<1*durationPerTest) {
+ window.display();
+ Thread.sleep(100);
+ }
+ System.out.println("duration: "+window.getDuration());
+
+ // just make the Window invisible
+ window.setVisible(false);
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+
+ // just make the Window visible again
+ window.setVisible(true);
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+
+ while(window.getDuration()<2*durationPerTest) {
+ window.display();
+ Thread.sleep(100);
+ }
+ System.out.println("duration: "+window.getDuration());
+
+ // recoverable destruction, ie Display/Screen untouched
+ window.destroy(false);
+ Assert.assertEquals(screen,window.getScreen());
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ Assert.assertEquals(1,display.getReferenceCount());
+ Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertNotNull(display.getEDTUtil());
+ Assert.assertEquals(true,display.getEDTUtil().isRunning());
+ Assert.assertEquals(1,screen.getReferenceCount());
+ Assert.assertEquals(true,screen.isNativeValid());
+ Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+
+ // a display call shall not change a thing
+ window.display();
+ Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+
+ // recover Window
+ window.setVisible(true);
+ window.display();
+ wait=0;
+ while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; }
+ System.out.println("Frames for setVisible(true) 2: "+window.getTotalFrames());
+
+ Assert.assertEquals(screen,window.getScreen());
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ Assert.assertEquals(1,display.getReferenceCount());
+ Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertEquals(true,display.getEDTUtil().isRunning());
+ Assert.assertEquals(1,screen.getReferenceCount());
+ Assert.assertEquals(true,screen.isNativeValid());
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+
+ while(window.getDuration()<1*durationPerTest) {
+ window.display();
+ Thread.sleep(100);
+ }
+ System.out.println("duration: "+window.getDuration());
+
+ // unrecoverable destruction, ie Display/Screen will be unreferenced
+ window.destroy(true);
+ Assert.assertEquals(null,window.getScreen());
+ Display.dumpDisplayList("Post destroy(true)");
+ if(!destroyWhenUnused) {
+ // display/screen untouched when unused, default
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ Assert.assertEquals(1,display.getReferenceCount());
+ Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertNotNull(display.getEDTUtil());
+ Assert.assertEquals(true,display.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen.getReferenceCount());
+ Assert.assertEquals(true,screen.isNativeValid());
+
+ // manual destruction: Screen
+ screen.destroy();
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ Assert.assertEquals(0,display.getReferenceCount());
+ Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertNotNull(display.getEDTUtil());
+ Assert.assertEquals(true,display.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen.getReferenceCount());
+ Assert.assertEquals(false,screen.isNativeValid());
+
+ // manual destruction: Display
+ display.destroy();
+ } else {
+ // display/screen destroyed when unused
+ }
+
+ // end-state == start-state
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+ Assert.assertEquals(0,display.getReferenceCount());
+ Assert.assertEquals(false,display.isNativeValid());
+ Assert.assertNotNull(display.getEDTUtil());
+ Assert.assertEquals(false,display.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen.getReferenceCount());
+ Assert.assertEquals(false,screen.isNativeValid());
+
+ Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+ }
+
+ @Test
+ public void testDisplayCreate01_DestroyWhenUnused_False() throws InterruptedException {
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+
+ // Create Display/Screen, pending lazy native creation
+ Display display = NewtFactory.createDisplay(null);
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ testDisplayCreate01(display, screen, false);
+ testDisplayCreate01(display, screen, false);
+
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+ }
+
+ @Test
+ public void testDisplayCreate01_DestroyWhenUnused_True() throws InterruptedException {
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+
+ // Create Display/Screen, pending lazy native creation
+ Display display = NewtFactory.createDisplay(null);
+ Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ testDisplayCreate01(display, screen, true);
+ testDisplayCreate01(display, screen, true);
+
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+ }
+
+ 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]);
+ }
+ }
+ System.out.println("durationPerTest: "+durationPerTest);
+ String tstname = TestDisplayLifecycle01NEWT.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/TestGLWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
index ea31dfc02..98036fc42 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
@@ -93,7 +93,7 @@ public class TestGLWindows01NEWT {
}
Assert.assertNotNull(glWindow);
Assert.assertEquals(false,glWindow.isVisible());
- Assert.assertEquals(false,glWindow.isNativeWindowValid());
+ Assert.assertEquals(false,glWindow.isNativeValid());
GLEventListener demo = new Gears();
setDemoFields(demo, glWindow);
@@ -106,7 +106,7 @@ public class TestGLWindows01NEWT {
glWindow.setVisible(true);
Assert.assertEquals(true,glWindow.isVisible());
- Assert.assertEquals(true,glWindow.isNativeWindowValid());
+ Assert.assertEquals(true,glWindow.isNativeValid());
int wait=0;
while(wait<10 && glWindow.getTotalFrames()<1) { Thread.sleep(100); wait++; }
System.out.println("Frames for initial setVisible(true): "+glWindow.getTotalFrames());
@@ -137,7 +137,7 @@ public class TestGLWindows01NEWT {
static void destroyWindow(GLWindow glWindow, boolean deep) {
if(null!=glWindow) {
glWindow.destroy(deep);
- Assert.assertEquals(false,glWindow.isNativeWindowValid());
+ Assert.assertEquals(false,glWindow.isNativeValid());
}
}
@@ -149,22 +149,22 @@ public class TestGLWindows01NEWT {
true /* onscreen */, false /* undecorated */,
false /*addGLEventListenerAfterVisible*/);
- Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
window.destroy(false);
- Assert.assertEquals(false,window.isNativeWindowValid());
+ Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
window.display();
- Assert.assertEquals(false,window.isNativeWindowValid());
+ Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
window.setVisible(true);
- Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
window.setVisible(false);
- Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
destroyWindow(window, true);
@@ -178,22 +178,22 @@ public class TestGLWindows01NEWT {
true /* onscreen */, false /* undecorated */,
true /*addGLEventListenerAfterVisible*/);
- Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
window.destroy(false);
- Assert.assertEquals(false,window.isNativeWindowValid());
+ Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
window.display();
- Assert.assertEquals(false,window.isNativeWindowValid());
+ Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
window.setVisible(true);
- Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
window.setVisible(false);
- Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
destroyWindow(window, true);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
index 0677bc82c..49b49cc02 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
@@ -93,13 +93,13 @@ public class TestGLWindows02NEWTAnimated {
setDemoFields(demo, glWindow);
glWindow.addGLEventListener(demo);
glWindow.addWindowListener(new TraceWindowAdapter());
- Assert.assertEquals(false,glWindow.isNativeWindowValid());
+ Assert.assertEquals(false,glWindow.isNativeValid());
glWindow.setSize(width, height);
Assert.assertEquals(false,glWindow.isVisible());
glWindow.setVisible(true);
Assert.assertEquals(true,glWindow.isVisible());
- Assert.assertEquals(true,glWindow.isNativeWindowValid());
+ Assert.assertEquals(true,glWindow.isNativeValid());
// Assert.assertEquals(width,glWindow.getWidth());
// Assert.assertEquals(height,glWindow.getHeight());
// System.out.println("Created: "+glWindow);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
index 89d9c1ca2..7e39ee2c8 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
@@ -69,11 +69,11 @@ public class TestWindows01NEWT {
Window window = NewtFactory.createWindow(screen, caps, onscreen && undecorated);
Assert.assertNotNull(window);
window.setSize(width, height);
- Assert.assertEquals(false,window.isNativeWindowValid());
+ Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
window.setVisible(true);
Assert.assertEquals(true,window.isVisible());
- Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isNativeValid());
// Assert.assertEquals(width,window.getWidth());
// Assert.assertEquals(height,window.getHeight());
// System.out.println("Created: "+window);
@@ -115,11 +115,11 @@ public class TestWindows01NEWT {
Window window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
window.destroy();
- Assert.assertEquals(false,window.isNativeWindowValid());
+ Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
window.setVisible(true);
- Assert.assertEquals(true,window.isNativeWindowValid());
+ Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
Thread.sleep(100); // 100 ms
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 68dfa2c06..b4e5af489 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -86,7 +86,7 @@ public class TestParenting01NEWT {
GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy");
glWindow1.setSize(640, 480);
@@ -97,7 +97,7 @@ public class TestParenting01NEWT {
GLWindow glWindow2 = GLWindow.create(glWindow1, glCaps);
Assert.assertNotNull(glWindow2);
Assert.assertEquals(false, glWindow2.isVisible());
- Assert.assertEquals(false, glWindow2.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow2.isNativeValid());
Assert.assertEquals(glWindow1,glWindow2.getParentNativeWindow());
glWindow2.setSize(320, 240);
GLEventListener demo2 = new Gears();
@@ -107,19 +107,19 @@ public class TestParenting01NEWT {
// visible test
glWindow1.setVisible(true);
Assert.assertEquals(true, glWindow1.isVisible());
- Assert.assertEquals(true, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(true, glWindow2.isVisible());
- Assert.assertEquals(true, glWindow2.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow2.isNativeValid());
glWindow1.setVisible(false);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(true, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(false, glWindow2.isVisible());
- Assert.assertEquals(true, glWindow2.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow2.isNativeValid());
glWindow1.setVisible(true);
Assert.assertEquals(true, glWindow1.isVisible());
- Assert.assertEquals(true, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(true, glWindow2.isVisible());
- Assert.assertEquals(true, glWindow2.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow2.isNativeValid());
Animator animator1 = new Animator(glWindow1);
animator1.start();
@@ -136,20 +136,20 @@ public class TestParenting01NEWT {
glWindow1.destroy(); // false
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
+ Assert.assertEquals(true, glWindow1.isValid());
Assert.assertEquals(false, glWindow2.isVisible());
- Assert.assertEquals(false, glWindow2.isNativeWindowValid());
- Assert.assertEquals(false, glWindow2.isDestroyed());
+ Assert.assertEquals(false, glWindow2.isNativeValid());
+ Assert.assertEquals(true, glWindow2.isValid());
glWindow1.destroy(true);
- Assert.assertEquals(true, glWindow1.isDestroyed());
- Assert.assertEquals(true, glWindow2.isDestroyed());
+ Assert.assertEquals(false, glWindow1.isValid());
+ Assert.assertEquals(false, glWindow2.isValid());
// test double destroy ..
glWindow2.destroy(true);
- Assert.assertEquals(true, glWindow2.isDestroyed());
+ Assert.assertEquals(false, glWindow2.isValid());
}
@Test
@@ -188,14 +188,14 @@ public class TestParenting01NEWT {
Assert.assertEquals(true, glWindow2.isVisible());
glWindow2.reparentWindow(glWindow1, null);
Assert.assertEquals(true, glWindow2.isVisible());
- Assert.assertEquals(true, glWindow2.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertEquals(glWindow1,glWindow2.getParentNativeWindow());
break;
case 1:
Assert.assertEquals(true, glWindow2.isVisible());
glWindow2.reparentWindow(null, null);
Assert.assertEquals(true, glWindow2.isVisible());
- Assert.assertEquals(true, glWindow2.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertNull(glWindow2.getParentNativeWindow());
break;
}
@@ -207,11 +207,11 @@ public class TestParenting01NEWT {
Assert.assertEquals(false, animator2.isAnimating());
glWindow1.destroy(true);
- Assert.assertEquals(true, glWindow1.isDestroyed());
- Assert.assertEquals(false, glWindow2.isDestroyed());
+ Assert.assertEquals(false, glWindow1.isValid());
+ Assert.assertEquals(true , glWindow2.isValid());
glWindow2.destroy(true);
- Assert.assertEquals(true, glWindow1.isDestroyed());
- Assert.assertEquals(true, glWindow2.isDestroyed());
+ Assert.assertEquals(false, glWindow1.isValid());
+ Assert.assertEquals(false, glWindow2.isValid());
}
@Test
@@ -249,14 +249,14 @@ public class TestParenting01NEWT {
Assert.assertEquals(true, glWindow2.isVisible());
glWindow2.reparentWindow(null, null);
Assert.assertEquals(true, glWindow2.isVisible());
- Assert.assertEquals(true, glWindow2.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertNull(glWindow2.getParentNativeWindow());
break;
case 1:
Assert.assertEquals(true, glWindow2.isVisible());
glWindow2.reparentWindow(glWindow1, null);
Assert.assertEquals(true, glWindow2.isVisible());
- Assert.assertEquals(true, glWindow2.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertEquals(glWindow1,glWindow2.getParentNativeWindow());
break;
}
@@ -268,11 +268,11 @@ public class TestParenting01NEWT {
Assert.assertEquals(false, animator2.isAnimating());
glWindow1.destroy(true);
- Assert.assertEquals(true, glWindow1.isDestroyed());
- Assert.assertEquals(true, glWindow2.isDestroyed());
+ Assert.assertEquals(false, glWindow1.isValid());
+ Assert.assertEquals(false, glWindow2.isValid());
glWindow2.destroy(true);
- Assert.assertEquals(true, glWindow1.isDestroyed());
- Assert.assertEquals(true, glWindow2.isDestroyed());
+ Assert.assertEquals(false, glWindow1.isValid());
+ Assert.assertEquals(false, glWindow2.isValid());
}
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
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 28b95884d..668504ebe 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
@@ -93,7 +93,7 @@ public class TestParenting01aAWT {
GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy");
GLEventListener demo1 = new RedSquare();
@@ -103,7 +103,7 @@ public class TestParenting01aAWT {
NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
Assert.assertNotNull(newtCanvasAWT);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
Frame frame1 = new Frame("AWT Parent Frame");
@@ -137,20 +137,20 @@ public class TestParenting01aAWT {
Assert.assertEquals(false, animator1.isAnimating());
frame1.setVisible(false);
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
frame1.setVisible(true);
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
frame1.remove(newtCanvasAWT);
// Assert.assertNull(glWindow1.getParentNativeWindow());
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
frame1.dispose();
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
glWindow1.destroy(true);
- //Assert.assertEquals(true, glWindow1.isDestroyed());
+ //Assert.assertEquals(false, glWindow1.isValid());
}
@Test
@@ -163,7 +163,7 @@ public class TestParenting01aAWT {
GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
GLEventListener demo1 = new RedSquare();
setDemoFields(demo1, glWindow1, false);
@@ -172,7 +172,7 @@ public class TestParenting01aAWT {
NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
Assert.assertNotNull(newtCanvasAWT);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
Frame frame = new Frame("AWT Parent Frame");
@@ -263,12 +263,12 @@ public class TestParenting01aAWT {
switch(state) {
case 0:
glWindow1.reparentWindow(null, null);
- Assert.assertEquals(true, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
break;
case 1:
glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow(), null);
- Assert.assertEquals(true, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow());
break;
}
@@ -318,12 +318,12 @@ public class TestParenting01aAWT {
switch(state) {
case 0:
glWindow1.reparentWindow(null, null);
- Assert.assertEquals(true, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
break;
case 1:
glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow(), null);
- Assert.assertEquals(true, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow());
break;
}
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
index abd5b95ce..68de3c595 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
@@ -92,7 +92,7 @@ public class TestParenting01cAWT {
GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy");
GLEventListener demo1 = new RedSquare();
@@ -102,7 +102,7 @@ public class TestParenting01cAWT {
NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
Assert.assertNotNull(newtCanvasAWT);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
Frame frame1 = new Frame("AWT Parent Frame");
@@ -132,20 +132,20 @@ public class TestParenting01cAWT {
}
frame1.setVisible(false);
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
frame1.setVisible(true);
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
frame1.remove(newtCanvasAWT);
// Assert.assertNull(glWindow1.getParentNativeWindow());
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
frame1.dispose();
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
glWindow1.destroy(true);
- //Assert.assertEquals(true, glWindow1.isDestroyed());
+ //Assert.assertEquals(false, glWindow1.isValid());
}
@Test
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
index 07e60ed1c..c79a76274 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
@@ -99,7 +99,7 @@ public class TestParenting01cSwingAWT {
GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy");
GLEventListener demo1 = new RedSquare();
@@ -127,7 +127,7 @@ public class TestParenting01cSwingAWT {
NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
Assert.assertNotNull(newtCanvasAWT);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
Container container1 = new Container();
@@ -173,14 +173,14 @@ public class TestParenting01cSwingAWT {
System.out.println("Demos: 3 - !Visible");
_jFrame1.setVisible(false);
} });
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
System.out.println("Demos: 4 - Visible");
_jFrame1.setVisible(true);
} });
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -188,16 +188,16 @@ public class TestParenting01cSwingAWT {
_jPanel1.remove(_container1);
} });
// Assert.assertNull(glWindow1.getParentNativeWindow());
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
_jFrame1.dispose();
} });
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
glWindow1.destroy(true);
- //Assert.assertEquals(true, glWindow1.isDestroyed());
+ //Assert.assertEquals(false, glWindow1.isValid());
}
@Test
@@ -213,7 +213,7 @@ public class TestParenting01cSwingAWT {
GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy");
GLEventListener demo1 = new RedSquare();
@@ -240,7 +240,7 @@ public class TestParenting01cSwingAWT {
NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
Assert.assertNotNull(newtCanvasAWT);
Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(false, glWindow1.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParentNativeWindow());
Container container1 = new Container();
@@ -322,17 +322,17 @@ public class TestParenting01cSwingAWT {
_jFrame1.setVisible(false);
_jFrame2.setVisible(false);
} });
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
_jFrame1.dispose();
_jFrame2.dispose();
} });
- Assert.assertEquals(false, glWindow1.isDestroyed());
+ Assert.assertEquals(true, glWindow1.isValid());
glWindow1.destroy(true);
- //Assert.assertEquals(true, glWindow1.isDestroyed());
+ //Assert.assertEquals(false, glWindow1.isValid());
}
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
index 08a3dc425..c5993d6fa 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
@@ -117,7 +117,7 @@ public class TestParenting02AWT {
NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow);
Assert.assertNotNull(newtCanvasAWT);
Assert.assertEquals(false, glWindow.isVisible());
- Assert.assertEquals(false, glWindow.isNativeWindowValid());
+ Assert.assertEquals(false, glWindow.isNativeValid());
Assert.assertNull(glWindow.getParentNativeWindow());
Frame frame = new Frame("AWT Parent Frame");
@@ -158,9 +158,9 @@ public class TestParenting02AWT {
Thread.yield();
// 1st display .. creation
glWindow.display();
- } while(!glWindow.isNativeWindowValid()) ;
+ } while(!glWindow.isNativeValid()) ;
- Assert.assertEquals(true, glWindow.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow.isNativeValid());
Assert.assertNotNull(glWindow.getParentNativeWindow());
if(verbose) {
System.out.println("+++++++++++++++++++ 1st ADDED");
@@ -171,7 +171,7 @@ public class TestParenting02AWT {
// test some fancy re-layout ..
frame.remove(newtCanvasAWT);
Assert.assertEquals(false, glWindow.isVisible());
- Assert.assertEquals(true, glWindow.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow.isNativeValid());
Assert.assertNull(glWindow.getParentNativeWindow());
if(verbose) {
System.out.println("+++++++++++++++++++ REMOVED!");
@@ -182,7 +182,7 @@ public class TestParenting02AWT {
frame.add(newtCanvasAWT, BorderLayout.CENTER);
glWindow.display();
Assert.assertEquals(true, glWindow.isVisible());
- Assert.assertEquals(true, glWindow.isNativeWindowValid());
+ Assert.assertEquals(true, glWindow.isNativeValid());
Assert.assertNotNull(glWindow.getParentNativeWindow());
if(verbose) {
System.out.println("+++++++++++++++++++ 2nd ADDED");