summaryrefslogtreecommitdiffstats
path: root/src/junit
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-09-30 21:39:13 +0300
committerSven Gothel <[email protected]>2010-09-30 21:39:13 +0300
commit3acabfe0d884bc628593773a5f8e798d52e486d2 (patch)
tree127b499d1d424026aa429718ebff37b353d3381b /src/junit
parent81231cb640c297676263d43c29adc105e6996885 (diff)
NEWT/AWT Unit Tests: Run one test at a time via superclass BeforeClass/AfterClass FileLock
Due to the fact that any test with a UI may interfere with a UI test (test focus, active, ..), all tests are derived from the common UITestCase superclass, which decorates the test class with a FileLock at BeforeClass/AfterClass. Increased junit timeout to 10 min
Diffstat (limited to 'src/junit')
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java5
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/awt/TestAWT02WindowClosing.java3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java7
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java4
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java4
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java4
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java3
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java5
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java6
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java3
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java3
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java4
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/util/AWTFocusAdapter.java2
-rw-r--r--src/junit/com/jogamp/test/junit/util/AWTKeyAdapter.java2
-rw-r--r--src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java10
-rw-r--r--src/junit/com/jogamp/test/junit/util/EventCountAdapter.java2
-rw-r--r--src/junit/com/jogamp/test/junit/util/NEWTFocusAdapter.java2
-rw-r--r--src/junit/com/jogamp/test/junit/util/NEWTKeyAdapter.java2
-rw-r--r--src/junit/com/jogamp/test/junit/util/SingletonInstance.java3
-rw-r--r--src/junit/com/jogamp/test/junit/util/UITestCase.java59
34 files changed, 116 insertions, 51 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
index 12e016654..711ac7c87 100644
--- a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
@@ -28,6 +28,7 @@
package com.jogamp.test.junit.jogl.acore;
+import com.jogamp.test.junit.util.UITestCase;
import org.junit.Assert;
import org.junit.Before;
@@ -42,7 +43,7 @@ import com.jogamp.newt.opengl.*;
import com.jogamp.newt.*;
import java.io.IOException;
-public class TestGLProfile01NEWT {
+public class TestGLProfile01NEWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
index b1d6cb287..5ee3d3814 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
@@ -33,7 +33,9 @@ import javax.media.opengl.GLCapabilities;
import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.test.junit.util.UITestCase;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
+
import java.awt.Frame;
import org.junit.Assert;
@@ -43,7 +45,8 @@ import org.junit.BeforeClass;
import org.junit.After;
import org.junit.Test;
-public class TestAWT01GLn {
+
+public class TestAWT01GLn extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT02WindowClosing.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT02WindowClosing.java
index 0dfcc4238..a4726f1c6 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT02WindowClosing.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT02WindowClosing.java
@@ -28,6 +28,7 @@
package com.jogamp.test.junit.jogl.awt;
+import com.jogamp.test.junit.util.UITestCase;
import javax.media.opengl.GLProfile;
import java.awt.*;
@@ -40,7 +41,7 @@ import org.junit.BeforeClass;
import org.junit.After;
import org.junit.Test;
-public class TestAWT02WindowClosing {
+public class TestAWT02WindowClosing extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java
index bbe41e334..c3b9e10ab 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java
@@ -34,6 +34,7 @@ import javax.media.opengl.GLCapabilities;
import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.test.junit.util.UITestCase;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
import java.awt.Frame;
import java.awt.Window;
@@ -51,7 +52,7 @@ import static javax.swing.SwingUtilities.*;
* Tests context creation + display on various kinds of Window implementations.
* @author Michael Bien
*/
-public class TestSwingAWT01GLn {
+public class TestSwingAWT01GLn extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
index 1d72406f1..18f176e16 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
@@ -28,6 +28,7 @@
package com.jogamp.test.junit.jogl.awt;
+import com.jogamp.test.junit.util.UITestCase;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
import com.jogamp.test.junit.util.*;
@@ -72,7 +73,7 @@ import org.junit.BeforeClass;
import org.junit.AfterClass;
import org.junit.Test;
-public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 {
+public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
static long durationPerTest = 500; // ms
static Robot robot;
static Border border;
@@ -81,7 +82,6 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 {
static JPanel panel;
static JPanel colorPanel;
static boolean windowClosing;
- static SingletonInstance instance;
boolean modLightBrighter = true;
@@ -118,8 +118,6 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 {
public static void setup() throws InterruptedException, InvocationTargetException, AWTException {
int count;
- instance = AWTRobotUtil.lock();
-
// simulate AWT usage before JOGL's initialization of X11 threading
windowClosing=false;
border = BorderFactory.createLineBorder (Color.yellow, 2);
@@ -178,7 +176,6 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 {
Assert.assertNotNull(frame);
frame.dispose();
frame=null;
- instance.unlock();
}
protected void runTestGL(final Canvas canvas, GLAutoDrawable drawable)
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
index 0de96921c..52a4885b4 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
@@ -36,6 +36,7 @@ import com.jogamp.newt.event.awt.AWTWindowAdapter;
import com.jogamp.newt.event.TraceKeyAdapter;
import com.jogamp.newt.event.TraceWindowAdapter;
+import com.jogamp.test.junit.util.UITestCase;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
import java.awt.Frame;
@@ -46,7 +47,7 @@ import org.junit.AfterClass;
import org.junit.After;
import org.junit.Test;
-public class TestGearsAWT {
+public class TestGearsAWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java
index 2424ff381..88cfa9c95 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java
@@ -28,6 +28,8 @@
package com.jogamp.test.junit.jogl.demos.gl2.gears;
+import com.jogamp.test.junit.util.UITestCase;
+
import javax.media.opengl.*;
import com.jogamp.opengl.util.Animator;
@@ -43,7 +45,7 @@ import org.junit.AfterClass;
import org.junit.After;
import org.junit.Test;
-public class TestGearsNEWT {
+public class TestGearsNEWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java
index 6ae3691d5..47cdd4bfa 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java
@@ -32,6 +32,7 @@ import javax.media.nativewindow.*;
import javax.media.opengl.*;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.test.junit.util.UITestCase;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
import com.jogamp.newt.*;
import com.jogamp.newt.event.*;
@@ -44,7 +45,7 @@ import org.junit.AfterClass;
import org.junit.After;
import org.junit.Test;
-public class TestGearsNewtAWTWrapper {
+public class TestGearsNewtAWTWrapper extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
index 089d90362..2bb14dee0 100644
--- a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
@@ -28,6 +28,7 @@
package com.jogamp.test.junit.jogl.drawable;
+import com.jogamp.test.junit.util.UITestCase;
import org.junit.Assert;
import org.junit.Before;
@@ -40,7 +41,7 @@ import javax.media.opengl.*;
import com.jogamp.newt.*;
import java.io.IOException;
-public class TestDrawable01NEWT {
+public class TestDrawable01NEWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java b/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java
index 2acbd0d95..bedea39ad 100644
--- a/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java
@@ -1,5 +1,7 @@
package com.jogamp.test.junit.jogl.glsl;
+import com.jogamp.test.junit.util.UITestCase;
+
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
@@ -28,7 +30,7 @@ import java.io.IOException;
* Bug 'Function glTransformFeedbackVaryings incorrectly passes argument'
* http://jogamp.org/bugzilla/show_bug.cgi?id=407
*/
-public class TestTransformFeedbackVeryingsBug407NEWT {
+public class TestTransformFeedbackVeryingsBug407NEWT extends UITestCase {
static {
//NativeUtil.preloadNativeLibs(); // internal method
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
index 9718374c7..e72d5e506 100644
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
@@ -48,11 +48,12 @@ import com.jogamp.newt.*;
import com.jogamp.newt.event.*;
import com.jogamp.newt.opengl.*;
+import com.jogamp.test.junit.util.UITestCase;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import java.io.IOException;
-public class TestOffscreen01NEWT {
+public class TestOffscreen01NEWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
index fa3b2eadc..7d6b4d7e3 100644
--- a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
@@ -30,6 +30,8 @@ package com.jogamp.test.junit.jogl.texture;
import com.jogamp.test.junit.jogl.util.texture.gl2.TextureGL2ListenerDraw1;
+import com.jogamp.test.junit.util.UITestCase;
+
import javax.media.opengl.GLProfile;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.awt.GLCanvas;
@@ -51,7 +53,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
-public class TestTexture01AWT {
+public class TestTexture01AWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
index 5999df173..263f5da1a 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
@@ -52,10 +52,11 @@ import com.jogamp.newt.event.*;
import com.jogamp.newt.opengl.*;
import java.io.IOException;
+import com.jogamp.test.junit.util.UITestCase;
import com.jogamp.test.junit.util.MiscUtils;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestDisplayLifecycle01NEWT {
+public class TestDisplayLifecycle01NEWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
index 0740af912..77514f83c 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
@@ -63,7 +63,7 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.util.*;
-public class TestFocus01SwingAWTRobot {
+public class TestFocus01SwingAWTRobot extends UITestCase {
static {
GLProfile.initSingleton();
@@ -74,19 +74,16 @@ public class TestFocus01SwingAWTRobot {
static long durationPerTest = 800;
static GLCapabilities glCaps;
- static SingletonInstance instance;
@BeforeClass
public static void initClass() {
width = 640;
height = 480;
glCaps = new GLCapabilities(null);
- instance = AWTRobotUtil.lock();
}
@AfterClass
public static void release() {
- instance.unlock();
}
@Test
diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
index 547dc646e..26f2163f6 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
@@ -70,12 +70,11 @@ import java.io.IOException;
import com.jogamp.test.junit.util.*;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestFocus02SwingAWTRobot {
+public class TestFocus02SwingAWTRobot extends UITestCase {
static int width, height;
static long durationPerTest = 800;
static long waitReparent = 0;
static GLCapabilities glCaps;
- static SingletonInstance instance;
@BeforeClass
public static void initClass() throws AWTException {
@@ -90,13 +89,10 @@ public class TestFocus02SwingAWTRobot {
GLProfile.initSingleton();
glCaps = new GLCapabilities(null);
-
- instance = AWTRobotUtil.lock();
}
@AfterClass
public static void release() {
- instance.unlock();
}
private void testFocus01ProgrFocusImpl(Robot robot)
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
index efd62cf32..df073d0f8 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
@@ -48,10 +48,11 @@ import com.jogamp.newt.event.*;
import com.jogamp.newt.opengl.*;
import java.io.IOException;
+import com.jogamp.test.junit.util.UITestCase;
import com.jogamp.test.junit.util.MiscUtils;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestGLWindows01NEWT {
+public class TestGLWindows01NEWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
index 0f47a34b0..f5474c0ec 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
@@ -49,10 +49,11 @@ import com.jogamp.newt.event.*;
import com.jogamp.newt.opengl.*;
import java.io.IOException;
+import com.jogamp.test.junit.util.UITestCase;
import com.jogamp.test.junit.util.MiscUtils;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestGLWindows02NEWTAnimated {
+public class TestGLWindows02NEWTAnimated extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java b/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
index b98ed2f4d..a3310f513 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
@@ -60,7 +60,7 @@ import com.jogamp.test.junit.util.*;
import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestListenerCom01AWT {
+public class TestListenerCom01AWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
index 22ec08903..ae01b14ed 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
@@ -45,7 +45,9 @@ import javax.media.nativewindow.*;
import com.jogamp.newt.*;
import java.io.IOException;
-public class TestWindows01NEWT {
+import com.jogamp.test.junit.util.UITestCase;
+
+public class TestWindows01NEWT extends UITestCase {
static int width, height;
@BeforeClass
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
index 56b9f2876..3ac830c89 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -55,7 +55,7 @@ import com.jogamp.test.junit.util.*;
import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestParenting01NEWT {
+public class TestParenting01NEWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
index aad060f05..34c1bc1f3 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
@@ -62,7 +62,7 @@ import com.jogamp.test.junit.util.*;
import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestParenting01aAWT {
+public class TestParenting01aAWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java
index 29b045be2..f9a19fe73 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java
@@ -62,7 +62,7 @@ import com.jogamp.test.junit.util.*;
import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestParenting01bAWT {
+public class TestParenting01bAWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
index 5bba968a6..9919666fd 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
@@ -61,7 +61,7 @@ import com.jogamp.test.junit.util.*;
import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestParenting01cAWT {
+public class TestParenting01cAWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
index a9aa11586..6e35f024e 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
@@ -65,7 +65,7 @@ import com.jogamp.test.junit.util.*;
import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestParenting01cSwingAWT {
+public class TestParenting01cSwingAWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
index 57008bb56..7920e7cd4 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
@@ -60,7 +60,7 @@ import com.jogamp.test.junit.util.*;
import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestParenting02AWT {
+public class TestParenting02AWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java
index 1e093c508..8d1c7594c 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java
@@ -55,7 +55,7 @@ import com.jogamp.test.junit.util.*;
import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
-public class TestParenting02NEWT {
+public class TestParenting02NEWT extends UITestCase {
static {
GLProfile.initSingleton();
}
diff --git a/src/junit/com/jogamp/test/junit/util/AWTFocusAdapter.java b/src/junit/com/jogamp/test/junit/util/AWTFocusAdapter.java
index 0fee699e7..6fa9d47a3 100644
--- a/src/junit/com/jogamp/test/junit/util/AWTFocusAdapter.java
+++ b/src/junit/com/jogamp/test/junit/util/AWTFocusAdapter.java
@@ -31,7 +31,7 @@ package com.jogamp.test.junit.util;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
-public class AWTFocusAdapter implements TestEventCountAdapter, FocusListener {
+public class AWTFocusAdapter implements EventCountAdapter, FocusListener {
String prefix;
int focusGained = 0;
diff --git a/src/junit/com/jogamp/test/junit/util/AWTKeyAdapter.java b/src/junit/com/jogamp/test/junit/util/AWTKeyAdapter.java
index df97ebe66..5ee715cdf 100644
--- a/src/junit/com/jogamp/test/junit/util/AWTKeyAdapter.java
+++ b/src/junit/com/jogamp/test/junit/util/AWTKeyAdapter.java
@@ -29,7 +29,7 @@
package com.jogamp.test.junit.util;
-public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements TestEventCountAdapter {
+public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements EventCountAdapter {
String prefix;
int keyTyped;
diff --git a/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java b/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java
index fd3d690e3..5240178a7 100644
--- a/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java
+++ b/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java
@@ -44,14 +44,6 @@ public class AWTRobotUtil {
public static int TIME_OUT = 1000; // 1s
- public static final String SINGLE_INSTANCE_LOCK_FILE = "AWTRobotUtil.lock";
-
- public static SingletonInstance lock() {
- SingletonInstance si = new SingletonInstance(SINGLE_INSTANCE_LOCK_FILE);
- si.lock(3*60*1000, 500); // wait up to 3 min, poll every 500ms
- return si;
- }
-
/**
* toFront, call setVisible(true) and toFront(),
* after positioning the mouse in the middle of the window via robot.
@@ -187,7 +179,7 @@ public class AWTRobotUtil {
* @param keyTypedCounter shall return the number of keys typed (press + release)
* @return True if the object received 2 keys within TIME_OUT
*/
- public static boolean testKeyInput(Robot robot, TestEventCountAdapter keyTypedCounter)
+ public static boolean testKeyInput(Robot robot, EventCountAdapter keyTypedCounter)
throws AWTException, InterruptedException, InvocationTargetException {
Component comp = null;
com.jogamp.newt.Window win = null;
diff --git a/src/junit/com/jogamp/test/junit/util/EventCountAdapter.java b/src/junit/com/jogamp/test/junit/util/EventCountAdapter.java
index 043c7fc76..3087d5c99 100644
--- a/src/junit/com/jogamp/test/junit/util/EventCountAdapter.java
+++ b/src/junit/com/jogamp/test/junit/util/EventCountAdapter.java
@@ -28,7 +28,7 @@
package com.jogamp.test.junit.util;
-public interface TestEventCountAdapter {
+public interface EventCountAdapter {
int getCount();
diff --git a/src/junit/com/jogamp/test/junit/util/NEWTFocusAdapter.java b/src/junit/com/jogamp/test/junit/util/NEWTFocusAdapter.java
index ce6d2c6b4..48d2fd565 100644
--- a/src/junit/com/jogamp/test/junit/util/NEWTFocusAdapter.java
+++ b/src/junit/com/jogamp/test/junit/util/NEWTFocusAdapter.java
@@ -31,7 +31,7 @@ package com.jogamp.test.junit.util;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.event.WindowEvent;
-public class NEWTFocusAdapter extends WindowAdapter implements TestEventCountAdapter {
+public class NEWTFocusAdapter extends WindowAdapter implements EventCountAdapter {
String prefix;
int focusGained = 0;
diff --git a/src/junit/com/jogamp/test/junit/util/NEWTKeyAdapter.java b/src/junit/com/jogamp/test/junit/util/NEWTKeyAdapter.java
index a7efe6302..ab00f4f61 100644
--- a/src/junit/com/jogamp/test/junit/util/NEWTKeyAdapter.java
+++ b/src/junit/com/jogamp/test/junit/util/NEWTKeyAdapter.java
@@ -31,7 +31,7 @@ package com.jogamp.test.junit.util;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
-public class NEWTKeyAdapter extends KeyAdapter implements TestEventCountAdapter {
+public class NEWTKeyAdapter extends KeyAdapter implements EventCountAdapter {
String prefix;
int keyTyped;
diff --git a/src/junit/com/jogamp/test/junit/util/SingletonInstance.java b/src/junit/com/jogamp/test/junit/util/SingletonInstance.java
index 52775116b..997742cf6 100644
--- a/src/junit/com/jogamp/test/junit/util/SingletonInstance.java
+++ b/src/junit/com/jogamp/test/junit/util/SingletonInstance.java
@@ -74,6 +74,9 @@ public class SingletonInstance {
if(tryLock()) {
return;
}
+ if(DEBUG && 0==i) {
+ System.err.println("Wait for lock " + file);
+ }
i++;
Thread.sleep(poll_ms);
} while ( i < timeout_ms / poll_ms ) ;
diff --git a/src/junit/com/jogamp/test/junit/util/UITestCase.java b/src/junit/com/jogamp/test/junit/util/UITestCase.java
new file mode 100644
index 000000000..200a96fe9
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/util/UITestCase.java
@@ -0,0 +1,59 @@
+/**
+ * Copyright 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.test.junit.util;
+
+import org.junit.BeforeClass;
+import org.junit.AfterClass;
+
+import java.lang.reflect.InvocationTargetException;
+
+public abstract class UITestCase {
+
+ public static final String SINGLE_INSTANCE_LOCK_FILE = "UITestCase.lock";
+
+ static SingletonInstance singletonInstance;
+
+ protected SingletonInstance getSingletonInstance() {
+ return singletonInstance;
+ }
+
+ @BeforeClass
+ public static void oneTimeSetUp() {
+ // one-time initialization code
+ singletonInstance = new SingletonInstance(SINGLE_INSTANCE_LOCK_FILE);
+ singletonInstance.lock(3*60*1000, 100); // wait up to 3 min, poll every 100ms
+ }
+
+ @AfterClass
+ public static void oneTimeTearDown() {
+ // one-time cleanup code
+ singletonInstance.unlock();
+ }
+}
+