From d2ec9f34cf2b3a54c80e2e23671d8fa8a5397d5d Mon Sep 17 00:00:00 2001
From: Sven Gothel <sgothel@jausoft.com>
Date: Fri, 29 Oct 2010 04:01:56 +0200
Subject: Tests: Accomodate previous changes plus using AWT EDT for
 setVisible() as well.

---
 .../jogamp/test/junit/jogl/awt/TestAWT01GLn.java   |  19 ++-
 .../junit/jogl/awt/TestAWT02WindowClosing.java     |  11 +-
 ...TestSwingAWTRobotUsageBeforeJOGLInitBug411.java |   2 +-
 .../demos/gl2/gears/TestGearsNewtAWTWrapper.java   |   6 +-
 .../junit/jogl/offscreen/TestOffscreen01NEWT.java  |   2 +-
 .../junit/newt/TestDisplayLifecycle01NEWT.java     |   4 +-
 .../test/junit/newt/TestGLWindows01NEWT.java       |   6 +-
 .../junit/newt/TestGLWindows02NEWTAnimated.java    |  12 +-
 .../junit/newt/parenting/TestParenting01NEWT.java  | 156 +++++----------------
 .../junit/newt/parenting/TestParenting03AWT.java   |   6 +-
 .../junit/newt/parenting/TestParenting03bAWT.java  |   6 +-
 11 files changed, 81 insertions(+), 149 deletions(-)

(limited to 'src')

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 006010eeb..f3c228a5d 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
@@ -66,14 +66,17 @@ public class TestAWT01GLn extends UITestCase {
     public void release() {
         Assert.assertNotNull(frame);
         Assert.assertNotNull(glCanvas);
-        frame.setVisible(false);
         try {
-            frame.remove(glCanvas);
+            javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    frame.setVisible(false);
+                    frame.remove(glCanvas);
+                    frame.dispose();
+                }});
         } catch (Throwable t) {
             t.printStackTrace();
             Assume.assumeNoException(t);
         }
-        frame.dispose();
         frame=null;
         glCanvas=null;
     }
@@ -88,8 +91,16 @@ public class TestAWT01GLn extends UITestCase {
 
         glCanvas.display(); // one in process display 
 
+        try {
+            javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    frame.setVisible(true);
+                }});
+        } catch (Throwable t) {
+            t.printStackTrace();
+            Assume.assumeNoException(t);
+        }
         Animator animator = new Animator(glCanvas);
