summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/SWTTestUtil.java47
2 files changed, 43 insertions, 6 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java
index ab4f2419f..51aa4c138 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java
@@ -192,6 +192,8 @@ public class TestNewtCanvasSWTGLn extends UITestCase {
} } );
}
+ // final SWTTestUtil.WaitAction2 awtRobotWaitAction = new SWTTestUtil.WaitAction2(glWindow1.getScreen().getDisplay().getEDTUtil(), display, true, TestUtil.TIME_SLICE);
+ // final SWTTestUtil.WaitAction2 generalWaitAction = new SWTTestUtil.WaitAction2(glWindow1.getScreen().getDisplay().getEDTUtil(), display, true, 10);
final SWTTestUtil.WaitAction awtRobotWaitAction = new SWTTestUtil.WaitAction(display, true, TestUtil.TIME_SLICE);
final SWTTestUtil.WaitAction generalWaitAction = new SWTTestUtil.WaitAction(display, true, 10);
diff --git a/src/test/com/jogamp/opengl/test/junit/util/SWTTestUtil.java b/src/test/com/jogamp/opengl/test/junit/util/SWTTestUtil.java
index 8b359df3b..5e80bacaa 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/SWTTestUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/SWTTestUtil.java
@@ -31,17 +31,22 @@ package com.jogamp.opengl.test.junit.util;
import org.eclipse.swt.widgets.Display;
+import com.jogamp.newt.util.EDTUtil;
+
public class SWTTestUtil {
public static class WaitAction implements Runnable {
final Display display;
final boolean blocking;
final long sleepMS;
+
public WaitAction(final Display display, final boolean blocking, final long sleepMS) {
this.display = display;
this.blocking = blocking;
this.sleepMS = sleepMS;
}
+
final Runnable waitAction0 = new Runnable() {
+ @Override
public void run() {
if( !display.readAndDispatch() ) {
try {
@@ -49,15 +54,45 @@ public class SWTTestUtil {
} catch (final InterruptedException e) { }
}
} };
+
+ @Override
+ public void run() {
+ if( blocking ) {
+ display.syncExec( waitAction0 );
+ } else {
+ display.asyncExec( waitAction0 );
+ }
+ };
+ }
+
+ public static class WaitAction2 implements Runnable {
+ final EDTUtil edt;
+ final Display display;
+ final boolean blocking;
+ final long sleepMS;
+
+ public WaitAction2(final EDTUtil edt, final Display display, final boolean blocking, final long sleepMS) {
+ this.edt = edt;
+ this.display = display;
+ this.blocking = blocking;
+ this.sleepMS = sleepMS;
+ }
+
+ final Runnable waitAction0 = new Runnable() {
+ @Override
public void run() {
- if( blocking ) {
- display.syncExec( waitAction0 );
- } else {
- display.asyncExec( waitAction0 );
+ if( !display.readAndDispatch() ) {
+ try {
+ Thread.sleep(sleepMS);
+ } catch (final InterruptedException e) { }
}
- };
- }
+ } };
+ @Override
+ public void run() {
+ edt.invoke(blocking, waitAction0);
+ };
+ }
}