diff options
Diffstat (limited to 'src/junit/com/jogamp/test')
6 files changed, 38 insertions, 84 deletions
diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java index dbe51174e..44b4e7325 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java @@ -124,10 +124,6 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { // lazy native creation sequence: Display, Screen and Window Assert.assertEquals(0, window.getTotalFrames()); window.setVisible(true); - int wait=0; - while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; } - System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); - Assert.assertTrue(0 < window.getTotalFrames()); Assert.assertEquals(screen,window.getScreen()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); @@ -138,6 +134,8 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); + System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); + Assert.assertTrue(0 < window.getTotalFrames()); while(window.getDuration()<1*durationPerTest) { window.display(); @@ -154,11 +152,9 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { window.resetCounter(); Assert.assertEquals(0, window.getTotalFrames()); window.setVisible(true); - wait=0; - while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; } - System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); + System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); Assert.assertTrue(0 < window.getTotalFrames()); while(window.getDuration()<2*durationPerTest) { @@ -190,10 +186,6 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { // recover Window window.setVisible(true); - wait=0; - while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; } - System.err.println("Frames for setVisible(true) 2: "+window.getTotalFrames()); - Assert.assertTrue(0 < window.getTotalFrames()); Assert.assertEquals(screen,window.getScreen()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); @@ -204,6 +196,8 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); + System.err.println("Frames for setVisible(true) 2: "+window.getTotalFrames()); + Assert.assertTrue(0 < window.getTotalFrames()); while(window.getDuration()<1*durationPerTest) { window.display(); diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java index 9e0804a3d..7253b7353 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java @@ -111,10 +111,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { // lazy native creation sequence: Display, Screen and Window Assert.assertEquals(0, window.getTotalFrames()); window.setVisible(true); - int wait=0; - while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; } - System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); - Assert.assertTrue(0 < window.getTotalFrames()); Assert.assertEquals(screen,window.getScreen()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); @@ -126,6 +122,8 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); + System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); + Assert.assertTrue(0 < window.getTotalFrames()); while(window.getDuration()<1*durationPerTest) { window.display(); @@ -142,11 +140,9 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { window.resetCounter(); Assert.assertEquals(0, window.getTotalFrames()); window.setVisible(true); - wait=0; - while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; } - System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); + System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames()); Assert.assertTrue(0 < window.getTotalFrames()); while(window.getDuration()<2*durationPerTest) { @@ -179,10 +175,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { // recover Window window.setVisible(true); - wait=0; - while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; } - System.err.println("Frames for setVisible(true) 2: "+window.getTotalFrames()); - Assert.assertTrue(0 < window.getTotalFrames()); Assert.assertEquals(screen,window.getScreen()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); @@ -194,6 +186,8 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); + System.err.println("Frames for setVisible(true) 2: "+window.getTotalFrames()); + Assert.assertTrue(0 < window.getTotalFrames()); while(window.getDuration()<1*durationPerTest) { window.display(); @@ -264,10 +258,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { // lazy native creation sequence: Display, Screen and Window Assert.assertEquals(0, window1.getTotalFrames()); window1.setVisible(true); - int wait=0; - while(wait<10 && window1.getTotalFrames()<1) { Thread.sleep(100); wait++; } - System.err.println("Frames for setVisible(true) 1: "+window1.getTotalFrames()); - Assert.assertTrue(0 < window1.getTotalFrames()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); Assert.assertEquals(1,display.getReferenceCount()); @@ -278,13 +268,11 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window1.isNativeValid()); Assert.assertEquals(true,window1.isVisible()); + System.err.println("Frames for setVisible(true) 1: "+window1.getTotalFrames()); + Assert.assertTrue(0 < window1.getTotalFrames()); Assert.assertEquals(0, window2.getTotalFrames()); window2.setVisible(true); - wait=0; - while(wait<10 && window2.getTotalFrames()<1) { Thread.sleep(100); wait++; } - System.err.println("Frames for setVisible(true) 2: "+window2.getTotalFrames()); - Assert.assertTrue(0 < window2.getTotalFrames()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); Assert.assertEquals(1,display.getReferenceCount()); @@ -295,6 +283,8 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window2.isNativeValid()); Assert.assertEquals(true,window2.isVisible()); + System.err.println("Frames for setVisible(true) 2: "+window2.getTotalFrames()); + Assert.assertTrue(0 < window2.getTotalFrames()); while(window1.getDuration()<1*durationPerTest) { window1.display(); diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java index 1002fc9f8..49591aab8 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java +++ b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java @@ -144,8 +144,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase { frame1.setVisible(true); Assert.assertTrue(AWTRobotUtil.toFront(robot, frame1)); - int wait=0; - while(wait<10 && glWindow1.getTotalFrames()<1) { Thread.sleep(100); wait++; } + Assert.assertTrue(glWindow1.isVisible()); System.out.println("Frames for initial setVisible(true): "+glWindow1.getTotalFrames()); Assert.assertTrue(0 < glWindow1.getTotalFrames()); diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java index 3891f1565..af959a2eb 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java +++ b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java @@ -44,8 +44,6 @@ import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.util.ArrayList; -import java.util.List; -import java.util.Iterator; import javax.media.opengl.*; @@ -164,9 +162,8 @@ public class TestFocus02SwingAWTRobot extends UITestCase { jFrame1.setVisible(true); // from here on, we need to run modifications on EDT Assert.assertTrue(AWTRobotUtil.toFront(robot, jFrame1)); - int wait=0; - while(wait<10 && glWindow1.getTotalFrames()<1) { Thread.sleep(100); wait++; } - System.err.println("Frames for initial setVisible(true): "+glWindow1.getTotalFrames()); + Assert.assertTrue(glWindow1.isVisible()); + System.out.println("Frames for initial setVisible(true): "+glWindow1.getTotalFrames()); Assert.assertTrue(0 < glWindow1.getTotalFrames()); // Continuous animation .. diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java index 112bb943c..279f2c370 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java @@ -99,8 +99,6 @@ public class TestGLWindows01NEWT extends UITestCase { glWindow.setVisible(true); Assert.assertEquals(true,glWindow.isVisible()); 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()); Assert.assertTrue(0 < glWindow.getTotalFrames()); 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 91d8856f0..b9182dbaa 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java @@ -49,7 +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 long waitAbout10FramesAt30fps = 10*34; // 10 frames @ 30fps static GLCapabilities glCaps; @BeforeClass @@ -118,10 +118,6 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(0, glWindow1.getTotalFrames()); Assert.assertEquals(0, glWindow2.getTotalFrames()); glWindow1.setVisible(true); - int 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()); Assert.assertTrue(0 < glWindow1.getTotalFrames()); Assert.assertTrue(0 < glWindow2.getTotalFrames()); @@ -143,16 +139,12 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true, glWindow1.isNativeValid()); Assert.assertEquals(false, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); - Assert.assertEquals(0, glWindow1.getTotalFrames()); glWindow1.resetCounter(); glWindow2.resetCounter(); Assert.assertEquals(0, glWindow1.getTotalFrames()); Assert.assertEquals(0, glWindow2.getTotalFrames()); glWindow1.setVisible(true); - 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()); Assert.assertTrue(0 < glWindow1.getTotalFrames()); Assert.assertTrue(0 < glWindow2.getTotalFrames()); @@ -200,9 +192,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true, animator2.isAnimating()); Assert.assertEquals(false, animator2.isPaused()); Assert.assertNotNull(animator2.getThread()); - for(wait=0; wait<frameWait/100 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) { - Thread.sleep(100); - } + Thread.sleep(waitAbout10FramesAt30fps); System.err.println("Frames for setVisible(true): A4: "+glWindow1.getTotalFrames()+", B4: "+glWindow2.getTotalFrames()); Assert.assertTrue(0 < glWindow1.getTotalFrames()); Assert.assertTrue(0 < glWindow2.getTotalFrames()); @@ -262,18 +252,15 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(0, glWindow1.getTotalFrames()); Assert.assertEquals(0, glWindow2.getTotalFrames()); glWindow1.setVisible(true); - 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()); - Assert.assertTrue(0 < glWindow1.getTotalFrames()); - Assert.assertTrue(0 < glWindow2.getTotalFrames()); - Assert.assertEquals(true, glWindow1.isVisible()); Assert.assertEquals(true, glWindow1.isNativeValid()); - Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); + + System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFrames()+", B3: "+glWindow2.getTotalFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFrames()); + Assert.assertEquals(1,display.getReferenceCount()); Assert.assertEquals(true,display.isNativeValid()); Assert.assertNotNull(display.getEDTUtil()); @@ -369,11 +356,6 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(0, glWindow1.getTotalFrames()); glWindow1.setVisible(true); - int wait=0; - 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()); - Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); Assert.assertNotNull(display1.getEDTUtil()); @@ -381,13 +363,12 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(1,screen1.getReferenceCount()); Assert.assertEquals(true,screen1.isNativeValid()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); + Assert.assertEquals(true, glWindow1.isVisible()); + System.err.println("Frames for setVisible(true) A1: "+glWindow1.getTotalFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFrames()); Assert.assertEquals(0, glWindow2.getTotalFrames()); glWindow2.setVisible(true); - wait=0; - 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()); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); @@ -396,6 +377,9 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(2,screen1.getReferenceCount()); Assert.assertEquals(true,screen1.isNativeValid()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); + Assert.assertEquals(true, glWindow2.isVisible()); + System.err.println("Frames for setVisible(true) B1: "+glWindow2.getTotalFrames()); + Assert.assertTrue(0 < glWindow1.getTotalFrames()); Animator animator1 = new Animator(glWindow1); animator1.start(); @@ -414,12 +398,11 @@ 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<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()); Assert.assertEquals(true, glWindow2.isNativeValid()); Assert.assertSame(glWindow1,glWindow2.getParent()); + System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFrames()); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); @@ -439,12 +422,11 @@ public class TestParenting01NEWT extends UITestCase { reparentAction = glWindow2.reparentWindow(null, reparentRecreate); Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction); - 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()); Assert.assertEquals(true, glWindow2.isNativeValid()); Assert.assertNull(glWindow2.getParent()); + System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3: "+glWindow2.getTotalFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFrames()); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); @@ -570,10 +552,6 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(0, glWindow1.getTotalFrames()); Assert.assertEquals(0, glWindow2.getTotalFrames()); glWindow1.setVisible(true); - int 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()); Assert.assertTrue(0 < glWindow2.getTotalFrames()); Assert.assertTrue(0 < glWindow1.getTotalFrames()); @@ -603,11 +581,10 @@ 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<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()); Assert.assertEquals(true, glWindow2.isNativeValid()); + System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFrames()); Assert.assertNull(glWindow2.getParent()); Assert.assertSame(screen1,glWindow2.getScreen()); Assert.assertSame(display1,glWindow2.getScreen().getDisplay()); @@ -617,11 +594,10 @@ 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<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()); Assert.assertEquals(true, glWindow2.isNativeValid()); + System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3 "+glWindow2.getTotalFrames()); + Assert.assertTrue(0 < glWindow2.getTotalFrames()); Assert.assertSame(glWindow1,glWindow2.getParent()); Assert.assertSame(screen1,glWindow2.getScreen()); Assert.assertSame(display1,glWindow2.getScreen().getDisplay()); |