diff options
author | Sven Gothel <[email protected]> | 2011-12-19 01:48:44 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-12-19 01:48:44 +0100 |
commit | f171a694436b7ef15802f7c3bf805bcdd76d2cf1 (patch) | |
tree | 531e500dc2e05fb621628615b4e1b051e7e5a7ff | |
parent | 7ce7febbbc81ebadb502f3a0f572a1623e7ae3a7 (diff) |
Fix SWT test on OSX 32/64 bit ; Fix TestSWTAWT01GL for OSX
Fix SWT test on OSX 32/64 bit:
- Pick 32bit SWT for 32bit tests
Fix TestSWTAWT01GL for OSX:
- Using proper thread for AWT and SWT actions, platform agnostic
but required for OSX.
- Enable SWT*AWT* tests on OSX
-rw-r--r-- | make/build-common.xml | 8 | ||||
-rw-r--r-- | make/build-test.xml | 14 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java | 1 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAWT01GLn.java | 92 |
4 files changed, 66 insertions, 49 deletions
diff --git a/make/build-common.xml b/make/build-common.xml index cdc4bba1f..79d55b5f2 100644 --- a/make/build-common.xml +++ b/make/build-common.xml @@ -145,7 +145,8 @@ <condition property="swt.jar" value="${project.root}/make/lib/swt/gtk-linux-x86/swt-debug.jar"> <istrue value="${isAndroid}" /> <!-- FIXME JAU .. hack --> </condition> - <condition property="swt.jar" value="${project.root}/make/lib/swt/cocoa-macosx-x86_64/swt-debug.jar"> + <property name="swt-cocoa-macosx-x86_64.jar" value="${project.root}/make/lib/swt/cocoa-macosx-x86_64/swt-debug.jar"/> + <condition property="swt.jar" value="${swt-cocoa-macosx-x86_64.jar}"> <and> <istrue value="${isOSX}" /> <or> @@ -154,7 +155,8 @@ </or> </and> </condition> - <condition property="swt.jar" value="${project.root}/make/lib/swt/cocoa-macosx/swt-debug.jar"> + <property name="swt-cocoa-macosx-x86_32.jar" value="${project.root}/make/lib/swt/cocoa-macosx/swt-debug.jar"/> + <condition property="swt.jar" value="${swt-cocoa-macosx-x86_32.jar}"> <and> <istrue value="${isOSX}" /> <or> @@ -494,6 +496,8 @@ <property name="junit_jogl_android.run.jars" value="${junit.jar}${path.separator}${ant.jar}${path.separator}${ant-junit.jar}${path.separator}${gluegen-rt.jar}${path.separator}${jogl.all-android.jar}${path.separator}${jogl.test.jar}"/> + <!-- Dummy extra CLASSPATH value, maybe overwritten --> + <property name="junit_extra_classpath" value=""/> <!-- The location and name of the configuration ANT file that will - validate to ensure that all user-define variables are set. --> diff --git a/make/build-test.xml b/make/build-test.xml index 7d5582b03..533ca301c 100644 --- a/make/build-test.xml +++ b/make/build-test.xml @@ -370,7 +370,7 @@ relative="true" failonerror="false"> <env key="${system.env.library.path}" path="${obj.all.paths}"/> - <env key="CLASSPATH" value="${junit_jogl_swt.run.jars}"/> + <env key="CLASSPATH" value="${junit_extra_classpath}${junit_jogl_swt.run.jars}"/> <arg line="${jvmDataModel.arg}"/> <arg value="-Djava.library.path=${obj.all.paths}"/> <arg line="${jvmarg.headless}"/> @@ -398,14 +398,12 @@ </for> </target> - <!-- currently freezes OSX --> - <target name="junit.run.swt.awt" depends="test.compile" description="Runs all SWT_AWT tests." if="isSWTRuntimeAvailable" unless="isOSX"> - <!-- Test*SWT* --> + <target name="junit.run.swt.awt" depends="test.compile" description="Runs all SWT_AWT tests." if="isSWTRuntimeAvailable"> + <!-- Test*SWT*AWT* --> <junit forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}"> <env key="${system.env.library.path}" path="${obj.all.paths}"/> <jvmarg value="${jvmDataModel.arg}"/> <jvmarg value="-Djava.library.path=${obj.all.paths}"/> - <jvmarg value="${jvmarg.mainthrd}"/> <!-- <jvmarg value="-Djogl.debug=all"/> @@ -420,7 +418,7 @@ <formatter usefile="false" type="plain"/> <formatter usefile="true" type="xml"/> - <classpath refid="junit_jogl_swt.run.classpath"/> + <classpath path="${junit_extra_classpath}${junit_jogl_swt.run.jars}"/> <batchtest todir="${results.test}"> <fileset dir="${classes}"> @@ -478,6 +476,8 @@ <target name="junit.run.d32" if="isOSX"> <var name="jvmDataModel.arg" unset="true"/> <var name="jvmDataModel.arg" value="-d32"/> + <var name="junit_extra_classpath" unset="true"/> + <var name="junit_extra_classpath" value="${swt-cocoa-macosx-x86_32.jar}:"/> <antcall target="junit.run.tests" inheritRefs="true" inheritAll="true"/> @@ -492,6 +492,8 @@ <var name="jvmDataModel.arg" unset="true"/> <var name="jvmDataModel.arg" value="-d64"/> + <var name="junit_extra_classpath" unset="true"/> + <var name="junit_extra_classpath" value=""/> </target> <target name="junit.run.settings"> diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java index 84d5f09ef..b8e45dfe1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWT02GLn.java @@ -38,7 +38,6 @@ import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.opengl.GLCanvas; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAWT01GLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAWT01GLn.java index 595e6fb31..6139d816a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAWT01GLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAWT01GLn.java @@ -29,6 +29,7 @@ package com.jogamp.opengl.test.junit.jogl.swt;
import java.awt.Frame;
+import java.lang.reflect.InvocationTargetException;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
@@ -37,6 +38,8 @@ import javax.media.opengl.GLEventListener; import javax.media.opengl.GLProfile;
import javax.media.opengl.awt.GLCanvas;
+import jogamp.nativewindow.swt.SWTAccessor;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.awt.SWT_AWT;
import org.eclipse.swt.graphics.Rectangle;
@@ -76,46 +79,47 @@ public class TestSWTAWT01GLn 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.EMBEDDED | SWT.NO_BACKGROUND );
- composite.setLayout( new FillLayout() );
- Assert.assertNotNull( composite );
- frame = SWT_AWT.new_Frame( composite );
- Assert.assertNotNull( frame );
+ public void init() throws InterruptedException, InvocationTargetException {
+ 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.EMBEDDED | SWT.NO_BACKGROUND );
+ composite.setLayout( new FillLayout() );
+ Assert.assertNotNull( composite );
+ frame = SWT_AWT.new_Frame( composite );
+ Assert.assertNotNull( frame );
+ }});
}
@After
- public void release() {
+ public void release() throws InterruptedException, InvocationTargetException {
Assert.assertNotNull( display );
Assert.assertNotNull( shell );
Assert.assertNotNull( composite );
Assert.assertNotNull( glcanvas );
- try {
- javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame.setVisible(false);
- frame.remove(glcanvas);
- frame.dispose();
- }});
- composite.dispose();
- shell.close();
- shell.dispose();
- display.dispose();
- }
- catch( Throwable throwable ) {
- throwable.printStackTrace();
- Assume.assumeNoException( throwable );
- }
- display = null;
- shell = null;
- composite = null;
- frame = null;
- glcanvas = null;
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.setVisible(false);
+ frame.remove(glcanvas);
+ frame.dispose();
+ frame = null;
+ glcanvas = null;
+ }});
+
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ composite.dispose();
+ shell.close();
+ shell.dispose();
+ display.dispose();
+ display = null;
+ shell = null;
+ composite = null;
+ }});
}
protected void runTestGL( GLProfile glprofile ) throws InterruptedException {
@@ -148,18 +152,26 @@ public class TestSWTAWT01GLn extends UITestCase { }
});
- shell.setText( getClass().getName() );
- shell.setSize( 640, 480 );
- shell.open();
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ shell.setText( getClass().getName() );
+ shell.setSize( 640, 480 );
+ shell.open();
+ }});
long lStartTime = System.currentTimeMillis();
long lEndTime = lStartTime + duration;
try {
while( (System.currentTimeMillis() < lEndTime) && !composite.isDisposed() ) {
- if( !display.readAndDispatch() ) {
- // blocks on linux .. display.sleep();
- Thread.sleep(10);
- }
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ // blocks on linux .. display.sleep();
+ try {
+ Thread.sleep(10);
+ } catch (InterruptedException e) { }
+ }
+ }});
}
}
catch( Throwable throwable ) {
|