From e5f0ee1e8969b9259f31b88f9ddd7165ab8ca5ae Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 26 Feb 2011 22:43:10 +0100 Subject: Attempt to analyze failed AWT UI tests, where no paint is being issued to GLCanvas. --- .../junit/jogl/acore/TestSharedContextListAWT.java | 6 ++---- .../opengl/test/junit/util/AWTRobotUtil.java | 24 +++++++++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) (limited to 'src/test') diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java index 9e0bebc9c..63f54e267 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java @@ -98,12 +98,10 @@ public class TestSharedContextListAWT extends UITestCase { SwingUtilities.invokeLater(new Runnable() { public void run() { frame.add(glCanvas); - frame.pack(); - frame.setSize(width, height); frame.setLocation(x, y); - frame.invalidate(); + frame.setSize(width, height); + frame.pack(); frame.setVisible(true); - frame.validate(); } }); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true)); diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java index 40c1e0528..bbd53db9b 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java @@ -45,7 +45,7 @@ import javax.swing.JFrame; public class AWTRobotUtil { - public static int TIME_OUT = 2000; // 2s + public static int TIME_OUT = 1000; // 1s public static int ROBOT_DELAY = 50; // ms public static int POLL_DIVIDER = 20; // TO/20 @@ -354,16 +354,26 @@ public class AWTRobotUtil { */ public static boolean waitForRealized(Object obj, boolean realized) throws InterruptedException { int wait; - if(obj instanceof GLCanvas) { - GLCanvas comp = (GLCanvas) obj; - for (wait=0; wait drawable.setRealized(true); + if(wait=POLL_DIVIDER) { + // for some reason GLCanvas hasn't been painted yet, force it! + System.err.println("XXX: FORCE REPAINT - canvas: "+glcanvas); + glcanvas.repaint(); + for (wait=0; wait