aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-02-25 04:37:58 +0100
committerSven Gothel <[email protected]>2011-02-25 04:37:58 +0100
commit6188d6a385056adade49fcb6d8247f94f96d402e (patch)
tree7c1b29904fa11fad792f99ea66cfdeb6fb434d5a
parent60bef22a93d3406b960f059299bd31c72dcad959 (diff)
Avoid NPE, incr. test poll, ..
-rw-r--r--src/newt/classes/jogamp/newt/awt/AWTScreen.java16
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java2
3 files changed, 11 insertions, 10 deletions
diff --git a/src/newt/classes/jogamp/newt/awt/AWTScreen.java b/src/newt/classes/jogamp/newt/awt/AWTScreen.java
index 83d7be57c..d05933321 100644
--- a/src/newt/classes/jogamp/newt/awt/AWTScreen.java
+++ b/src/newt/classes/jogamp/newt/awt/AWTScreen.java
@@ -33,11 +33,11 @@
package jogamp.newt.awt;
-import com.jogamp.newt.*;
-import jogamp.newt.ScreenImpl;
import java.awt.DisplayMode;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.awt.*;
+
+import jogamp.newt.ScreenImpl;
+import javax.media.nativewindow.awt.AWTGraphicsDevice;
+import javax.media.nativewindow.awt.AWTGraphicsScreen;
public class AWTScreen extends ScreenImpl {
public AWTScreen() {
@@ -46,10 +46,10 @@ public class AWTScreen extends ScreenImpl {
protected void createNativeImpl() {
aScreen = new AWTGraphicsScreen((AWTGraphicsDevice)display.getGraphicsDevice());
- DisplayMode mode = ((AWTGraphicsDevice)getDisplay().getGraphicsDevice()).getGraphicsDevice().getDisplayMode();
- int w = mode.getWidth();
- int h = mode.getHeight();
- setScreenSize(w, h);
+ final DisplayMode mode = ((AWTGraphicsDevice)getDisplay().getGraphicsDevice()).getGraphicsDevice().getDisplayMode();
+ if(null != mode) {
+ setScreenSize(mode.getWidth(), mode.getHeight());
+ }
}
protected void setAWTGraphicsScreen(AWTGraphicsScreen s) {
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 6d9801d48..9e0bebc9c 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
@@ -101,8 +101,9 @@ public class TestSharedContextListAWT extends UITestCase {
frame.pack();
frame.setSize(width, height);
frame.setLocation(x, y);
- frame.validate();
+ frame.invalidate();
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 35522f681..40c1e0528 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 = 1000; // 1s
+ public static int TIME_OUT = 2000; // 2s
public static int ROBOT_DELAY = 50; // ms
public static int POLL_DIVIDER = 20; // TO/20