summaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-10-08 20:13:12 +0200
committerSven Gothel <[email protected]>2015-10-08 20:13:12 +0200
commitdca5d36370ec5eb44998bae593880e3b10cc9a4e (patch)
tree2a79a91b4a8c14dec7120c81df851e044cec014d /src/test/com/jogamp/opengl
parent56eb5025694064ad3e25cf2fb7ba0cabbda8ee67 (diff)
Bug 1249 - NEWT X11: setVisible(false) IconicState not listening to _NET_WM_STATE_HIDDEN; setVisible(true) not restoring from _NET_WM_STATE_HIDDEN
Using Gnome Shell 3.14.4-1~deb8u1 disclosed an issue w/ our newly utilized IconicState/_NET_WM_STATE_HIDDEN, i.e. visibleChanged(false) was never received. This is a regression of commit 2d837a7a7130702ad36b694875613fae77c7ef06, which utilizes WM_CHANGE_STATE_IDX + IconicState for visibility on top-level windows. This bug consist out of _two_ isssue: 1) setVisible(false) IconicState not listening to _NET_WM_STATE_HIDDEN Here, we 'listen' to _NET_WM_STATE_HIDDEN when receiving ConfigureNotify if supported _and_ XMapWindow has been issued. In such case existence/non-existence of _NET_WM_STATE_HIDDEN determines visibility. Otherwise, we have wait for MapNotify/UnmapNotify. The 'XMapWindow has been issued' criteria is tracked by new field 'JavaWindow.isMapped' and set/cleared when we actually issue XMapWindow/XUnmapWindow! 2) setVisible(true) not restoring from _NET_WM_STATE_HIDDEN It has been observed that restoring IconicState/_NET_WM_STATE_HIDDEN via XMapWindow or even NormalState may not work reliably on WMs. See <https://stackoverflow.com/questions/30192347/how-to-restore-a-window-with-xlib> Hence we restore from this WM state via NormalState _and_ _NET_ACTIVE_WINDOW. Both strategies seem to work well on KDE as well as on Gnome.
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java84
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java99
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java90
3 files changed, 170 insertions, 103 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java
index 9dd96acdd..8f1cdaae0 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java
@@ -58,7 +58,7 @@ public class TestGLWindows00NEWT extends UITestCase {
glp = GLProfile.getDefault();
}
- static GLWindow createWindow(final Screen screen, final GLCapabilitiesImmutable caps)
+ static GLWindow createWindow(final Screen screen, final GLCapabilitiesImmutable caps, final boolean undecor)
throws InterruptedException
{
Assert.assertNotNull(caps);
@@ -78,7 +78,9 @@ public class TestGLWindows00NEWT extends UITestCase {
final GLEventListener demo = new GearsES2();
glWindow.addGLEventListener(demo);
+ glWindow.setUndecorated(undecor);
glWindow.setSize(512, 512);
+ System.err.println("XXX VISIBLE.0 -> TRUE");
glWindow.setVisible(true);
Assert.assertEquals(true,glWindow.isVisible());
Assert.assertEquals(true,glWindow.isNativeValid());
@@ -90,25 +92,93 @@ public class TestGLWindows00NEWT extends UITestCase {
if(null!=glWindow) {
glWindow.destroy();
Assert.assertEquals(false,glWindow.isNativeValid());
+ Assert.assertEquals(false,glWindow.isVisible());
}
}
@Test
- public void testWindow00() throws InterruptedException {
+ public void test01WindowCreateSimple() throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
- final GLWindow window1 = createWindow(null, caps); // local
- Assert.assertEquals(true,window1.isNativeValid());
- Assert.assertEquals(true,window1.isVisible());
- final AbstractGraphicsDevice device1 = window1.getScreen().getDisplay().getGraphicsDevice();
+ final GLWindow window = createWindow(null, caps, false /* undecor */); // local
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+ final AbstractGraphicsDevice device1 = window.getScreen().getDisplay().getGraphicsDevice();
System.err.println("GLProfiles window1: "+device1.getConnection()+": "+GLProfile.glAvailabilityToString(device1));
for(int state=0; state*100<durationPerTest; state++) {
Thread.sleep(100);
}
- destroyWindow(window1);
+ destroyWindow(window);
+ }
+
+ @Test
+ public void test02WindowCreateUndecor() throws InterruptedException {
+ final GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ final GLWindow window = createWindow(null, caps, true /* undecor */); // local
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+
+ final AbstractGraphicsDevice device1 = window.getScreen().getDisplay().getGraphicsDevice();
+ System.err.println("GLProfiles window1: "+device1.getConnection()+": "+GLProfile.glAvailabilityToString(device1));
+
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+
+ destroyWindow(window);
+ }
+
+ @Test
+ public void test10WindowSimpleToggleVisibility() throws InterruptedException {
+ test1xWindowToggleVisibility(false /* undecor */);
+ }
+ @Test
+ public void test10WindowUndecorToggleVisibility() throws InterruptedException {
+ test1xWindowToggleVisibility(true /* undecor */);
+ }
+ private void test1xWindowToggleVisibility(final boolean undecor) throws InterruptedException {
+ final GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ final GLWindow window = createWindow(null, caps, undecor); // local
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+
+ window.display();
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+
+ System.err.println("XXX VISIBLE.1 -> FALSE");
+ window.setVisible(false);
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+
+ window.display();
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+
+ System.err.println("XXX VISIBLE.2 -> TRUE");
+ window.setVisible(true);
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+
+ window.display();
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+
+ destroyWindow(window);
}
static int atoi(final String a) {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java
index ab8304504..00b31f400 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java
@@ -59,8 +59,7 @@ public class TestGLWindows01NEWT extends UITestCase {
}
static GLWindow createWindow(final Screen screen, final GLCapabilities caps,
- final int width, final int height, final boolean onscreen, final boolean undecorated,
- final boolean addGLEventListenerAfterVisible)
+ final int width, final int height, final boolean onscreen, final boolean addGLEventListenerAfterVisible)
throws InterruptedException
{
Assert.assertNotNull(caps);
@@ -79,7 +78,6 @@ public class TestGLWindows01NEWT extends UITestCase {
Assert.assertNotNull(glWindow);
}
- glWindow.setUndecorated(onscreen && undecorated);
Assert.assertEquals(false,glWindow.isVisible());
Assert.assertEquals(false,glWindow.isNativeValid());
@@ -122,16 +120,47 @@ public class TestGLWindows01NEWT extends UITestCase {
if(null!=glWindow) {
glWindow.destroy();
Assert.assertEquals(false,glWindow.isNativeValid());
+ Assert.assertEquals(false,glWindow.isVisible());
}
}
+
+ @Test
+ public void test01WindowSimple() throws InterruptedException {
+ final GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ final GLWindow window = createWindow(null, caps, width, height,
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
+ System.out.println("Created: "+window);
+ int state;
+ for(state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+ System.out.println("duration: "+window.getTotalFPSDuration());
+ destroyWindow(window);
+ }
+
+ @Test
+ public void test02WindowSimple() throws InterruptedException {
+ final GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ final GLWindow window = createWindow(null, caps, width, height,
+ true /* onscreen */, true /*addGLEventListenerAfterVisible*/);
+ System.out.println("Created: "+window);
+ int state;
+ for(state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+ System.out.println("duration: "+window.getTotalFPSDuration());
+ destroyWindow(window);
+ }
+
@Test
- public void testWindowNativeRecreate01aSimple() throws InterruptedException {
+ public void test10WindowNativeRecreateSimple() throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
final GLWindow window = createWindow(null, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
@@ -155,12 +184,11 @@ public class TestGLWindows01NEWT extends UITestCase {
}
@Test
- public void testWindowNativeRecreate01bSimple() throws InterruptedException {
+ public void test11WindowNativeRecreateSimple() throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
final GLWindow window = createWindow(null, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- true /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, true /*addGLEventListenerAfterVisible*/);
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
@@ -184,44 +212,11 @@ public class TestGLWindows01NEWT extends UITestCase {
}
@Test
- public void testWindowDecor01aSimple() throws InterruptedException {
- final GLCapabilities caps = new GLCapabilities(glp);
- Assert.assertNotNull(caps);
- final GLWindow window = createWindow(null, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
- System.out.println("Created: "+window);
- int state;
- for(state=0; state*100<durationPerTest; state++) {
- Thread.sleep(100);
- }
- System.out.println("duration: "+window.getTotalFPSDuration());
- destroyWindow(window);
- }
-
- @Test
- public void testWindowDecor01bSimple() throws InterruptedException {
- final GLCapabilities caps = new GLCapabilities(glp);
- Assert.assertNotNull(caps);
- final GLWindow window = createWindow(null, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- true /*addGLEventListenerAfterVisible*/);
- System.out.println("Created: "+window);
- int state;
- for(state=0; state*100<durationPerTest; state++) {
- Thread.sleep(100);
- }
- System.out.println("duration: "+window.getTotalFPSDuration());
- destroyWindow(window);
- }
-
- @Test
- public void testWindowDecor02DestroyWinTwiceA() throws InterruptedException {
+ public void test21WindowDestroyWinTwiceA() throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
final GLWindow window = createWindow(null, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
int state;
for(state=0; state*100<durationPerTest; state++) {
Thread.sleep(100);
@@ -231,7 +226,7 @@ public class TestGLWindows01NEWT extends UITestCase {
}
@Test
- public void testWindowDecor03TwoWinOneDisplay() throws InterruptedException {
+ public void test22WindowTwoWinOneDisplay() throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
@@ -241,13 +236,11 @@ public class TestGLWindows01NEWT extends UITestCase {
final Screen screen = NewtFactory.createScreen(display, 0); // screen 0
Assert.assertNotNull(screen);
final GLWindow window1 = createWindow(screen, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
Assert.assertNotNull(window1);
final GLWindow window2 = createWindow(screen, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
Assert.assertNotNull(window2);
Assert.assertEquals(1,Display.getActiveDisplayNumber());
@@ -281,7 +274,7 @@ public class TestGLWindows01NEWT extends UITestCase {
}
@Test
- public void testWindowDecor03TwoWinTwoDisplays() throws InterruptedException {
+ public void test23WindowTwoWinTwoDisplays() throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
@@ -294,15 +287,13 @@ public class TestGLWindows01NEWT extends UITestCase {
final Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0
Assert.assertNotNull(screen1);
final GLWindow window1 = createWindow(screen1, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
Assert.assertNotNull(window1);
final Screen screen2 = NewtFactory.createScreen(display2, 0); // screen 0
Assert.assertNotNull(screen2);
final GLWindow window2 = createWindow(screen2, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
Assert.assertNotNull(window2);
Assert.assertEquals(2,Display.getActiveDisplayNumber());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
index 591ce5f4e..86614c3c3 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -51,7 +51,6 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
public class TestParenting01NEWT extends UITestCase {
static int width, height;
static long durationPerTest = 600;
- static long waitAbout10FramesAt30fps = 10*34; // 10 frames @ 30fps
static GLCapabilities glCaps;
@BeforeClass
@@ -61,6 +60,37 @@ public class TestParenting01NEWT extends UITestCase {
glCaps = new GLCapabilities(null);
}
+ private static void waitForFrames(final String waitFor, final int prefixIdx,
+ final GLWindow glWindow1, final GLWindow glWindow2,
+ final long TO, final boolean doAssert) {
+ final long t0 = System.currentTimeMillis();
+ int a, b;
+ long t1;
+ do {
+ try { Thread.sleep(16); } catch (final InterruptedException e) { }
+ if( null != glWindow1 ) {
+ a = glWindow1.getTotalFPSFrames();
+ } else {
+ a = -1;
+ }
+ if( null != glWindow2 ) {
+ b = glWindow2.getTotalFPSFrames();
+ } else {
+ b = -1;
+ }
+ t1 = System.currentTimeMillis();
+ } while ( ( 0 == a || 0 == b ) && TO > ( t1 - t0 ) );
+ System.err.println("Frames for "+waitFor+": A"+prefixIdx+": "+a+", B"+prefixIdx+": "+b);
+ if( doAssert ) {
+ if( null != glWindow1 ) {
+ Assert.assertTrue("No frames."+prefixIdx+" displayed on window1 during "+TO+"ms", 0 < a);
+ }
+ if( null != glWindow2 ) {
+ Assert.assertTrue("No frames."+prefixIdx+" displayed on window2 during "+TO+"ms", 0 < b);
+ }
+ }
+ }
+
@Test
public void test01CreateVisibleDestroy() throws InterruptedException {
Assert.assertEquals(0,Display.getActiveDisplayNumber());
@@ -111,11 +141,8 @@ public class TestParenting01NEWT extends UITestCase {
// visible test
Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
+ System.err.println("XXX VISIBLE.1 -> TRUE");
glWindow1.setVisible(true);
- System.err.println("Frames for setVisible(true): A1: "+glWindow1.getTotalFPSFrames()+", B1: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
-
Assert.assertEquals(true, glWindow1.isVisible());
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(true, glWindow2.isVisible());
@@ -127,7 +154,9 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(2,screen.getReferenceCount());
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ waitForFrames("window1.setVisible(true)", 1, glWindow1, glWindow2, 2000, true);
+ System.err.println("XXX VISIBLE.2 -> FALSE");
glWindow1.setVisible(false);
Assert.assertEquals(false, glWindow1.isVisible());
Assert.assertEquals(true, glWindow1.isNativeValid());
@@ -138,15 +167,13 @@ public class TestParenting01NEWT extends UITestCase {
glWindow2.resetFPSCounter();
Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
+ System.err.println("XXX VISIBLE.3 -> TRUE");
glWindow1.setVisible(true);
- System.err.println("Frames for setVisible(true): A2: "+glWindow1.getTotalFPSFrames()+", B2: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
-
Assert.assertEquals(true, glWindow1.isVisible());
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
+ waitForFrames("window1.setVisible(true)", 2, glWindow1, glWindow2, 2000, true);
glWindow1.resetFPSCounter();
glWindow2.resetFPSCounter();
@@ -165,9 +192,7 @@ public class TestParenting01NEWT extends UITestCase {
while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) {
Thread.sleep(100);
}
- System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFPSFrames()+", B3: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("animator.start()", 3, glWindow1, glWindow2, 2000, true);
Assert.assertEquals(true, animator1.pause());
Assert.assertEquals(false, animator1.isAnimating());
@@ -188,10 +213,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true, animator2.isAnimating());
Assert.assertEquals(false, animator2.isPaused());
Assert.assertNotNull(animator2.getThread());
- Thread.sleep(waitAbout10FramesAt30fps);
- System.err.println("Frames for setVisible(true): A4: "+glWindow1.getTotalFPSFrames()+", B4: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("animator.resume()", 4, glWindow1, glWindow2, 2000, true);
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
@@ -243,15 +265,13 @@ public class TestParenting01NEWT extends UITestCase {
glWindow2.resetFPSCounter();
Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
+ System.err.println("XXX VISIBLE.4 -> TRUE");
glWindow1.setVisible(true);
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.getTotalFPSFrames()+", B3: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("window1.setVisible(true) recreate", 5, glWindow1, glWindow2, 2000, true);
Assert.assertEquals(1,display.getReferenceCount());
Assert.assertEquals(true,display.isNativeValid());
@@ -348,12 +368,10 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true,screen1.isNativeValid());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
Assert.assertEquals(true, glWindow1.isVisible());
- System.err.println("Frames for setVisible(true) A1: "+glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
-
+ waitForFrames("window1.setVisible(true)", 1, glWindow1, null, 2000, true);
Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
- glWindow2.setVisible(true);
+ glWindow2.setVisible(true);
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
@@ -362,8 +380,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true,screen1.isNativeValid());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
Assert.assertEquals(true, glWindow2.isVisible());
- System.err.println("Frames for setVisible(true) B1: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
+ waitForFrames("window2.setVisible(true)", 2, glWindow1, glWindow2, 2000, true);
final Animator animator1 = new Animator(glWindow1);
animator1.setUpdateFPSFrames(1, null);
@@ -405,9 +422,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertSame(glWindow1,glWindow2.getParent());
- Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("reparentWindow.child(parent, "+reparentRecreate+"), "+reparentAction, 10, glWindow1, glWindow2, 2000, true);
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
@@ -448,9 +463,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertNull(glWindow2.getParent());
- Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("reparentWindow.top(parent, "+reparentRecreate+"), "+reparentAction, 11, glWindow1, glWindow2, 2000, true);
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
@@ -579,10 +592,6 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
glWindow1.setVisible(true);
- System.err.println("Frames for setVisible(): A1: "+glWindow1.getTotalFPSFrames()+", B1: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
-
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
@@ -592,6 +601,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertSame(glWindow1,glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ waitForFrames("window1.setVisible(true)", 1, glWindow1, glWindow2, 2000, true);
final Animator animator1 = new Animator(glWindow1);
animator1.setUpdateFPSFrames(1, null);
@@ -630,9 +640,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
- Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("reparentWindow.top(parent, "+reparentRecreate+"), "+reparentAction, 10, glWindow1, glWindow2, 2000, true);
Assert.assertNull(glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());
@@ -665,9 +673,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
- Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3 "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("reparentWindow.child(parent, "+reparentRecreate+"), "+reparentAction, 11, glWindow1, glWindow2, 2000, true);
Assert.assertSame(glWindow1,glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());