aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-04-04 16:27:11 +0200
committerSven Gothel <[email protected]>2013-04-04 16:27:11 +0200
commite68566febb69f6aca4bdf39d1d841c17df894631 (patch)
treec3223e4d0d97b93000f98d852dfe089692d1cf35
parentea87d0ce9a57762700b295f002bb544cef7223a3 (diff)
SWT unit tests: Sort w/ AWT and Headless - Fix threading w/ AWT.
This especially impacts (fixes) Mac OSX.
-rw-r--r--make/build-test.xml8
-rwxr-xr-xmake/scripts/tests.sh14
-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.java9
-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
5 files changed, 36 insertions, 27 deletions
diff --git a/make/build-test.xml b/make/build-test.xml
index dd072bddb..3d9c31d83 100644
--- a/make/build-test.xml
+++ b/make/build-test.xml
@@ -521,7 +521,8 @@
<for param="test.class.path.m" keepgoing="true">
<!-- results in absolute path -->
<fileset dir="${classes}">
- <include name="${java.dir.junit}/**/Test*SWTHeadless*"/>
+ <include name="${java.dir.junit}/**/Test*SWT*"/>
+ <exclude name="**/*AWT*"/>
<exclude name="**/*$$*"/>
</fileset>
<sequential>
@@ -550,6 +551,7 @@
<arg line="${jvmDataModel.arg}"/>
<arg value="-Djava.library.path=${obj.all.paths}"/>
<arg line="${jvmarg.headless}"/>
+ <arg line="${jvmarg.mainthrd}"/>
<!--
<arg line="-Dnewt.debug.EDT"/>
-->
@@ -583,9 +585,8 @@
<for param="test.class.path.m" keepgoing="true">
<!-- results in absolute path -->
<fileset dir="${classes}">
- <include name="${java.dir.junit}/**/Test*SWT*"/>
+ <include name="${java.dir.junit}/**/Test*SWT*AWT*"/>
<exclude name="**/*$$*"/>
- <exclude name="**/Test*SWTHeadless*"/>
</fileset>
<sequential>
<var name="test.class.path" unset="true"/>
@@ -611,7 +612,6 @@
<arg line="${junit.run.arg0}"/>
<arg line="${junit.run.arg1}"/>
<arg line="${jvmDataModel.arg}"/>
- <arg line="${jvmarg.mainthrd}"/>
<arg value="-Djava.library.path=${obj.all.paths}"/>
<!--
<arg line="-Dnewt.debug.EDT"/>
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 0bd814322..e4ff1f4f4 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -232,9 +232,11 @@ function jrun() {
# No AWT, No SWT -> Preserve Main-Thread
X_ARGS="-XstartOnFirstThread $X_ARGS"
C_ARG="com.jogamp.newt.util.MainThread"
- elif [ $swton -eq 1 ] ; then
- # SWT: Only Launch on Main-Thread
+ elif [ $awton -eq 0 -a $swton -eq 1 ] ; then
+ # SWT Only: Launch on Main-Thread
X_ARGS="-XstartOnFirstThread $X_ARGS"
+ # elif [ $awton -eq 1 -a $swton -eq 1 ] ; then
+ # AWT and SWT -> Use AWT Main-Thread
fi
fi
echo
@@ -272,7 +274,7 @@ function testawtswt() {
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestOlympicES1NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es1.newt.TestRedSquareES1NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
-testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
@@ -288,7 +290,7 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasA
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.gl2.newt.TestGearsNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.gl3.newt.TestGeomShader01TextureGL3NEWT $*
#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
-#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.swt.TestGearsES2SWT $*
+#testswt com.jogamp.opengl.test.junit.jogl.demos.es2.swt.TestGearsES2SWT $*
#
# core/newt (testnoawt and testawt)
@@ -426,7 +428,7 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasA
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTAccessor03AWTGLn $*
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLn $*
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTGLn $*
-#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTBug628ResizeDeadlock $*
+testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestNewtCanvasSWTBug628ResizeDeadlockAWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTBug643AsyncExec $*
#
@@ -444,7 +446,7 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasA
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNEWTWindowAWT $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersAWTCanvas $*
#testawt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasAWT $*
-#testawtswt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasSWT $*
+#testawtswt com.jogamp.opengl.test.junit.newt.event.TestNewtEventModifiersNewtCanvasSWTAWT $*
#testawt com.jogamp.opengl.test.junit.newt.TestListenerCom01AWT
#testawt com.jogamp.opengl.test.junit.jogl.caps.TestMultisampleES1AWT $*
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 ) ;
}