diff options
author | Sven Gothel <[email protected]> | 2013-04-04 16:27:11 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-04-04 16:27:11 +0200 |
commit | e68566febb69f6aca4bdf39d1d841c17df894631 (patch) | |
tree | c3223e4d0d97b93000f98d852dfe089692d1cf35 /src/test | |
parent | ea87d0ce9a57762700b295f002bb544cef7223a3 (diff) |
SWT unit tests: Sort w/ AWT and Headless - Fix threading w/ AWT.
This especially impacts (fixes) Mac OSX.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java (renamed from src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlock.java) | 27 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java | 9 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java (renamed from src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java) | 5 |
3 files changed, 24 insertions, 17 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlock.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java index 1f3bf3156..7106ed7ce 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlock.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java @@ -63,7 +63,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase; //////////////////////////////////////////////////////////////////////////////// -public class TestNewtCanvasSWTBug628ResizeDeadlock extends UITestCase { +public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase { static int duration = 500; @@ -246,9 +246,9 @@ public class TestNewtCanvasSWTBug628ResizeDeadlock extends UITestCase { private volatile boolean shallStop = false; static class SWT_DSC { - Display display; - Shell shell; - Composite composite; + volatile Display display; + volatile Shell shell; + volatile Composite composite; public void init() { SWTAccessor.invoke(true, new Runnable() { @@ -358,7 +358,9 @@ public class TestNewtCanvasSWTBug628ResizeDeadlock extends UITestCase { keyfire.join(); } catch( InterruptedException e ) { } shallStop = true; - dsc.display.wake(); + if( null != dsc.display && !dsc.display.isDisposed() ) { + dsc.display.wake(); + } } } ); t.setDaemon(true); t.start(); @@ -366,10 +368,15 @@ public class TestNewtCanvasSWTBug628ResizeDeadlock extends UITestCase { try { while( !shallStop && !dsc.display.isDisposed() ) { - if( !dsc.display.readAndDispatch() && !shallStop ) { - // blocks on linux .. dsc.display.sleep(); - Thread.sleep(10); - } + dsc.display.syncExec( new Runnable() { + public void run() { + if( !dsc.display.isDisposed() && !dsc.display.readAndDispatch() && !shallStop ) { + // blocks on linux .. dsc.display.sleep(); + try { + Thread.sleep(10); + } catch (InterruptedException ie) { ie.printStackTrace(); } + } + } } ); } } catch (Exception e0) { e0.printStackTrace(); @@ -388,7 +395,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlock extends UITestCase { } } System.out.println("durationPerTest: "+duration); - org.junit.runner.JUnitCore.main(TestNewtCanvasSWTBug628ResizeDeadlock.class.getName()); + org.junit.runner.JUnitCore.main(TestNewtCanvasSWTBug628ResizeDeadlockAWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java index 97b3ab243..66911ef06 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java @@ -28,7 +28,6 @@ package com.jogamp.opengl.test.junit.jogl.swt; -import java.awt.AWTException; import java.lang.reflect.InvocationTargetException; import org.eclipse.swt.SWT ; @@ -207,7 +206,7 @@ public class TestSWTBug643AsyncExec extends UITestCase { } } - private void testImpl(boolean useJOGLGLCanvas, boolean useNewtCanvasSWT, boolean glWindowPreVisible) throws InterruptedException, AWTException, InvocationTargetException { + private void testImpl(boolean useJOGLGLCanvas, boolean useNewtCanvasSWT, boolean glWindowPreVisible) throws InterruptedException, InvocationTargetException { resetSWTAndNEWTEDTCounter(); final SWT_DSC dsc = new SWT_DSC(); @@ -314,17 +313,17 @@ public class TestSWTBug643AsyncExec extends UITestCase { } @Test - public void test01JOGLGLCanvas() throws InterruptedException, AWTException, InvocationTargetException { + public void test01JOGLGLCanvas() throws InterruptedException, InvocationTargetException { testImpl(true /* useJOGLGLCanvas */, false /* useNewtCanvasSWT */, false /* glWindowPreVisible */); } @Test - public void test02NewtCanvasSWTSimple() throws InterruptedException, AWTException, InvocationTargetException { + public void test02NewtCanvasSWTSimple() throws InterruptedException, InvocationTargetException { testImpl(false /* useJOGLGLCanvas */, true /* useNewtCanvasSWT */, false /* glWindowPreVisible */); } @Test - public void test02NewtCanvasSWTPreVisible() throws InterruptedException, AWTException, InvocationTargetException { + public void test02NewtCanvasSWTPreVisible() throws InterruptedException, InvocationTargetException { testImpl(false /* useJOGLGLCanvas */, true /* useNewtCanvasSWT */, true /* glWindowPreVisible */); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java index 6279b70dc..cc32d5331 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWTAWT.java @@ -53,7 +53,7 @@ import com.jogamp.opengl.test.junit.util.AWTRobotUtil; * the canvas is a NewtCanvasSWT. */ -public class TestNewtEventModifiersNewtCanvasSWT extends BaseNewtEventModifiers { +public class TestNewtEventModifiersNewtCanvasSWTAWT extends BaseNewtEventModifiers { private static Display _display = null; private static Shell _shell = null; @@ -78,6 +78,7 @@ public class TestNewtEventModifiersNewtCanvasSWT extends BaseNewtEventModifiers res[0] = false; } } } ); + i++; } while( i<maxEvents && res[0] ); } @@ -161,7 +162,7 @@ public class TestNewtEventModifiersNewtCanvasSWT extends BaseNewtEventModifiers //////////////////////////////////////////////////////////////////////////// public static void main(String args[]) throws Exception { - String testName = TestNewtEventModifiersNewtCanvasSWT.class.getName() ; + String testName = TestNewtEventModifiersNewtCanvasSWTAWT.class.getName() ; org.junit.runner.JUnitCore.main( testName ) ; } |