-        frame.setVisible(true);
         animator.start();
 
         Thread.sleep(500); // 500 ms
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT02WindowClosing.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT02WindowClosing.java
index 9e8cb916a..6132f8232 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT02WindowClosing.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT02WindowClosing.java
@@ -56,7 +56,16 @@ public class TestAWT02WindowClosing extends UITestCase {
         frame.setSize(500, 500);
         ClosingWindowAdapter closingWindowAdapter = new ClosingWindowAdapter(frame);
         frame.addWindowListener(closingWindowAdapter);
-        frame.setVisible(true);
+        final Frame _frame = frame;
+        try {
+            javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    _frame.setVisible(true);
+                }});
+        } catch (Throwable t) {
+            t.printStackTrace();
+            Assume.assumeNoException(t);
+        }
 
         Thread.sleep(durationPerTest);
         if(!closingWindowAdapter.closingCalled) {
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 fd1a15e52..3e54e1c8e 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
@@ -148,13 +148,13 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
         frame.setSize(512, 512);
         frame.setLocation(0, 0);
         frame.pack();
-        frame.setVisible(true);
 
         // AWT/Swing: From here on (post setVisible(true)
         //            you need to use AWT/Swing's invokeAndWait()
 
         javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
+                frame.setVisible(true);
                 colorPanel.setBackground(Color.white);
                 colorPanel.repaint();
             }});
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 27c353942..be1e5a58b 100644
--- 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
@@ -63,9 +63,9 @@ public class TestGearsNewtAWTWrapper extends UITestCase {
     }
 
     protected void runTestGL(GLCapabilities caps) throws InterruptedException {
-        Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display
-        Screen nScreen  = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0
-        Window nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps);
+        Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null, false); // local display
+        Screen nScreen  = NewtFactory.createScreen(nDisplay, 0); // screen 0
+        Window nWindow = NewtFactory.createWindow(nScreen, caps);
 
         GLWindow glWindow = GLWindow.create(nWindow);
         Assert.assertNotNull(glWindow);
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 1d699a1aa..ea77b2876 100644
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
@@ -251,7 +251,7 @@ public class TestOffscreen01NEWT extends UITestCase {
 
         for(i=0; i<winnum; i++) {
             System.out.println("Create Window "+i);
-            displays[i] = NewtFactory.createDisplay(null); // local display
+            displays[i] = NewtFactory.createDisplay(null, false); // local display
             Assert.assertNotNull(displays[i]);
             screens[i]  = NewtFactory.createScreen(displays[i], 0); // screen 0
             Assert.assertNotNull(screens[i]);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
index 2a7c32204..dbe51174e 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
@@ -259,7 +259,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase {
         Assert.assertEquals(0,Display.getActiveDisplayNumber());
 
         // Create Display/Screen, pending lazy native creation
-        Display display = NewtFactory.createDisplay(null); 
+        Display display = NewtFactory.createDisplay(null);
         Screen screen  = NewtFactory.createScreen(display, 0); // screen 0
         testDisplayCreate01(display, screen, false);
         testDisplayCreate01(display, screen, false);
@@ -272,7 +272,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase {
         Assert.assertEquals(0,Display.getActiveDisplayNumber());
 
         // Create Display/Screen, pending lazy native creation
-        Display display = NewtFactory.createDisplay(null); 
+        Display display = NewtFactory.createDisplay(null);
         Screen screen  = NewtFactory.createScreen(display, 0); // screen 0
         testDisplayCreate01(display, screen, true);
         testDisplayCreate01(display, screen, true);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
index 7c06879b2..112bb943c 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
@@ -281,8 +281,8 @@ public class TestGLWindows01NEWT extends UITestCase {
         System.out.println("duration1: "+window1.getDuration());
         System.out.println("duration2: "+window2.getDuration());
 
-        destroyWindow(window2, null, null, true);
         destroyWindow(window1, null, null, true);
+        destroyWindow(window2, null, null, true);
 
         Assert.assertEquals(0,Display.getActiveDisplayNumber());
 
@@ -300,10 +300,10 @@ public class TestGLWindows01NEWT extends UITestCase {
         GLCapabilities caps = new GLCapabilities(glp);
         Assert.assertNotNull(caps);
 
-        Display display1 = NewtFactory.createDisplay(null); // local display
+        Display display1 = NewtFactory.createDisplay(null, false); // local display
         Assert.assertNotNull(display1);
         display1.setDestroyWhenUnused(true);
-        Display display2 = NewtFactory.createDisplay(null); // local display
+        Display display2 = NewtFactory.createDisplay(null, false); // local display
         Assert.assertNotNull(display2);
         display2.setDestroyWhenUnused(true);
         Assert.assertNotSame(display1, display2);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
index 56730d42f..a6809e0bd 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
@@ -175,20 +175,20 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
             Thread.sleep(100);
         }
 
-        destroyWindow(window2, true);
-        Assert.assertEquals(false, animator2.isAnimating());
-
         destroyWindow(window1, true);
         Assert.assertEquals(false, animator1.isAnimating());
+
+        destroyWindow(window2, true);
+        Assert.assertEquals(false, animator2.isAnimating());
     }
     @Test
     public void testWindowDecor03TwoWinTwoDisplays() throws InterruptedException {
         GLCapabilities caps = new GLCapabilities(glp);
         Assert.assertNotNull(caps);
 
-        Display display1 = NewtFactory.createDisplay(null); // local display
+        Display display1 = NewtFactory.createDisplay(null, false); // local display
         Assert.assertNotNull(display1);
-        Display display2 = NewtFactory.createDisplay(null); // local display
+        Display display2 = NewtFactory.createDisplay(null, false); // local display
         Assert.assertNotNull(display2);
         Assert.assertNotSame(display1, display2);
 
@@ -215,7 +215,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase {
         destroyWindow(window1, true);
         Assert.assertEquals(false, animator1.isAnimating());
 
-        destroyWindow(window2, false);
+        destroyWindow(window2, true);
         Assert.assertEquals(false, animator2.isAnimating());
     }
 
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 5c9b23ded..91d8856f0 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -28,21 +28,12 @@
  
 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 javax.media.opengl.*;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.*;
 
 import com.jogamp.opengl.util.Animator;
 import com.jogamp.newt.*;
@@ -58,6 +49,7 @@ import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
 public class TestParenting01NEWT extends UITestCase {
     static int width, height;
     static long durationPerTest = 500;
+    static int frameWait = 2000;
     static GLCapabilities glCaps;
 
     @BeforeClass
@@ -127,7 +119,7 @@ public class TestParenting01NEWT extends UITestCase {
         Assert.assertEquals(0, glWindow2.getTotalFrames());
         glWindow1.setVisible(true);
         int wait;
-        for(wait=0; wait<10 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) { 
+        for(wait=0; wait<frameWait/100 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
             Thread.sleep(100); 
         }
         System.err.println("Frames for setVisible(true): A1: "+glWindow1.getTotalFrames()+", B1: "+glWindow2.getTotalFrames());
@@ -158,7 +150,7 @@ public class TestParenting01NEWT extends UITestCase {
         Assert.assertEquals(0, glWindow1.getTotalFrames());
         Assert.assertEquals(0, glWindow2.getTotalFrames());
         glWindow1.setVisible(true);
-        for(wait=0; wait<10 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) { 
+        for(wait=0; wait<frameWait/100 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
             Thread.sleep(100); 
         }
         System.err.println("Frames for setVisible(true): A2: "+glWindow1.getTotalFrames()+", B2: "+glWindow2.getTotalFrames());
@@ -208,7 +200,7 @@ public class TestParenting01NEWT extends UITestCase {
         Assert.assertEquals(true, animator2.isAnimating());
         Assert.assertEquals(false, animator2.isPaused());
         Assert.assertNotNull(animator2.getThread());
-        for(wait=0; wait<10 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) { 
+        for(wait=0; wait<frameWait/100 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
             Thread.sleep(100); 
         }
         System.err.println("Frames for setVisible(true): A4: "+glWindow1.getTotalFrames()+", B4: "+glWindow2.getTotalFrames());
@@ -270,7 +262,7 @@ public class TestParenting01NEWT extends UITestCase {
         Assert.assertEquals(0, glWindow1.getTotalFrames());
         Assert.assertEquals(0, glWindow2.getTotalFrames());
         glWindow1.setVisible(true);
-        for(wait=0; wait<10 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) { 
+        for(wait=0; wait<frameWait/100 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
             Thread.sleep(100); 
         }
         System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFrames()+", B3: "+glWindow2.getTotalFrames());
@@ -337,8 +329,6 @@ public class TestParenting01NEWT extends UITestCase {
         Assert.assertEquals(0,Display.getActiveDisplayNumber());
         Display display1 = null;
         Screen screen1 = null;
-        Display display2 = null;
-        Screen screen2 = null;
 
         NEWTEventFiFo eventFifo = new NEWTEventFiFo();
 
@@ -365,25 +355,22 @@ public class TestParenting01NEWT extends UITestCase {
         GLEventListener demo2 = new Gears();
         setDemoFields(demo2, glWindow2, false);
         glWindow2.addGLEventListener(demo2);
-        screen2 = glWindow2.getScreen();
-        display2 = screen2.getDisplay();
+        Assert.assertSame(screen1, glWindow2.getScreen());
+        Assert.assertSame(display1, glWindow2.getScreen().getDisplay());
 
-        Assert.assertEquals(true,display2.getDestroyWhenUnused());
-        Assert.assertEquals(0,display2.getReferenceCount());
-        Assert.assertEquals(false,display2.isNativeValid());
-        Assert.assertNotNull(display2.getEDTUtil());
-        Assert.assertEquals(true,display2.getEDTUtil().isRunning());
-        Assert.assertEquals(0,screen2.getReferenceCount());
-        Assert.assertEquals(false,screen2.isNativeValid());
+        Assert.assertEquals(true,display1.getDestroyWhenUnused());
+        Assert.assertEquals(0,display1.getReferenceCount());
+        Assert.assertEquals(false,display1.isNativeValid());
+        Assert.assertNotNull(display1.getEDTUtil());
+        Assert.assertEquals(true,display1.getEDTUtil().isRunning());
+        Assert.assertEquals(0,screen1.getReferenceCount());
+        Assert.assertEquals(false,screen1.isNativeValid());
         Assert.assertEquals(0,Display.getActiveDisplayNumber());
 
-        Assert.assertNotSame(screen1, screen2);
-        Assert.assertNotSame(display1, display2);
-
         Assert.assertEquals(0, glWindow1.getTotalFrames());
         glWindow1.setVisible(true);
         int wait=0;
-        while(wait<10 && glWindow1.getTotalFrames()<1) { Thread.sleep(100); wait++; }
+        while(wait<frameWait/100 && glWindow1.getTotalFrames()<1) { Thread.sleep(100); wait++; }
         System.err.println("Frames for setVisible(true) A1: "+glWindow1.getTotalFrames());
         Assert.assertTrue(0 < glWindow1.getTotalFrames());
 
@@ -398,7 +385,7 @@ public class TestParenting01NEWT extends UITestCase {
         Assert.assertEquals(0, glWindow2.getTotalFrames());
         glWindow2.setVisible(true);
         wait=0;
-        while(wait<10 && glWindow2.getTotalFrames()<1) { Thread.sleep(100); wait++; }
+        while(wait<frameWait/100 && glWindow2.getTotalFrames()<1) { Thread.sleep(100); wait++; }
         System.err.println("Frames for setVisible(true) B1: "+glWindow2.getTotalFrames());
         Assert.assertTrue(0 < glWindow1.getTotalFrames());
 
@@ -406,17 +393,9 @@ public class TestParenting01NEWT extends UITestCase {
         Assert.assertEquals(true,display1.isNativeValid());
         Assert.assertNotNull(display1.getEDTUtil());
         Assert.assertEquals(true,display1.getEDTUtil().isRunning());
-        Assert.assertEquals(1,screen1.getReferenceCount());
+        Assert.assertEquals(2,screen1.getReferenceCount());
         Assert.assertEquals(true,screen1.isNativeValid());
-
-        Assert.assertEquals(1,display2.getReferenceCount());
-        Assert.assertEquals(true,display2.isNativeValid());
-        Assert.assertNotNull(display2.getEDTUtil());
-        Assert.assertEquals(true,display2.getEDTUtil().isRunning());
-        Assert.assertEquals(1,screen2.getReferenceCount());
-        Assert.assertEquals(true,screen2.isNativeValid());
-
-        Assert.assertEquals(2,Display.getActiveDisplayNumber());
+        Assert.assertEquals(1,Display.getActiveDisplayNumber());
 
         Animator animator1 = new Animator(glWindow1);
         animator1.start();
@@ -435,7 +414,7 @@ public class TestParenting01NEWT extends UITestCase {
                     reparentAction = glWindow2.reparentWindow(glWindow1, reparentRecreate);
                     System.err.println("Frames(2) "+glWindow2.getTotalFrames());
                     Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction);
-                    for(wait=0; wait<10 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
+                    for(wait=0; wait<frameWait/100 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
                     System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFrames());
                     Assert.assertTrue(0 < glWindow2.getTotalFrames());
                     Assert.assertEquals(true, glWindow2.isVisible());
@@ -447,28 +426,10 @@ public class TestParenting01NEWT extends UITestCase {
                     Assert.assertNotNull(display1.getEDTUtil());
                     Assert.assertEquals(true,display1.getEDTUtil().isRunning());
                     Assert.assertEquals(true,screen1.isNativeValid());
-                    Assert.assertNotNull(display2.getEDTUtil());
-                    if(Window.ReparentAction.ACTION_NATIVE_REPARENTING >= reparentAction) {
-                        Assert.assertNotSame(screen1,glWindow2.getScreen());
-                        Assert.assertNotSame(display1,glWindow2.getScreen().getDisplay());
-                        Assert.assertEquals(1,screen1.getReferenceCount());
-                        Assert.assertEquals(1,display2.getReferenceCount());
-                        Assert.assertEquals(true,display2.isNativeValid());
-                        Assert.assertEquals(true,display2.getEDTUtil().isRunning());
-                        Assert.assertEquals(1,screen2.getReferenceCount());
-                        Assert.assertEquals(true,screen2.isNativeValid());
-                        Assert.assertEquals(2,Display.getActiveDisplayNumber());
-                    } else {
-                        Assert.assertSame(screen1,glWindow2.getScreen());
-                        Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
-                        Assert.assertEquals(2,screen1.getReferenceCount());
-                        Assert.assertEquals(0,display2.getReferenceCount());
-                        Assert.assertEquals(false,display2.isNativeValid());
-                        Assert.assertEquals(false,display2.getEDTUtil().isRunning());
-                        Assert.assertEquals(0,screen2.getReferenceCount());
-                        Assert.assertEquals(false,screen2.isNativeValid());
-                        Assert.assertEquals(1,Display.getActiveDisplayNumber());
-                    }
+                    Assert.assertSame(screen1,glWindow2.getScreen());
+                    Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
+                    Assert.assertEquals(2,screen1.getReferenceCount());
+                    Assert.assertEquals(1,Display.getActiveDisplayNumber());
 
                     break;
 
@@ -478,7 +439,7 @@ public class TestParenting01NEWT extends UITestCase {
 
                     reparentAction = glWindow2.reparentWindow(null, reparentRecreate);
                     Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction);
-                    for(wait=0; wait<10 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
+                    for(wait=0; wait<frameWait/100 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
                     System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3: "+glWindow2.getTotalFrames());
                     Assert.assertTrue(0 < glWindow2.getTotalFrames());
                     Assert.assertEquals(true, glWindow2.isVisible());
@@ -490,28 +451,10 @@ public class TestParenting01NEWT extends UITestCase {
                     Assert.assertNotNull(display1.getEDTUtil());
                     Assert.assertEquals(true,display1.getEDTUtil().isRunning());
                     Assert.assertEquals(true,screen1.isNativeValid());
-                    Assert.assertNotNull(display2.getEDTUtil());
-                    if(Window.ReparentAction.ACTION_NATIVE_REPARENTING >= reparentAction) {
-                        Assert.assertNotSame(screen1,glWindow2.getScreen());
-                        Assert.assertNotSame(display1,glWindow2.getScreen().getDisplay());
-                        Assert.assertEquals(1,screen1.getReferenceCount());
-                        Assert.assertEquals(1,display2.getReferenceCount());
-                        Assert.assertEquals(true,display2.isNativeValid());
-                        Assert.assertEquals(true,display2.getEDTUtil().isRunning());
-                        Assert.assertEquals(1,screen2.getReferenceCount());
-                        Assert.assertEquals(true,screen2.isNativeValid());
-                        Assert.assertEquals(2,Display.getActiveDisplayNumber());
-                    } else {
-                        Assert.assertSame(screen1,glWindow2.getScreen());
-                        Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
-                        Assert.assertEquals(2,screen1.getReferenceCount());
-                        Assert.assertEquals(0,display2.getReferenceCount());
-                        Assert.assertEquals(false,display2.isNativeValid());
-                        Assert.assertEquals(false,display2.getEDTUtil().isRunning());
-                        Assert.assertEquals(0,screen2.getReferenceCount());
-                        Assert.assertEquals(false,screen2.isNativeValid());
-                        Assert.assertEquals(1,Display.getActiveDisplayNumber());
-                    }
+                    Assert.assertSame(screen1,glWindow2.getScreen());
+                    Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
+                    Assert.assertEquals(2,screen1.getReferenceCount());
+                    Assert.assertEquals(1,Display.getActiveDisplayNumber());
 
                     break;
             }
@@ -531,26 +474,9 @@ public class TestParenting01NEWT extends UITestCase {
         Assert.assertEquals(true,display1.isNativeValid());
         Assert.assertNotNull(display1.getEDTUtil());
         Assert.assertEquals(true,display1.getEDTUtil().isRunning());
-        Assert.assertNotNull(display2.getEDTUtil());
-        if(!reparentRecreate) { 
-            Assert.assertEquals(1,screen1.getReferenceCount());
-            Assert.assertEquals(true,screen1.isNativeValid());
-            Assert.assertEquals(1,display2.getReferenceCount());
-            Assert.assertEquals(true,display2.isNativeValid());
-            Assert.assertEquals(true,display2.getEDTUtil().isRunning());
-            Assert.assertEquals(1,screen2.getReferenceCount());
-            Assert.assertEquals(true,screen2.isNativeValid());
-            Assert.assertEquals(2,Display.getActiveDisplayNumber());
-        } else {
-            Assert.assertEquals(2,screen1.getReferenceCount());
-            Assert.assertEquals(true,screen1.isNativeValid());
-            Assert.assertEquals(0,display2.getReferenceCount());
-            Assert.assertEquals(false,display2.isNativeValid());
-            Assert.assertEquals(false,display2.getEDTUtil().isRunning());
-            Assert.assertEquals(0,screen2.getReferenceCount());
-            Assert.assertEquals(false,screen2.isNativeValid());
-            Assert.assertEquals(1,Display.getActiveDisplayNumber());
-        }
+        Assert.assertEquals(2,screen1.getReferenceCount());
+        Assert.assertEquals(true,screen1.isNativeValid());
+        Assert.assertEquals(1,Display.getActiveDisplayNumber());
 
         // destroy glWindow2
         glWindow2.destroy(true);
@@ -564,13 +490,6 @@ public class TestParenting01NEWT extends UITestCase {
         Assert.assertEquals(1,screen1.getReferenceCount());
         Assert.assertEquals(true,screen1.isNativeValid());
 
-        Assert.assertEquals(0,display2.getReferenceCount());
-        Assert.assertEquals(false,display2.isNativeValid());
-        Assert.assertNotNull(display2.getEDTUtil());
-        Assert.assertEquals(false,display2.getEDTUtil().isRunning());
-        Assert.assertEquals(0,screen2.getReferenceCount());
-        Assert.assertEquals(false,screen2.isNativeValid());
-
         Assert.assertEquals(1,Display.getActiveDisplayNumber());
 
         // destroy glWindow1
@@ -585,13 +504,6 @@ public class TestParenting01NEWT extends UITestCase {
         Assert.assertEquals(0,screen1.getReferenceCount());
         Assert.assertEquals(false,screen1.isNativeValid());
 
-        Assert.assertEquals(0,display2.getReferenceCount());
-        Assert.assertEquals(false,display2.isNativeValid());
-        Assert.assertNotNull(display2.getEDTUtil());
-        Assert.assertEquals(false,display2.getEDTUtil().isRunning());
-        Assert.assertEquals(0,screen2.getReferenceCount());
-        Assert.assertEquals(false,screen2.isNativeValid());
-
         Assert.assertEquals(0,Display.getActiveDisplayNumber());
     }
 
@@ -659,7 +571,7 @@ public class TestParenting01NEWT extends UITestCase {
         Assert.assertEquals(0, glWindow2.getTotalFrames());
         glWindow1.setVisible(true);
         int wait;
-        for(wait=0; wait<10 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) { 
+        for(wait=0; wait<frameWait/100 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
             Thread.sleep(100); 
         }
         System.err.println("Frames for setVisible(): A1: "+glWindow1.getTotalFrames()+", B1: "+glWindow2.getTotalFrames());
@@ -691,7 +603,7 @@ public class TestParenting01NEWT extends UITestCase {
                     Assert.assertEquals(true, glWindow2.isVisible());
                     reparentAction = glWindow2.reparentWindow(null, reparentRecreate);
                     Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction);
-                    for(wait=0; wait<10 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
+                    for(wait=0; wait<frameWait/100 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
                     System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFrames());
                     Assert.assertTrue(0 < glWindow2.getTotalFrames());
                     Assert.assertEquals(true, glWindow2.isVisible());
@@ -705,7 +617,7 @@ public class TestParenting01NEWT extends UITestCase {
                     Assert.assertEquals(true, glWindow2.isVisible());
                     reparentAction = glWindow2.reparentWindow(glWindow1, reparentRecreate);
                     Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction);
-                    for(wait=0; wait<10 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
+                    for(wait=0; wait<frameWait/100 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); }
                     System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3 "+glWindow2.getTotalFrames());
                     Assert.assertTrue(0 < glWindow2.getTotalFrames());
                     Assert.assertEquals(true, glWindow2.isVisible());
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 7909b0320..5fa7dee41 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java
@@ -79,11 +79,11 @@ public class TestParenting03AWT extends UITestCase {
     }
 
     @Test
-    public void testWindowParenting1AWT2NewtChilds01() throws InterruptedException, InvocationTargetException {
-        testWindowParenting1AWT2NewtChilds(true);
+    public void testWindowParenting1AWTOneNewtChild01() throws InterruptedException, InvocationTargetException {
+        testWindowParenting1AWTOneNewtChild();
     }
 
-    public void testWindowParenting1AWT2NewtChilds(boolean visibleChild2) throws InterruptedException, InvocationTargetException {
+    public void testWindowParenting1AWTOneNewtChild() throws InterruptedException, InvocationTargetException {
         int x = 0;
         int y = 0;
 
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java
index 2c2049ea0..b4ced6973 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java
@@ -77,11 +77,11 @@ public class TestParenting03bAWT extends UITestCase {
     }
 
     @Test
-    public void testWindowParenting1AWT2NewtChilds01() throws InterruptedException, InvocationTargetException {
-        testWindowParenting1AWT2NewtChilds(true);
+    public void testWindowParenting1AWTTwoNewtChilds01() throws InterruptedException, InvocationTargetException {
+        testWindowParenting1AWTTwoNewtChilds();
     }
 
-    public void testWindowParenting1AWT2NewtChilds(boolean visibleChild2) throws InterruptedException, InvocationTargetException {
+    public void testWindowParenting1AWTTwoNewtChilds() throws InterruptedException, InvocationTargetException {
         int x = 0;
         int y = 0;
 
-- 
cgit v1.2.3