diff options
author | Sven Gothel <[email protected]> | 2013-07-05 11:32:12 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-07-05 11:32:12 +0200 |
commit | dec4b02fe4b93028c85de6a56b6af79601042d6e (patch) | |
tree | 7f77c596768734ee4fd10d0a5e38eb5574906912 | |
parent | b9a24308f3ebc6fae9ca79f6020970945936feab (diff) |
NEWT Display.create: If reusing an existing instance, ensure EDT is running!
-rw-r--r-- | make/scripts/tests.sh | 7 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/DisplayImpl.java | 9 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java | 18 |
3 files changed, 25 insertions, 9 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 1ba0a36c6..c4520c8e7 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -150,8 +150,9 @@ function jrun() { #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable" #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile" #D_ARGS="-Djogl.debug.GLProfile" - #D_ARGS="-Dnativewindow.debug.NativeWindow" + #D_ARGS="-Dnativewindow.debug.NativeWindow -Dnewt.debug.Window -Dnewt.debug.Screen -Dnewt.debug.Display" #D_ARGS="-Djogl.debug.GLCanvas -Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT -Djogl.debug.Animator" + #D_ARGS="-Dnewt.debug.Display -Dnewt.debug.EDT" #D_ARGS="-Dnewt.debug.EDT -Dnewt.debug.Window -Djogl.debug.GLContext" #D_ARGS="-Dnativewindow.debug.X11Util.XErrorStackDump -Dnativewindow.debug.X11Util.TraceDisplayLifecycle -Dnativewindow.debug.X11Util" #D_ARGS="-Dnativewindow.debug.X11Util -Djogl.debug.GLContext -Djogl.debug.GLDrawable -Dnewt.debug=all" @@ -401,7 +402,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows02NEWTAnimated $* #testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindowInvisiblePointer01NEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle01NEWT -testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle02NEWT +#testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle02NEWT #testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00aNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00bNEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT $* @@ -514,7 +515,7 @@ testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle02NEWT # # NEWT Parenting (w/ NEWT, AWT or SWT) # -#testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT $* +testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02NEWT $* #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $* #testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01cSwingAWT $* diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java index bb493cbbd..09ea05e88 100644 --- a/src/newt/classes/jogamp/newt/DisplayImpl.java +++ b/src/newt/classes/jogamp/newt/DisplayImpl.java @@ -77,13 +77,14 @@ public abstract class DisplayImpl extends Display { /** Make sure to reuse a Display with the same name */ public static Display create(String type, String name, final long handle, boolean reuse) { try { - Class<?> displayClass = getDisplayClass(type); - DisplayImpl display = (DisplayImpl) displayClass.newInstance(); + final Class<?> displayClass = getDisplayClass(type); + final DisplayImpl display = (DisplayImpl) displayClass.newInstance(); name = display.validateDisplayName(name, handle); synchronized(displayList) { if(reuse) { - Display display0 = Display.getLastDisplayOf(type, name, -1, true /* shared only */); + final Display display0 = Display.getLastDisplayOf(type, name, -1, true /* shared only */); if(null != display0) { + display0.setEDTUtil(display0.getEDTUtil()); // ensures EDT is running if(DEBUG) { System.err.println("Display.create() REUSE: "+display0+" "+getThreadName()); } @@ -99,7 +100,7 @@ public abstract class DisplayImpl extends Display { display.hashCode = display.fqname.hashCode(); Display.addDisplay2List(display); } - display.setEDTUtil(display.edtUtil); // device's default if EDT is used, or null + display.setEDTUtil(display.edtUtil); // device's default if EDT is used, or null - ensures EDT is running if(DEBUG) { System.err.println("Display.create() NEW: "+display+" "+getThreadName()); 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 15c324e3e..e7fced5d9 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 @@ -673,14 +673,28 @@ public class TestParenting01NEWT extends UITestCase { } public static void main(String args[]) throws IOException { + boolean asMain = false; for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { durationPerTest = atoi(args[++i]); + } else if(args[i].equals("-asMain")) { + asMain = true; } } System.err.println("durationPerTest: "+durationPerTest); - String tstname = TestParenting01NEWT.class.getName(); - org.junit.runner.JUnitCore.main(tstname); + if( asMain ) { + try { + TestParenting01NEWT.initClass(); + TestParenting01NEWT m = new TestParenting01NEWT(); + m.testWindowParenting02ReparentTop2WinReparentRecreate(); + m.testWindowParenting01CreateVisibleDestroy(); + } catch (Throwable t ) { + t.printStackTrace(); + } + } else { + String tstname = TestParenting01NEWT.class.getName(); + org.junit.runner.JUnitCore.main(tstname); + } } } |