diff options
Diffstat (limited to 'src/test/com/jogamp/opengl')
4 files changed, 68 insertions, 48 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02GLn.java index 0c350255e..2121205e2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02GLn.java @@ -85,26 +85,17 @@ public class TestSWTAccessor02GLn extends UITestCase { @Before public void init() { - final Display[] r = new Display[1]; - final Shell[] s = new Shell[1]; SWTAccessor.invoke(true, new Runnable() { - public void run() { - r[0] = new Display(); - s[0] = new Shell(); - } - }); - display = r[0]; - shell = s[0]; - Assert.assertNotNull( display ); - Assert.assertNotNull( shell ); - - SWTAccessor.invoke(true, new Runnable() { - public void run() { - shell.setLayout( new FillLayout() ); - composite = new Composite( shell, SWT.NONE ); - Assert.assertNotNull( composite ); - composite.setLayout( new FillLayout() ); - }}); + public void run() { + display = new Display(); + Assert.assertNotNull( display ); + shell = new Shell( display ); + Assert.assertNotNull( shell ); + shell.setLayout( new FillLayout() ); + composite = new Composite( shell, SWT.NONE ); + composite.setLayout( new FillLayout() ); + Assert.assertNotNull( composite ); + }}); } @After diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java index 966b39c57..ad8da8ad0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java @@ -75,7 +75,11 @@ public class TestSWTAccessor03AWTGLn extends UITestCase { @BeforeClass public static void startup() { - System.out.println( "GLProfile " + GLProfile.glAvailabilityToString() ); + System.out.println( "GLProfile " + GLProfile.glAvailabilityToString() ); + Frame f0 = new Frame("Test - AWT 1st"); + f0.add(new java.awt.Label("AWT was here 1st")); + f0.pack(); + f0.setVisible(true); if(!GLProfile.isAvailable(GLProfile.GL2)) { setTestSupported(false); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java index f38d5c7dc..0bd47c980 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTEclipseGLCanvas01GLn.java @@ -53,6 +53,7 @@ import org.junit.BeforeClass; import org.junit.After; import org.junit.Test; +import com.jogamp.nativewindow.swt.SWTAccessor; import com.jogamp.opengl.test.junit.jogl.demos.es1.OneTriangle; import com.jogamp.opengl.test.junit.util.UITestCase; @@ -81,14 +82,17 @@ public class TestSWTEclipseGLCanvas01GLn extends UITestCase { @Before public void init() { - display = new Display(); - Assert.assertNotNull( display ); - shell = new Shell( display ); - Assert.assertNotNull( shell ); - shell.setLayout( new FillLayout() ); - composite = new Composite( shell, SWT.NONE ); - composite.setLayout( new FillLayout() ); - Assert.assertNotNull( composite ); + SWTAccessor.invoke(true, new Runnable() { + public void run() { + display = new Display(); + Assert.assertNotNull( display ); + shell = new Shell( display ); + Assert.assertNotNull( shell ); + shell.setLayout( new FillLayout() ); + composite = new Composite( shell, SWT.NONE ); + composite.setLayout( new FillLayout() ); + Assert.assertNotNull( composite ); + }}); } @After @@ -97,9 +101,12 @@ public class TestSWTEclipseGLCanvas01GLn extends UITestCase { Assert.assertNotNull( shell ); Assert.assertNotNull( composite ); try { - composite.dispose(); - shell.dispose(); - display.dispose(); + SWTAccessor.invoke(true, new Runnable() { + public void run() { + composite.dispose(); + shell.dispose(); + display.dispose(); + }}); } catch( Throwable throwable ) { throwable.printStackTrace(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java index addb14ce5..ba33aa31d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTJOGLGLCanvas01GLn.java @@ -34,6 +34,8 @@ import javax.media.opengl.GLCapabilitiesImmutable; import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile; +import jogamp.nativewindow.macosx.OSXUtil; + import org.eclipse.swt.SWT; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.Composite; @@ -47,6 +49,8 @@ import org.junit.BeforeClass; import org.junit.After; import org.junit.Test; +import com.jogamp.common.os.Platform; +import com.jogamp.nativewindow.swt.SWTAccessor; import com.jogamp.opengl.swt.GLCanvas; import com.jogamp.opengl.test.junit.jogl.demos.es1.OneTriangle; import com.jogamp.opengl.test.junit.util.UITestCase; @@ -57,10 +61,10 @@ import com.jogamp.opengl.test.junit.util.UITestCase; * Uses JOGL's new SWT GLCanvas. * </p> * <p> - * Holds AWT in it's test name, since our impl. still needs the AWT threading, - * see {@link GLCanvas}. + * Note that {@link SWTAccessor#invoke(boolean, Runnable)} is still used to comply w/ + * SWT running on Mac OSX, i.e. to enforce UI action on the main thread. * </p> - * @author Wade Walker, et.al. + * @author Wade Walker, et al. */ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { @@ -76,18 +80,24 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { @BeforeClass public static void startup() { System.out.println( "GLProfile " + GLProfile.glAvailabilityToString() ); + if( Platform.OS_TYPE == Platform.OSType.MACOS ) { + System.err.println("OSXUtil.isAWTEDTMainThread: "+ OSXUtil.isAWTEDTMainThread() ); + } } @Before public void init() { - display = new Display(); - Assert.assertNotNull( display ); - shell = new Shell( display ); - Assert.assertNotNull( shell ); - shell.setLayout( new FillLayout() ); - composite = new Composite( shell, SWT.NONE ); - composite.setLayout( new FillLayout() ); - Assert.assertNotNull( composite ); + SWTAccessor.invoke(true, new Runnable() { + public void run() { + display = new Display(); + Assert.assertNotNull( display ); + shell = new Shell( display ); + Assert.assertNotNull( shell ); + shell.setLayout( new FillLayout() ); + composite = new Composite( shell, SWT.NONE ); + composite.setLayout( new FillLayout() ); + Assert.assertNotNull( composite ); + }}); } @After @@ -96,9 +106,12 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { Assert.assertNotNull( shell ); Assert.assertNotNull( composite ); try { - composite.dispose(); - shell.dispose(); - display.dispose(); + SWTAccessor.invoke(true, new Runnable() { + public void run() { + composite.dispose(); + shell.dispose(); + display.dispose(); + }}); } catch( Throwable throwable ) { throwable.printStackTrace(); @@ -118,14 +131,19 @@ public class TestSWTJOGLGLCanvas01GLn extends UITestCase { Assert.assertNotNull( canvas ); canvas.addGLEventListener(new GLEventListener() { - public void init(final GLAutoDrawable drawable) { } + public void init(final GLAutoDrawable drawable) { + System.err.println(Thread.currentThread().getName()+" - SWT Canvas - GLEventListener - init()"); + } public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { - OneTriangle.setup( drawable.getGL().getGL2(), width, height ); + System.err.println(Thread.currentThread().getName()+" - SWT Canvas - GLEventListener - reshape()"); + OneTriangle.setup( drawable.getGL().getGL2(), width, height ); } public void display(final GLAutoDrawable drawable) { OneTriangle.render( drawable.getGL().getGL2(), drawable.getWidth(), drawable.getHeight()); } - public void dispose(final GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) { + System.err.println(Thread.currentThread().getName()+" - SWT Canvas - GLEventListener - dispose()"); + } }); shell.setText( getClass().getName() ); |