aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-02-26 22:43:10 +0100
committerSven Gothel <[email protected]>2011-02-26 22:43:10 +0100
commite5f0ee1e8969b9259f31b88f9ddd7165ab8ca5ae (patch)
tree15f160be9d4033de997ba57c9bcc090809efa61c /src/test
parent10c696f7e908ccbf150838f86b286b7c383058c6 (diff)
Attempt to analyze failed AWT UI tests, where no paint is being issued to GLCanvas.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java24
2 files changed, 19 insertions, 11 deletions
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<POLL_DIVIDER && realized != comp.isRealized(); wait++) {
- Thread.sleep(TIME_OUT/POLL_DIVIDER);
- }
- } else if (obj instanceof Component) {
+ if (obj instanceof Component) {
Component comp = (Component) obj;
for (wait=0; wait<POLL_DIVIDER && realized != comp.isDisplayable(); wait++) {
Thread.sleep(TIME_OUT/POLL_DIVIDER);
}
+ // if GLCanvas, ensure it got also painted -> drawable.setRealized(true);
+ if(wait<POLL_DIVIDER && comp instanceof GLCanvas) {
+ GLCanvas glcanvas = (GLCanvas) comp;
+ for (wait=0; wait<POLL_DIVIDER && realized != glcanvas.isRealized(); wait++) {
+ Thread.sleep(TIME_OUT/POLL_DIVIDER);
+ }
+ 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<POLL_DIVIDER && realized != glcanvas.isRealized(); wait++) {
+ Thread.sleep(TIME_OUT/POLL_DIVIDER);
+ }
+ }
+ }
} else if(obj instanceof com.jogamp.newt.Window) {
com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj;
for (wait=0; wait<POLL_DIVIDER && realized != win.isNativeValid(); wait++) {