summaryrefslogtreecommitdiffstats
path: root/src/junit/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-10-14 21:26:43 +0200
committerSven Gothel <[email protected]>2010-10-14 21:26:43 +0200
commit774138544e1eec3330309ad682fa05154a07ab8d (patch)
treea9d612e98f1d16390763f54ab1888ff66f081a22 /src/junit/com
parentd7faeb8b96f5aba76967096006af4c420d964fef (diff)
JOGL: Reenable Applet/Webstart/RCP support for JOGL + AWT + X11
Changed GLProfile/NativeWindowFactory/.. initialization methodology: GLProfile: public static synchronized void initSingleton(final boolean firstUIActionOnProcess); NativeWindowFactory: public static synchronized void initSingleton(final boolean firstUIActionOnProcess); +++ Introducing NativeWindow ToolkitLock, implementations are NullToolkitLock JAWTToolkitLock X11JAWTToolkitLock X11ToolkitLock AbstractGraphicsDevice provides generic global toolkit locking methods, implemented by the ToolkitLock interface. ToolkitLock's are aggregated in NativeWindow's DefaultGraphicsDevice to implement it's superclass lock()/unlock() methods. This enables a device specific locking strategy, ie on X11/AWT utilizing JAWT && X11 locking, and maybe none for others (NEWT). No locking is required for X11 / AWT, in case the above mentioned initialization happened as a 'firstUIActionOnProcess'. The ToolkitLock factory is currently a hardcoded part of NativeWindowFactory. We may have to allow 3rd party NativeWindow implementations to register custom ones. +++ com.jogamp.opengl.impl.GLDrawableImpl cleanup: Dealing with all locking code, providing all public methods. Exceptions are commented. Specializations x11/windows/.. only contains platform code. Pulled down access qualifiers if possible public -> protected. com.jogamp.nativewindow.impl.x11.X11Util Wrapping all X11Lib method with the new locking code. com.jogamp.nativewindow.impl.jawt.JAWTUtil Utilize global SunToolkit.awtLock() is available, the fallback to global JAWT.lock(). The latter just invokes the first. javax.media.nativewindow.awt.AWTGraphicsDevice setHandle(long handle) -> setSubType(String type, long handle) which also resets the ToolkitLock respecting the new type. This ensures correct locking after the sub type has been determined, ie AWT using an X11 peer. +++ Misc Changes done on the way .. GLCanvas: Fixed inversed this.drawableHelper.isExternalAnimatorAnimating() condition, which disabled normal repaint. GLJPanel: Removed drawableHelper.isExternalAnimatorAnimating() condition, which disabled painting, since the animation thread just updates the source image. NEWT WindowImpl: When reparenting back to parent and 'refit' child if it's size exceeds it's parent. More 'Fix: Memory consumption' commit 6ced17f0325d5719e992b246ffd156e5b39694b4. NEWTEvent: Removed code to evaluate the 'system event' attribute, need to find a better approach.
Diffstat (limited to 'src/junit/com')
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/acore/DumpVersion.java18
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java4
-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.java8
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java6
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java13
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java47
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java5
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java10
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java53
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestEventSourceNotAWTBug.java (renamed from src/junit/com/jogamp/test/junit/newt/TestEventSourceNotNEWTBug.java)4
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java6
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java5
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java1
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java8
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java5
-rw-r--r--src/junit/com/jogamp/test/junit/util/UITestCase.java1
31 files changed, 118 insertions, 148 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/acore/DumpVersion.java b/src/junit/com/jogamp/test/junit/jogl/acore/DumpVersion.java
index 1c563970f..3fa7f111f 100644
--- a/src/junit/com/jogamp/test/junit/jogl/acore/DumpVersion.java
+++ b/src/junit/com/jogamp/test/junit/jogl/acore/DumpVersion.java
@@ -35,6 +35,7 @@ import org.junit.AfterClass;
import org.junit.Test;
import javax.media.opengl.*;
+import com.jogamp.opengl.util.VersionInfo;
import com.jogamp.common.os.Platform;
import java.io.IOException;
@@ -44,16 +45,9 @@ public class DumpVersion implements GLEventListener {
public void init(GLAutoDrawable drawable) {
GL gl = drawable.getGL();
- System.err.println(Thread.currentThread()+" Platform: " + Platform.getOS() + " (os), " + Platform.getArch() + " (arch)");
- System.err.println(Thread.currentThread()+" Platform: littleEndian " + Platform.isLittleEndian() + ", 32Bit "+Platform.is32Bit() + ", a-ptr bit-size "+Platform.getPointerSizeInBits());
- System.err.println(Thread.currentThread()+" Platform: JavaSE " + Platform.isJavaSE());
- System.err.println(Thread.currentThread()+" GL Profile " + gl.getGLProfile());
- System.err.println(Thread.currentThread()+" CTX VERSION " + gl.getContext().getGLVersion());
- System.err.println(Thread.currentThread()+" GL " + gl);
- System.err.println(Thread.currentThread()+" GL_VERSION " + gl.glGetString(gl.GL_VERSION));
- System.err.println(Thread.currentThread()+" GL_EXTENSIONS ");
- System.err.println(Thread.currentThread()+" " + gl.glGetString(gl.GL_EXTENSIONS));
- System.err.println(Thread.currentThread()+" swapInterval " + gl.getSwapInterval());
+ String prefix = Thread.currentThread().getName();
+
+ System.err.println(VersionInfo.getInfo(null, prefix, gl).toString());
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
@@ -64,8 +58,4 @@ public class DumpVersion implements GLEventListener {
public void dispose(GLAutoDrawable drawable) {
}
-
- public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {
- }
-
}
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 711ac7c87..b42fce9bf 100644
--- a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
@@ -44,13 +44,11 @@ import com.jogamp.newt.*;
import java.io.IOException;
public class TestGLProfile01NEWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
static GLProfile glp;
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
glp = GLProfile.getDefault();
Assert.assertNotNull(glp);
}
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 5ee3d3814..006010eeb 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT01GLn.java
@@ -47,15 +47,12 @@ import org.junit.Test;
public class TestAWT01GLn extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
Frame frame=null;
GLCanvas glCanvas=null;
@BeforeClass
public static void startup() {
+ GLProfile.initSingleton(true);
System.out.println("GLProfile <static> "+GLProfile.glAvailabilityToString());
}
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 a4726f1c6..9e8cb916a 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT02WindowClosing.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestAWT02WindowClosing.java
@@ -42,12 +42,14 @@ import org.junit.After;
import org.junit.Test;
public class TestAWT02WindowClosing extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
static long durationPerTest = 200; // ms
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton(true);
+ }
+
@Test
public void test01WindowClosing() throws InterruptedException {
Frame frame = new Frame();
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 c3b9e10ab..4559ee936 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWT01GLn.java
@@ -53,16 +53,12 @@ import static javax.swing.SwingUtilities.*;
* @author Michael Bien
*/
public class TestSwingAWT01GLn extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
-
private Window[] windows;
@BeforeClass
public static void startup() {
+ GLProfile.initSingleton(true);
System.out.println("GLProfile <static> "+GLProfile.glAvailabilityToString());
}
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 9f12b658a..2f4a95646 100644
--- a/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
+++ b/src/junit/com/jogamp/test/junit/jogl/awt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
@@ -117,6 +117,9 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
public static void setup() throws InterruptedException, InvocationTargetException, AWTException {
int count;
+ // GLProfile.initSingleton(false);
+ // GLProfile.initSingleton(true);
+
// simulate AWT usage before JOGL's initialization of X11 threading
windowClosing=false;
border = BorderFactory.createLineBorder (Color.yellow, 2);
@@ -166,14 +169,18 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
System.err.println("Clean End of Pre-JOGL-Swing");
- GLProfile.initSingleton();
+ GLProfile.initSingleton(false);
}
@AfterClass
- public static void release() {
+ public static void release() throws InterruptedException, InvocationTargetException {
robot = null;
Assert.assertNotNull(frame);
- frame.dispose();
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.dispose();
+ }
+ });
frame=null;
}
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
index ef5cf134a..3a3823d96 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java
@@ -3,10 +3,12 @@ package com.jogamp.test.junit.jogl.demos.gl2.gears;
import javax.media.opengl.*;
import javax.media.opengl.awt.*;
+import com.jogamp.opengl.util.Animator;
import com.jogamp.newt.event.*;
import com.jogamp.newt.event.awt.*;
import java.awt.Component;
+import java.awt.Frame;
import com.jogamp.newt.Window;
/**
@@ -24,8 +26,44 @@ public class Gears implements GLEventListener {
private int prevMouseX, prevMouseY;
private boolean mouseRButtonDown = false;
+ public static void main(String[] args) {
+ // set argument 'NotFirstUIActionOnProcess' in the JNLP's application-desc tag for example
+ // <application-desc main-class="demos.j2d.TextCube"/>
+ // <argument>NotFirstUIActionOnProcess</argument>
+ // </application-desc>
+ boolean firstUIActionOnProcess = 0==args.length || !args[0].equals("NotFirstUIActionOnProcess") ;
+ GLProfile.initSingleton(firstUIActionOnProcess);
+
+ Frame frame = new Frame("Gear Demo");
+ GLCanvas canvas = new GLCanvas();
+ // GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ // GLCanvas canvas = new GLCanvas(caps);
+
+ final Gears gears = new Gears();
+ canvas.addGLEventListener(gears);
+
+ frame.add(canvas);
+ frame.setSize(300, 300);
+ final Animator animator = new Animator(canvas);
+ frame.addWindowListener(new java.awt.event.WindowAdapter() {
+ public void windowClosing(java.awt.event.WindowEvent e) {
+ // Run this on another thread than the AWT event queue to
+ // make sure the call to Animator.stop() completes before
+ // exiting
+ new Thread(new Runnable() {
+ public void run() {
+ animator.stop();
+ System.exit(0);
+ }
+ }).start();
+ }
+ });
+ frame.setVisible(true);
+ animator.start();
+ }
+
public void init(GLAutoDrawable drawable) {
- System.out.println("Gears: Init");
+ System.err.println("Gears: Init");
// Use debug pipeline
// drawable.setGL(new DebugGL(drawable.getGL()));
@@ -78,7 +116,7 @@ public class Gears implements GLEventListener {
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- System.out.println("Gears: Reshape");
+ System.err.println("Gears: Reshape");
GL2 gl = drawable.getGL().getGL2();
float h = (float)height / (float)width;
@@ -93,7 +131,7 @@ public class Gears implements GLEventListener {
}
public void dispose(GLAutoDrawable drawable) {
- System.out.println("Gears: Dispose");
+ System.err.println("Gears: Dispose");
}
public void display(GLAutoDrawable drawable) {
@@ -103,14 +141,13 @@ public class Gears implements GLEventListener {
// Get the GL corresponding to the drawable we are animating
GL2 gl = drawable.getGL().getGL2();
- /**
// Special handling for the case where the GLJPanel is translucent
// and wants to be composited with other Java 2D content
if ((drawable instanceof GLJPanel) &&
!((GLJPanel) drawable).isOpaque() &&
((GLJPanel) drawable).shouldPreserveColorBufferIfTranslucent()) {
gl.glClear(GL2.GL_DEPTH_BUFFER_BIT);
- } else */ {
+ } else {
gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
}
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 52a4885b4..60435cb4a 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
@@ -48,15 +48,12 @@ import org.junit.After;
import org.junit.Test;
public class TestGearsAWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static GLProfile glp;
static int width, height;
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
glp = GLProfile.getDefault();
Assert.assertNotNull(glp);
width = 512;
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 88cfa9c95..1589be84c 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
@@ -46,15 +46,12 @@ import org.junit.After;
import org.junit.Test;
public class TestGearsNEWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static GLProfile glp;
static int width, height;
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
glp = GLProfile.getDefault();
Assert.assertNotNull(glp);
width = 512;
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 47cdd4bfa..27c353942 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
@@ -46,15 +46,12 @@ import org.junit.After;
import org.junit.Test;
public class TestGearsNewtAWTWrapper extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static GLProfile glp;
static int width, height;
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
glp = GLProfile.getDefault();
Assert.assertNotNull(glp);
width = 512;
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 243c9e8a7..95db913ab 100644
--- a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
@@ -42,10 +42,6 @@ import com.jogamp.newt.*;
import java.io.IOException;
public class TestDrawable01NEWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static GLProfile glp;
static GLDrawableFactory factory;
static int width, height;
@@ -56,6 +52,7 @@ public class TestDrawable01NEWT extends UITestCase {
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
glp = GLProfile.getDefault();
Assert.assertNotNull(glp);
factory = GLDrawableFactory.getFactory(glp);
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 bedea39ad..0d9a595aa 100644
--- a/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java
@@ -16,6 +16,7 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import com.jogamp.newt.Display;
@@ -32,13 +33,14 @@ import java.io.IOException;
*/
public class TestTransformFeedbackVeryingsBug407NEWT extends UITestCase {
- static {
- //NativeUtil.preloadNativeLibs(); // internal method
- GLProfile.initSingleton();
- }
private GLContext context;
private String VERTEX_SHADER_TEXT;
+ @BeforeClass
+ public static void initClass() {
+ GLProfile.initSingleton(true);
+ }
+
@Before
public void setUp() {
if(!GLProfile.isGL3Available()) {
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 e72d5e506..1d699a1aa 100644
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
@@ -54,10 +54,6 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import java.io.IOException;
public class TestOffscreen01NEWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static GLProfile glpDefault;
static GLDrawableFactory glDrawableFactory;
static int width, height;
@@ -65,6 +61,7 @@ public class TestOffscreen01NEWT extends UITestCase {
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
glpDefault = GLProfile.getDefault();
Assert.assertNotNull(glpDefault);
glDrawableFactory = GLDrawableFactory.getFactory(glpDefault);
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 7d6b4d7e3..2eb66663c 100644
--- a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
@@ -54,16 +54,13 @@ import org.junit.BeforeClass;
import org.junit.Test;
public class TestTexture01AWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static GLProfile glp;
static GLCapabilities caps;
BufferedImage textureImage;
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
glp = GLProfile.get(GLProfile.GL2GL3);
Assert.assertNotNull(glp);
caps = new GLCapabilities(glp);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
index 7f70d1f8b..072ebafd6 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
@@ -1,33 +1,29 @@
-/*
- * Copyright (c) 2010 Sven Gothel. All Rights Reserved.
+/**
+ * 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:
*
- * 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.
*
- * - Redistribution 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.
*
- * - Redistribution 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.
*
- * Neither the name Sven Gothel or the names of
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * This software is provided "AS IS," without a warranty of any kind. ALL
- * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
- * INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
- * PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
- * MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
- * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
- * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR
- * ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR
- * DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
- * DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
- * ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
- * SVEN GOTHEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ * 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.newt;
@@ -57,10 +53,6 @@ import com.jogamp.test.junit.util.MiscUtils;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestDisplayLifecycle01NEWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static GLProfile glp;
static GLCapabilities caps;
static int width, height;
@@ -68,6 +60,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase {
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
glp = GLProfile.getDefault();
diff --git a/src/junit/com/jogamp/test/junit/newt/TestEventSourceNotNEWTBug.java b/src/junit/com/jogamp/test/junit/newt/TestEventSourceNotAWTBug.java
index 7e596eb8c..8776b7be8 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestEventSourceNotNEWTBug.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestEventSourceNotAWTBug.java
@@ -51,7 +51,7 @@ import com.jogamp.test.junit.util.*;
/**
* This simple program will throw a {@link RuntimeException} when the application is closed.
*/
-public class TestEventSourceNotNEWTBug extends UITestCase {
+public class TestEventSourceNotAWTBug extends UITestCase {
@BeforeClass
public static void initClass() {
@@ -92,7 +92,7 @@ public class TestEventSourceNotNEWTBug extends UITestCase {
}
public static void main(String args[]) throws IOException {
- String tstname = TestEventSourceNotNEWTBug.class.getName();
+ String tstname = TestEventSourceNotAWTBug.class.getName();
/*
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
tstname,
diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
index 6ae0ee9d3..656783740 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
@@ -68,11 +68,6 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.util.*;
public class TestFocus01SwingAWTRobot extends UITestCase {
-
- static {
- GLProfile.initSingleton();
- }
-
static int width, height;
static long durationPerTest = 800;
@@ -81,6 +76,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
glCaps = new GLCapabilities(null);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
index 1ca5e6cd7..8d262fc3f 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
@@ -75,7 +75,7 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
f.dispose();
f=null;
- GLProfile.initSingleton();
+ GLProfile.initSingleton(false);
glCaps = new GLCapabilities(null);
}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
index df073d0f8..aad61565f 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
@@ -53,16 +53,13 @@ import com.jogamp.test.junit.util.MiscUtils;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestGLWindows01NEWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static GLProfile glp;
static int width, height;
static long durationPerTest = 100; // ms
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
glp = GLProfile.getDefault();
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
index f5474c0ec..7a8bc1db0 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
@@ -54,16 +54,13 @@ import com.jogamp.test.junit.util.MiscUtils;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestGLWindows02NEWTAnimated extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static GLProfile glp;
static int width, height;
static long durationPerTest = 100; // ms
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
glp = GLProfile.getDefault();
diff --git a/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java b/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
index a3310f513..39eb47ca9 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
@@ -61,16 +61,13 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestListenerCom01AWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static int width, height;
static long durationPerTest = 500;
static boolean verbose = false;
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
index ae01b14ed..88edd89ba 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
@@ -52,6 +52,7 @@ public class TestWindows01NEWT extends UITestCase {
@BeforeClass
public static void initClass() {
+ NativeWindowFactory.initSingleton(true);
width = 640;
height = 480;
}
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 c07601eb6..2d1bb82a6 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -56,16 +56,13 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting01NEWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static int width, height;
static long durationPerTest = 500;
static GLCapabilities glCaps;
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
glCaps = new GLCapabilities(null);
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 3d3f5234d..931cf2d5f 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
@@ -63,20 +63,18 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting01aAWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static int width, height;
static long durationPerTest = 800;
static long waitReparent = 0;
static GLCapabilities glCaps;
@BeforeClass
- public static void initClass() {
+ public static void initClass() throws InterruptedException {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
glCaps = new GLCapabilities(null);
+ // Thread.sleep(10000);
}
@Test
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 11d25822a..9eecf31a1 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java
@@ -63,10 +63,6 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting01bAWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static int width, height;
static long durationPerTest = 800;
static long waitReparent = 0;
@@ -74,6 +70,7 @@ public class TestParenting01bAWT extends UITestCase {
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
glCaps = new GLCapabilities(null);
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 24ee30bc0..2dcc7af9b 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
@@ -62,16 +62,13 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting01cAWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static int width, height;
static long durationPerTest = 800;
static GLCapabilities glCaps;
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
glCaps = new GLCapabilities(null);
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 ece99c0be..3fc39a3f1 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
@@ -66,10 +66,6 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting01cSwingAWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static int width, height;
static long durationPerTest = 800;
static long waitReparent = 0;
@@ -77,6 +73,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
glCaps = new GLCapabilities(null);
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 a4b8c183d..3311bc691 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
@@ -61,10 +61,6 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting02AWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static int width, height;
static long durationPerTest = 500;
static long waitReparent = 300;
@@ -72,6 +68,7 @@ public class TestParenting02AWT extends UITestCase {
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
}
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 8d1c7594c..3d9efcf82 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java
@@ -56,15 +56,12 @@ import com.jogamp.test.junit.jogl.demos.es1.RedSquare;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting02NEWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static int width, height;
static long durationPerTest = 500;
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
width = 640;
height = 480;
}
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java
index f7374a98b..6130a5fcd 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java
@@ -64,10 +64,6 @@ import com.jogamp.test.junit.util.*;
import com.jogamp.test.junit.jogl.demos.gl2.gears.Gears;
public class TestParenting03AWT extends UITestCase {
- static {
- GLProfile.initSingleton();
- }
-
static Dimension size;
static long durationPerTest = 800;
static long waitAdd2nd = 500;
@@ -75,6 +71,7 @@ public class TestParenting03AWT extends UITestCase {
@BeforeClass
public static void initClass() {
+ GLProfile.initSingleton(true);
size = new Dimension(400,200);
glCaps = new GLCapabilities(null);
}
diff --git a/src/junit/com/jogamp/test/junit/util/UITestCase.java b/src/junit/com/jogamp/test/junit/util/UITestCase.java
index 5bf76234d..e169405b0 100644
--- a/src/junit/com/jogamp/test/junit/util/UITestCase.java
+++ b/src/junit/com/jogamp/test/junit/util/UITestCase.java
@@ -55,6 +55,7 @@ public abstract class UITestCase {
@AfterClass
public static void oneTimeTearDown() {
// one-time cleanup code
+ System.gc(); // force cleanup
singletonInstance.unlock();
}