aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com/jogamp/opengl')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java46
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java46
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java88
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java27
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java30
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java31
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java52
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java58
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java56
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java71
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java16
26 files changed, 304 insertions, 302 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java
index 316199d07..c612f1204 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch02AWT.java
@@ -45,7 +45,6 @@ import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.GLDrawableUtil;
-
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -116,14 +115,14 @@ public class TestGLContextDrawableSwitch02AWT extends UITestCase {
final GLCapabilities capsOffscreen = (GLCapabilities) capsOnscreen.clone();
capsOffscreen.setOnscreen(false);
- final QuitAdapter quitAdapter = new QuitAdapter();
-
final Frame frame = new Frame("Gears AWT Test");
Assert.assertNotNull(frame);
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
GLAutoDrawable glCanvas = createGLAutoDrawable(frame, capsOnscreen, width, height);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas).addTo(frame);
+
final SnapshotGLEventListener snapshotGLEventListener = new SnapshotGLEventListener();
GearsES2 gears = new GearsES2(1);
glCanvas.addGLEventListener(gears);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java
index 443908ff8..28e00dfe2 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java
@@ -236,9 +236,8 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
if( twoCanvas ) {
animator.add(glCanvas2);
}
- QuitAdapter quitAdapter = new QuitAdapter();
-
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas1).addTo(frame);
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java
index df24fc6e0..5f1b43a61 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java
@@ -80,9 +80,9 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase {
final Animator animator = new Animator();
animator.add(glCanvas1);
- QuitAdapter quitAdapter = new QuitAdapter();
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas1).addTo(frame);
// Build a GUI where the canvas 3D is located at top right of the frame
// and can be resized with split panes dividers
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java
index 29dc9a190..f37cdf332 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java
@@ -87,9 +87,9 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase {
final Animator animator = new Animator();
animator.add(glCanvas1);
- QuitAdapter quitAdapter = new QuitAdapter();
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas1).addTo(frame);
// Create a check box that hides / shows canvas
final Checkbox checkbox = new Checkbox("Visible canvas", true);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java
index 3e60c8b47..acdd40764 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java
@@ -93,9 +93,9 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase {
final Animator animator = new Animator();
animator.add(glCanvas1);
- QuitAdapter quitAdapter = new QuitAdapter();
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas1).addTo(frame);
// Create a check box that hides / shows canvas
final Checkbox checkbox = new Checkbox("Visible canvas", true);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java
index 24f9de961..52480b89b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java
@@ -95,9 +95,9 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase {
final Animator animator = new Animator();
animator.add(glCanvas1);
- QuitAdapter quitAdapter = new QuitAdapter();
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas1).addTo(frame);
// Create a check box that hides / shows canvas
final JCheckBox checkbox = new JCheckBox("Visible canvas", true);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java
index b558b1680..246c5cdb5 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.opengl.test.junit.jogl.awt;
import java.awt.BorderLayout;
@@ -59,55 +59,55 @@ import com.jogamp.opengl.util.Animator;
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug816OSXCALayerPos04aAWT extends UITestCase {
- static long duration = 1600; // ms
+ static long duration = 1600; // ms
static int width=640, height=480;
-
+
@Test
public void test() throws InterruptedException, InvocationTargetException {
final GLCapabilities caps = new GLCapabilities(getGLP());
-
+
final Frame frame = new Frame("TestBug816OSXCALayerPos04aAWT");
Assert.assertNotNull(frame);
final GLCanvas glCanvas1 = new GLCanvas(caps);
Assert.assertNotNull(glCanvas1);
glCanvas1.addGLEventListener(new GearsES2(1));
-
+
final Animator animator = new Animator();
animator.add(glCanvas1);
- QuitAdapter quitAdapter = new QuitAdapter();
-
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas1).addTo(frame);
// Display the canvas 3D in a dialog child of a frame
frame.setSize(400, 400);
-
+
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setLocation(100, 100);
frame.setSize(width, height);
frame.setVisible(true);
- }});
+ }});
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
-
+
final Dialog dialog = new Dialog(frame, "Bug 816 AWT Top-Level Dialog");
dialog.setLayout(new BorderLayout());
dialog.add(glCanvas1, BorderLayout.CENTER);
-
+
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
dialog.setLocation(200, 200);
dialog.setSize(width/2, height/2);
dialog.setVisible(true);
- }});
+ }});
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(dialog, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
-
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+
animator.start();
Assert.assertTrue(animator.isStarted());
Assert.assertTrue(animator.isAnimating());
animator.setUpdateFPSFrames(60, System.err);
-
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
@@ -117,7 +117,7 @@ public class TestBug816OSXCALayerPos04aAWT extends UITestCase {
Assert.assertNotNull(frame);
Assert.assertNotNull(glCanvas1);
-
+
Assert.assertNotNull(animator);
animator.stop();
Assert.assertFalse(animator.isAnimating());
@@ -138,7 +138,7 @@ public class TestBug816OSXCALayerPos04aAWT extends UITestCase {
static GLProfile getGLP() {
return GLProfile.getMaxProgrammableCore(true);
}
-
+
public static void main(String args[]) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -146,7 +146,7 @@ public class TestBug816OSXCALayerPos04aAWT extends UITestCase {
duration = MiscUtils.atol(args[i], duration);
}
}
-
+
org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos04aAWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java
index b502dbdae..186191b19 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.opengl.test.junit.jogl.awt;
import java.awt.BorderLayout;
@@ -59,55 +59,55 @@ import com.jogamp.opengl.util.Animator;
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBug816OSXCALayerPos04bAWT extends UITestCase {
- static long duration = 1600; // ms
+ static long duration = 1600; // ms
static int width=640, height=480;
-
+
@Test
public void test() throws InterruptedException, InvocationTargetException {
final GLCapabilities caps = new GLCapabilities(getGLP());
-
+
final JFrame frame = new JFrame("TestBug816OSXCALayerPos04bAWT");
Assert.assertNotNull(frame);
final GLCanvas glCanvas1 = new GLCanvas(caps);
Assert.assertNotNull(glCanvas1);
glCanvas1.addGLEventListener(new GearsES2(1));
-
+
final Animator animator = new Animator();
animator.add(glCanvas1);
- QuitAdapter quitAdapter = new QuitAdapter();
-
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas1).addTo(frame);
// Display the canvas 3D in a dialog child of a frame
frame.setSize(400, 400);
-
+
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setLocation(100, 100);
frame.setSize(width, height);
frame.setVisible(true);
- }});
+ }});
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
-
- final JDialog dialog = new JDialog(frame, "Bug 816 AWT Top-Level JDialog");
+
+ final JDialog dialog = new JDialog(frame, "Bug 816 AWT Top-Level JDialog");
dialog.setLayout(new BorderLayout());
dialog.add(glCanvas1, BorderLayout.CENTER);
-
+
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
dialog.setLocation(200, 200);
dialog.setSize(width/2, height/2);
dialog.setVisible(true);
- }});
+ }});
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(dialog, true));
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
-
+
animator.start();
Assert.assertTrue(animator.isStarted());
Assert.assertTrue(animator.isAnimating());
animator.setUpdateFPSFrames(60, System.err);
-
+
final long t0 = System.currentTimeMillis();
long t1 = t0;
while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
@@ -117,7 +117,7 @@ public class TestBug816OSXCALayerPos04bAWT extends UITestCase {
Assert.assertNotNull(frame);
Assert.assertNotNull(glCanvas1);
-
+
Assert.assertNotNull(animator);
animator.stop();
Assert.assertFalse(animator.isAnimating());
@@ -138,7 +138,7 @@ public class TestBug816OSXCALayerPos04bAWT extends UITestCase {
static GLProfile getGLP() {
return GLProfile.getMaxProgrammableCore(true);
}
-
+
public static void main(String args[]) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -146,7 +146,7 @@ public class TestBug816OSXCALayerPos04bAWT extends UITestCase {
duration = MiscUtils.atol(args[i], duration);
}
}
-
+
org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos04bAWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java
index 2d4c6da4d..a279870df 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.opengl.test.junit.jogl.awt;
@@ -51,7 +51,6 @@ import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.GLReadBufferUtil;
import java.awt.Dimension;
-
import java.io.IOException;
import org.junit.Assert;
@@ -62,7 +61,7 @@ import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
/**
- * Unit test for bug 826, test {@link GLJPanel}'s {@link TextureState} save and restore.
+ * Unit test for bug 826, test {@link GLJPanel}'s {@link TextureState} save and restore.
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGLJPanelTextureStateAWT extends UITestCase {
@@ -73,25 +72,25 @@ public class TestGLJPanelTextureStateAWT extends UITestCase {
public static void initClass() {
}
- public void testImpl(final boolean keepTextureBound, final int texUnit)
- throws InterruptedException, IOException
+ public void testImpl(final boolean keepTextureBound, final int texUnit)
+ throws InterruptedException, IOException
{
final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false);
GLProfile glp;
if(GLProfile.isAvailable(GLProfile.GL2ES2)) {
glp = GLProfile.getGL2ES2();
} else {
- System.err.println(getSimpleTestName(".")+": GLProfile n/a");
+ System.err.println(getSimpleTestName(".")+": GLProfile n/a");
return;
}
final GLCapabilities caps = new GLCapabilities(glp);
-
+
final GLJPanel glc = new GLJPanel(caps);
Dimension glc_sz = new Dimension(800, 400);
glc.setMinimumSize(glc_sz);
glc.setPreferredSize(glc_sz);
final JFrame frame = new JFrame("TestGLJPanelTextureStateAWT");
- Assert.assertNotNull(frame);
+ Assert.assertNotNull(frame);
frame.getContentPane().add(glc);
final TextureDraw02ES2ListenerFBO gle0;
@@ -102,16 +101,16 @@ public class TestGLJPanelTextureStateAWT extends UITestCase {
}
gle0.setKeepTextureBound(keepTextureBound);
gle0.setClearBuffers(false);
-
+
final RedSquareES2 gle1 = new RedSquareES2( 1 ) ;
gle1.setClearBuffers(false);
-
+
glc.addGLEventListener(new GLEventListener() {
int gle0X, gle0Y, gle0W, gle0H;
int gle1X, gle1Y, gle1W, gle1H;
int tX, tY, tW, tH;
int shot = 0;
-
+
void setupTex(GL gl) {
// Note: FBObject uses diff defaults, i.e.: GL_NEAREST and GL_CLAMP_TO_EDGE
if( keepTextureBound ) {
@@ -121,7 +120,7 @@ public class TestGLJPanelTextureStateAWT extends UITestCase {
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
}
}
-
+
@Override
public void init(GLAutoDrawable drawable) {
// Initialize w/ arbitrary values !
@@ -138,24 +137,24 @@ public class TestGLJPanelTextureStateAWT extends UITestCase {
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT);
gl.glTexParameteri(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT);
-
+
gle0.init(drawable);
gle1.init(drawable);
setupTex(gl);
}
@Override
- public void dispose(GLAutoDrawable drawable) {
+ public void dispose(GLAutoDrawable drawable) {
gle0.dispose(drawable);
gle1.dispose(drawable);
}
@Override
- public void display(GLAutoDrawable drawable) {
+ public void display(GLAutoDrawable drawable) {
GL2ES2 gl = drawable.getGL().getGL2ES2();
-
+
gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
-
+
// restore viewport test
final int[] viewport = new int[] { 0, 0, 0, 0 };
gl.glGetIntegerv(GL.GL_VIEWPORT, viewport, 0);
@@ -164,25 +163,25 @@ public class TestGLJPanelTextureStateAWT extends UITestCase {
", actual "+gle0X+"/"+gle0Y+" "+gle0W+"x"+gle0H;
Assert.assertTrue("Viewport not restored: "+msg, false);
}
-
+
// gl.glViewport(gle0X, gle0Y, gle0W, gle0H); // restore viewport test
gle0.display(drawable);
-
+
gl.glViewport(gle1X, gle1Y, gle1W, gle1H);
gle1.display(drawable);
-
+
shot++;
if( 4 == shot ) {
gl.glViewport(tX, tY, tW, tH);
snapshot(0, null, drawable.getGL(), screenshot, TextureIO.PNG, null);
- }
-
+ }
+
gl.glViewport(gle0X, gle0Y, gle0W, gle0H); // restore viewport test
-
+
final TextureState ts = new TextureState(drawable.getGL(), GL.GL_TEXTURE_2D);
// System.err.println("XXX: "+ts);
Assert.assertEquals("Texture unit changed", GL.GL_TEXTURE0+texUnit, ts.getUnit());
- if( keepTextureBound ) {
+ if( keepTextureBound ) {
Assert.assertEquals("Texture mag-filter changed", GL.GL_LINEAR, ts.getMagFilter());
Assert.assertEquals("Texture mag-filter changed", GL.GL_LINEAR, ts.getMinFilter());
Assert.assertEquals("Texture wrap-s changed", GL.GL_REPEAT, ts.getWrapS());
@@ -196,37 +195,37 @@ public class TestGLJPanelTextureStateAWT extends UITestCase {
gle0Y = y;
gle0W = width/2 - 2*border;
gle0H = height;
-
+
gle1X = gle0X + gle0W + 2*border;
gle1Y = y;
gle1W = width/2 - 2*border;
gle1H = height;
-
+
tX = x;
tY = y;
tW = width;
tH = height;
-
+
GL2ES2 gl = drawable.getGL().getGL2ES2();
gl.glViewport(gle0X, gle0Y, gle0W, gle0H);
gle0.reshape(drawable, gle0X, gle0Y, gle0W, gle0H);
-
+
gl.glViewport(gle1X, gle1Y, gle1W, gle1H);
gle1.reshape(drawable, gle1X, gle1Y, gle1W, gle1H);
-
+
gl.glViewport(gle0X, gle0Y, gle0W, gle0H); // restore viewport test
-
+
if( keepTextureBound ) {
setupTex(gl);
}
- }
+ }
});
Animator animator = new Animator(glc);
animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
- QuitAdapter quitAdapter = new QuitAdapter();
- new com.jogamp.newt.event.awt.AWTKeyAdapter(quitAdapter).addTo(glc);
- new com.jogamp.newt.event.awt.AWTWindowAdapter(quitAdapter).addTo(glc);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new com.jogamp.newt.event.awt.AWTKeyAdapter(quitAdapter, glc).addTo(glc);
+ new com.jogamp.newt.event.awt.AWTWindowAdapter(quitAdapter, glc).addTo(glc);
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -236,13 +235,14 @@ public class TestGLJPanelTextureStateAWT extends UITestCase {
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
+
animator.start();
while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
Thread.sleep(100);
}
-
+
animator.stop();
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
@@ -254,9 +254,9 @@ public class TestGLJPanelTextureStateAWT extends UITestCase {
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
}
-
+
@Test
public void test01_texUnit0_keepTex0_ES2() throws InterruptedException, IOException {
testImpl(false /* keepTextureBound */, 0 /* texUnit */);
@@ -269,7 +269,7 @@ public class TestGLJPanelTextureStateAWT extends UITestCase {
public void test03_texUnit1_keepTex1_ES2() throws InterruptedException, IOException {
testImpl(true /* keepTextureBound */, 1 /* texUnit */);
}
-
+
public static void main(String args[]) throws IOException {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -277,6 +277,6 @@ public class TestGLJPanelTextureStateAWT extends UITestCase {
duration = MiscUtils.atol(args[i], duration);
}
}
- org.junit.runner.JUnitCore.main(TestGLJPanelTextureStateAWT.class.getName());
+ org.junit.runner.JUnitCore.main(TestGLJPanelTextureStateAWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java
index 6cddce62c..b750c54dd 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java
@@ -198,8 +198,8 @@ public class GearsES1 implements GLEventListener {
window.addKeyListener(gearsKeys);
} else if (GLProfile.isAWTAvailable() && upstreamWidget instanceof java.awt.Component) {
final java.awt.Component comp = (java.awt.Component) upstreamWidget;
- new com.jogamp.newt.event.awt.AWTMouseAdapter(gearsMouse).addTo(comp);
- new com.jogamp.newt.event.awt.AWTKeyAdapter(gearsKeys).addTo(comp);
+ new com.jogamp.newt.event.awt.AWTMouseAdapter(gearsMouse, drawable).addTo(comp);
+ new com.jogamp.newt.event.awt.AWTKeyAdapter(gearsKeys, drawable).addTo(comp);
}
System.err.println(Thread.currentThread()+" GearsES1.init FIN");
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
index b2b1dd642..c179aad66 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
@@ -302,8 +302,8 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
window.addGestureHandler(pinchToZoomGesture);
} else if (GLProfile.isAWTAvailable() && upstreamWidget instanceof java.awt.Component) {
final java.awt.Component comp = (java.awt.Component) upstreamWidget;
- new com.jogamp.newt.event.awt.AWTMouseAdapter(gearsMouse).addTo(comp);
- new com.jogamp.newt.event.awt.AWTKeyAdapter(gearsKeys).addTo(comp);
+ new com.jogamp.newt.event.awt.AWTMouseAdapter(gearsMouse, drawable).addTo(comp);
+ new com.jogamp.newt.event.awt.AWTKeyAdapter(gearsKeys, drawable).addTo(comp);
}
st.useProgram(gl, false);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
index db0e11734..b86dbb603 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
@@ -296,7 +296,7 @@ public class TextureSequenceCubeES2 implements GLEventListener {
window.addMouseListener(mouseAction);
} else if (GLProfile.isAWTAvailable() && upstreamWidget instanceof java.awt.Component) {
final java.awt.Component comp = (java.awt.Component) upstreamWidget;
- new com.jogamp.newt.event.awt.AWTMouseAdapter(mouseAction).addTo(comp);
+ new com.jogamp.newt.event.awt.AWTMouseAdapter(mouseAction, drawable).addTo(comp);
}
// Let's show the completed shader state ..
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
index d9839c057..622f51e45 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
@@ -238,10 +238,9 @@ public class TestGearsES2AWT extends UITestCase {
if( useAnimator && exclusiveContext ) {
animator.setExclusiveContext(awtEDT);
}
- QuitAdapter quitAdapter = new QuitAdapter();
-
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glCanvas);
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glCanvas).addTo(glCanvas);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas).addTo(frame);
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
index 29750973a..8172eb335 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
@@ -168,10 +168,9 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
Assert.assertEquals(true, animator.isAnimating());
}
- QuitAdapter quitAdapter = new QuitAdapter();
-
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel);
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glJPanel).addTo(glJPanel);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glJPanel).addTo(frame);
snap.setMakeSnapshot();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
index 9c5d1e249..8eb84e152 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
@@ -109,8 +109,8 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
window.addKeyListener(gearsKeys);
} else if (GLProfile.isAWTAvailable() && upstreamWidget instanceof java.awt.Component) {
final java.awt.Component comp = (java.awt.Component) upstreamWidget;
- new AWTMouseAdapter(gearsMouse).addTo(comp);
- new AWTKeyAdapter(gearsKeys).addTo(comp);
+ new AWTMouseAdapter(gearsMouse, drawable).addTo(comp);
+ new AWTKeyAdapter(gearsKeys, drawable).addTo(comp);
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java
index 24a6d578c..1b83904a9 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,23 +20,24 @@
* 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.opengl.test.junit.jogl.demos.gl2.awt;
import javax.media.opengl.*;
import com.jogamp.opengl.util.Animator;
+
import javax.media.opengl.awt.GLCanvas;
+
import com.jogamp.newt.event.awt.AWTKeyAdapter;
import com.jogamp.newt.event.awt.AWTWindowAdapter;
import com.jogamp.newt.event.TraceKeyAdapter;
import com.jogamp.newt.event.TraceWindowAdapter;
-
import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
@@ -94,18 +95,18 @@ public class TestGearsAWT extends UITestCase {
glCanvas.addGLEventListener(new Gears(1));
- Animator animator = new Animator(glCanvas);
- QuitAdapter quitAdapter = new QuitAdapter();
-
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glCanvas);
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glCanvas).addTo(glCanvas);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas).addTo(frame);
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.pack();
frame.setVisible(true);
}});
- animator.setUpdateFPSFrames(60, System.err);
+
+ final Animator animator = new Animator(glCanvas);
+ animator.setUpdateFPSFrames(60, System.err);
animator.start();
while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
@@ -156,7 +157,7 @@ public class TestGearsAWT extends UITestCase {
} catch (Exception ex) { ex.printStackTrace(); }
} else if(args[i].equals("-wait")) {
waitForKey = true;
- }
+ }
}
if(waitForKey) {
BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java
index 55a4b8450..2c3b3d472 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,26 +20,28 @@
* 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.opengl.test.junit.jogl.demos.gl2.awt;
import javax.media.opengl.*;
import com.jogamp.opengl.util.Animator;
+
import javax.media.opengl.awt.GLCanvas;
+
import com.jogamp.newt.event.awt.AWTKeyAdapter;
import com.jogamp.newt.event.awt.AWTWindowAdapter;
import com.jogamp.newt.event.TraceKeyAdapter;
import com.jogamp.newt.event.TraceWindowAdapter;
-
import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
+
import java.awt.Frame;
import java.io.BufferedReader;
import java.io.IOException;
@@ -94,11 +96,11 @@ public class TestGearsAWTAnalyzeBug455 extends UITestCase {
gl.glCopyPixels(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), GL2.GL_COLOR);
// gl.glPopAttrib();
gl.glDrawBuffer(GL.GL_BACK); // def. in dbl buff mode: GL_BACK
- }
+ }
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width,
int height) {
- }
+ }
}
protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException {
final Frame frame = new Frame("Gears AWT Test");
@@ -112,18 +114,18 @@ public class TestGearsAWTAnalyzeBug455 extends UITestCase {
glCanvas.addGLEventListener(new Gears(0));
glCanvas.addGLEventListener(new Swapper());
- Animator animator = new Animator(glCanvas);
- QuitAdapter quitAdapter = new QuitAdapter();
-
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glCanvas);
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glCanvas).addTo(glCanvas);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas).addTo(frame);
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setSize(512, 512);
frame.setVisible(true);
}});
- animator.setUpdateFPSFrames(60, System.err);
+
+ final Animator animator = new Animator(glCanvas);
+ animator.setUpdateFPSFrames(60, System.err);
animator.start();
while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java
index 5de08c738..d6cc712ee 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsGLJPanelAWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.opengl.test.junit.jogl.demos.gl2.awt;
import javax.media.opengl.*;
@@ -35,6 +35,7 @@ import com.jogamp.newt.event.TraceWindowAdapter;
import com.jogamp.newt.event.awt.AWTKeyAdapter;
import com.jogamp.newt.event.awt.AWTWindowAdapter;
import com.jogamp.opengl.util.FPSAnimator;
+
import javax.media.opengl.awt.GLJPanel;
import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
@@ -46,6 +47,7 @@ import java.awt.AWTException;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.lang.reflect.InvocationTargetException;
+
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
@@ -115,11 +117,10 @@ public class TestGearsGLJPanelAWT extends UITestCase {
Assert.assertEquals(true, animator.isAnimating());
}
- QuitAdapter quitAdapter = new QuitAdapter();
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glJPanel).addTo(glJPanel);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glJPanel).addTo(frame);
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel);
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
-
final long t0 = System.currentTimeMillis();
long t1 = t0;
boolean triggerSnap = false;
@@ -182,7 +183,7 @@ public class TestGearsGLJPanelAWT extends UITestCase {
caps.setSampleBuffers(true);
runTestGL(caps);
}
-
+
@Test
public void test03_PbufferNorm()
throws AWTException, InterruptedException, InvocationTargetException
@@ -194,7 +195,7 @@ public class TestGearsGLJPanelAWT extends UITestCase {
caps.setPBuffer(true);
runTestGL(caps);
}
-
+
@Test
public void test04_PbufferMsaa()
throws AWTException, InterruptedException, InvocationTargetException
@@ -208,7 +209,7 @@ public class TestGearsGLJPanelAWT extends UITestCase {
caps.setPBuffer(true);
runTestGL(caps);
}
-
+
@Test
public void test05_BitmapNorm()
throws AWTException, InterruptedException, InvocationTargetException
@@ -220,7 +221,7 @@ public class TestGearsGLJPanelAWT extends UITestCase {
caps.setBitmap(true);
runTestGL(caps);
}
-
+
@Test
public void test06_BitmapMsaa()
throws AWTException, InterruptedException, InvocationTargetException
@@ -234,7 +235,7 @@ public class TestGearsGLJPanelAWT extends UITestCase {
caps.setBitmap(true);
runTestGL(caps);
}
-
+
static long duration = 500; // ms
public static void main(String args[]) {
@@ -263,7 +264,7 @@ public class TestGearsGLJPanelAWT extends UITestCase {
System.err.println("shallUsePBuffer "+shallUsePBuffer);
System.err.println("shallUseBitmap "+shallUseBitmap);
System.err.println("manualTest "+manualTest);
-
+
org.junit.runner.JUnitCore.main(TestGearsGLJPanelAWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java
index 4d770e618..74ef0713a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,7 +20,7 @@
* 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.
@@ -60,21 +60,21 @@ import org.junit.Test;
import org.junit.runners.MethodSorters;
/**
- * Demos an onscreen AWT {@link GLCanvas} being used for
+ * Demos an onscreen AWT {@link GLCanvas} being used for
* {@link RandomTileRenderer} rendering to produce a PNG file.
* <p>
* {@link RandomTileRenderer} is being kicked off from the main thread.
* </p>
* <p>
* {@link RandomTileRenderer} setup and finishing is performed
- * within the pre- and post {@link GLEventListener}
+ * within the pre- and post {@link GLEventListener}
* set via {@link TileRendererBase#setGLEventListener(GLEventListener, GLEventListener)}
- * on the animation thread.
+ * on the animation thread.
* </p>
* <p>
* At tile rendering finish, the viewport and
* and the original {@link GLEventListener}'s PMV matrix as well.
- * The latter is done by calling it's {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} method.
+ * The latter is done by calling it's {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape} method.
* </p>
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -82,7 +82,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
static long duration = 3500; // ms
static int width = 512;
static int height = 512;
-
+
@Test
public void test01_aa0() throws IOException, InterruptedException, InvocationTargetException {
doTest(0);
@@ -92,7 +92,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
doTest(8);
}
- void doTest(int msaaCount) throws IOException, InterruptedException, InvocationTargetException {
+ void doTest(int msaaCount) throws IOException, InterruptedException, InvocationTargetException {
final GLCapabilities caps = new GLCapabilities(null);
if( msaaCount > 0 ) {
caps.setSampleBuffers(true);
@@ -113,11 +113,9 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
final Gears gears = new Gears();
glad.addGLEventListener( gears );
- final Animator animator = new Animator(glad);
final QuitAdapter quitAdapter = new QuitAdapter();
-
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glad);
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glad).addTo(glad);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glad).addTo(frame);
// Fix the image size for now
final int maxTileSize = 64;
@@ -134,7 +132,7 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
final GLEventListener preTileGLEL = new GLEventListener() {
final int w = maxTileSize, h = maxTileSize;
int dx = 0, dy = 0;
-
+
@Override
public void init(GLAutoDrawable drawable) {
final GL gl = drawable.getGL();
@@ -183,15 +181,15 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
caps.getGLProfile(),
0 /* internalFormat */,
imageWidth, imageHeight,
- 0,
+ 0,
imageBuffer.pixelAttributes,
- false, false,
+ false, false,
flipVertically[0],
imageBuffer.buffer,
null /* Flusher */);
try {
final String filename = getSnapshotFilename(0, "-tile", glad.getChosenGLCapabilities(), imageWidth, imageHeight, false, TextureIO.PNG, null);
- final File file = new File(filename);
+ final File file = new File(filename);
TextureIO.write(textureData, file);
} catch (IOException e) {
e.printStackTrace();
@@ -206,19 +204,21 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {}
};
renderer.setGLEventListener(preTileGLEL, postTileGLEL);
-
+
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.pack();
frame.setVisible(true);
}});
- animator.setUpdateFPSFrames(60, System.err);
+
+ final Animator animator = new Animator(glad);
+ animator.setUpdateFPSFrames(60, System.err);
animator.start();
boolean signalTileRenderer = true;
-
- while(!quitAdapter.shouldQuit() && animator.isAnimating() &&
- ( rendererActive[0] || animator.getTotalFPSDuration()<duration ) )
+
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() &&
+ ( rendererActive[0] || animator.getTotalFPSDuration()<duration ) )
{
if( signalTileRenderer && animator.getTotalFPSDuration() > 90 ) {
signalTileRenderer = false;
@@ -244,9 +244,9 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
public void run() {
frame.remove(glad);
frame.dispose();
- }});
+ }});
}
-
+
public static void main(String args[]) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -257,5 +257,5 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase {
}
}
org.junit.runner.JUnitCore.main(TestRandomTiledRendering3GL2AWT.class.getName());
- }
+ }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java
index 30e0ba4e6..dd8a306cc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.opengl.test.junit.jogl.tile;
import java.awt.BorderLayout;
@@ -72,7 +72,7 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
static boolean allow600dpi = false;
static GLProfile glp;
static int width, height;
-
+
@BeforeClass
public static void initClass() {
if(GLProfile.isAvailable(GLProfile.GL2)) {
@@ -90,30 +90,30 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
@AfterClass
public static void releaseClass() {
}
-
+
protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException {
final Dimension glc_sz = new Dimension(width/2, height);
final GLCanvas glCanvas1 = new GLCanvas(caps);
- Assert.assertNotNull(glCanvas1);
+ Assert.assertNotNull(glCanvas1);
glCanvas1.setMinimumSize(glc_sz);
glCanvas1.setPreferredSize(glc_sz);
glCanvas1.setSize(glc_sz);
glCanvas1.addGLEventListener(new Gears());
-
+
final GLCanvas glCanvas2 = new GLCanvas(caps);
- Assert.assertNotNull(glCanvas2);
+ Assert.assertNotNull(glCanvas2);
glCanvas2.setMinimumSize(glc_sz);
glCanvas2.setPreferredSize(glc_sz);
glCanvas2.setSize(glc_sz);
glCanvas2.addGLEventListener(new RedSquareES2());
-
+
final Panel demoPanel = new Panel();
demoPanel.add(glCanvas1);
demoPanel.add(glCanvas2);
-
+
final Frame frame = new Frame("AWT Print");
Assert.assertNotNull(frame);
-
+
final ActionListener print72DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
doPrintManual(frame, 72, 0, -1, -1);
@@ -132,7 +132,7 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
print300DPIButton.addActionListener(print300DPIAction);
final Button print600DPIButton = new Button("600dpi");
print600DPIButton.addActionListener(print600DPIAction);
-
+
frame.setLayout(new BorderLayout());
Panel printPanel = new Panel();
printPanel.add(print72DPIButton);
@@ -150,15 +150,15 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
frame.add(eastPanel, BorderLayout.EAST);
frame.add(westPanel, BorderLayout.WEST);
frame.setTitle("Tiles AWT Print Test");
-
+
Animator animator = new Animator();
animator.add(glCanvas1);
animator.add(glCanvas2);
- QuitAdapter quitAdapter = new QuitAdapter();
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glCanvas1);
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glCanvas2);
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glCanvas1).addTo(glCanvas1);
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glCanvas2).addTo(glCanvas2);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glCanvas2).addTo(frame);
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -168,15 +168,15 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas2, true));
-
- animator.setUpdateFPSFrames(60, System.err);
+
+ animator.setUpdateFPSFrames(60, System.err);
animator.start();
boolean printDone = false;
while(!quitAdapter.shouldQuit() && animator.isAnimating() && ( 0 == duration || animator.getTotalFPSDuration()<duration )) {
Thread.sleep(200);
if( !printDone ) {
- printDone = true;
+ printDone = true;
{
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 72, 0, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
@@ -186,27 +186,27 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
waitUntilPrintJobsIdle(p);
}
{
- // No AA needed for 150 dpi and greater :)
+ // No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
- // No AA needed for 150 dpi and greater :)
+ // No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, 2048, 2048, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
- // No AA needed for 150 dpi and greater :)
+ // No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
- // No AA needed for 150 dpi and greater :)
+ // No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
- // No AA needed for 150 dpi and greater :)
+ // No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, true/* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
@@ -217,7 +217,7 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
}
}
}
-
+
Assert.assertNotNull(frame);
Assert.assertNotNull(glCanvas1);
Assert.assertNotNull(glCanvas2);
@@ -243,7 +243,7 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
GLCapabilities caps = new GLCapabilities(glp);
runTestGL(caps);
}
-
+
@Test
public void test02_aa8() throws InterruptedException, InvocationTargetException {
GLCapabilities caps = new GLCapabilities(glp);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java
index ec1d7b1d6..d3abcd01a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.opengl.test.junit.jogl.tile;
import java.awt.BorderLayout;
@@ -73,7 +73,7 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
static boolean allow600dpi = false;
static GLProfile glp;
static int width, height;
-
+
@BeforeClass
public static void initClass() {
if(GLProfile.isAvailable(GLProfile.GL2)) {
@@ -91,34 +91,34 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
@AfterClass
public static void releaseClass() {
}
-
+
protected void runTestGL(GLCapabilities caps) throws InterruptedException, InvocationTargetException {
final Dimension glc_sz = new Dimension(width/2, height);
final GLWindow glad1 = GLWindow.create(caps);
- Assert.assertNotNull(glad1);
+ Assert.assertNotNull(glad1);
final NewtCanvasAWT canvas1 = new NewtCanvasAWT(glad1);
Assert.assertNotNull(canvas1);
canvas1.setMinimumSize(glc_sz);
canvas1.setPreferredSize(glc_sz);
canvas1.setSize(glc_sz);
glad1.addGLEventListener(new Gears());
-
+
final GLWindow glad2 = GLWindow.create(caps);
- Assert.assertNotNull(glad2);
+ Assert.assertNotNull(glad2);
final NewtCanvasAWT canvas2 = new NewtCanvasAWT(glad2);
Assert.assertNotNull(canvas2);
canvas2.setMinimumSize(glc_sz);
canvas2.setPreferredSize(glc_sz);
canvas2.setSize(glc_sz);
glad2.addGLEventListener(new RedSquareES2());
-
+
final Panel demoPanel = new Panel();
demoPanel.add(canvas1);
demoPanel.add(canvas2);
-
+
final Frame frame = new Frame("Newt/AWT Print");
Assert.assertNotNull(frame);
-
+
final ActionListener print72DPIAction = new ActionListener() {
public void actionPerformed(ActionEvent e) {
doPrintManual(frame, 72, 0, -1, -1);
@@ -137,7 +137,7 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
print300DPIButton.addActionListener(print300DPIAction);
final Button print600DPIButton = new Button("600dpi");
print600DPIButton.addActionListener(print600DPIAction);
-
+
frame.setLayout(new BorderLayout());
Panel printPanel = new Panel();
printPanel.add(print72DPIButton);
@@ -155,15 +155,15 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
frame.add(eastPanel, BorderLayout.EAST);
frame.add(westPanel, BorderLayout.WEST);
frame.setTitle("Tiles Newt/AWT Print Test");
-
+
Animator animator = new Animator();
animator.add(glad1);
animator.add(glad2);
- QuitAdapter quitAdapter = new QuitAdapter();
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(canvas1);
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(canvas2);
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), canvas1.getNEWTChild()).addTo(canvas1);
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), canvas2.getNEWTChild()).addTo(canvas2);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), canvas2.getNEWTChild()).addTo(frame);
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -173,8 +173,8 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas1, true));
Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas2, true));
-
- animator.setUpdateFPSFrames(60, System.err);
+
+ animator.setUpdateFPSFrames(60, System.err);
animator.start();
boolean printDone = false;
@@ -191,27 +191,27 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
waitUntilPrintJobsIdle(p);
}
{
- // No AA needed for 150 dpi and greater :)
+ // No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
- // No AA needed for 150 dpi and greater :)
+ // No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, 2048, 2048, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
- // No AA needed for 150 dpi and greater :)
+ // No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, -1 /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
- // No AA needed for 150 dpi and greater :)
+ // No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, false /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
{
- // No AA needed for 150 dpi and greater :)
+ // No AA needed for 150 dpi and greater :)
final PrintableBase p = doPrintAuto(frame, PageFormat.LANDSCAPE, null, BufferedImage.TYPE_INT_ARGB_PRE /* offscreen-type */, 150, -1, -1, -1, true /* resizeWithinPrint */);
waitUntilPrintJobsIdle(p);
}
@@ -222,7 +222,7 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
}
}
}
-
+
Assert.assertNotNull(frame);
Assert.assertNotNull(canvas1);
Assert.assertNotNull(canvas2);
@@ -250,7 +250,7 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
GLCapabilities caps = new GLCapabilities(glp);
runTestGL(caps);
}
-
+
@Test
public void test02_aa8() throws InterruptedException, InvocationTargetException {
GLCapabilities caps = new GLCapabilities(glp);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
index 3dd3a83c8..34e1b60e9 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
@@ -192,11 +192,10 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
Animator animator = new Animator();
animator.add(glJPanel1);
animator.add(glJPanel2);
- QuitAdapter quitAdapter = new QuitAdapter();
-
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel1);
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel2);
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glJPanel1).addTo(glJPanel1);
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glJPanel2).addTo(glJPanel2);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glJPanel2).addTo(frame);
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
index 29bf8a6c3..8cf1421ae 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
@@ -179,10 +179,9 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
if( null != animator ) {
animator.add(glJPanel1);
}
- QuitAdapter quitAdapter = new QuitAdapter();
-
- new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glJPanel1);
- new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glJPanel1).addTo(glJPanel1);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glJPanel1).addTo(frame);
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java
index 191d67d31..7ea053a86 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.opengl.test.junit.jogl.util.texture;
@@ -51,7 +51,6 @@ import com.jogamp.opengl.util.GLReadBufferUtil;
import java.awt.Dimension;
import java.awt.Frame;
-
import java.io.IOException;
import java.io.InputStream;
import java.net.URLConnection;
@@ -100,8 +99,8 @@ public class TestPNGTextureFromFileAWT extends UITestCase {
testTextureStream = null;
}
- public void testImpl(boolean useFFP, final InputStream istream, final boolean useAWTIIOP)
- throws InterruptedException, IOException
+ public void testImpl(boolean useFFP, final InputStream istream, final boolean useAWTIIOP)
+ throws InterruptedException, IOException
{
final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false);
GLProfile glp;
@@ -122,7 +121,7 @@ public class TestPNGTextureFromFileAWT extends UITestCase {
texData = TextureIO.newTextureData(glp, istream, false /* mipmap */, TextureIO.PNG);
}
System.err.println("TextureData: "+texData);
-
+
final GLCanvas glc = new GLCanvas(caps);
Dimension glc_sz = new Dimension(texData.getWidth(), texData.getHeight());
glc.setMinimumSize(glc_sz);
@@ -135,11 +134,11 @@ public class TestPNGTextureFromFileAWT extends UITestCase {
// the bug submitter was doing it
final GLEventListener gle = useFFP ? new TextureDraw01GL2Listener( texData ) : new TextureDraw01ES2Listener( texData, 0 ) ;
glc.addGLEventListener(gle);
- glc.addGLEventListener(new GLEventListener() {
+ glc.addGLEventListener(new GLEventListener() {
boolean shot = false;
-
+
@Override public void init(GLAutoDrawable drawable) {}
-
+
@Override
public void display(GLAutoDrawable drawable) {
// 1 snapshot
@@ -153,11 +152,10 @@ public class TestPNGTextureFromFileAWT extends UITestCase {
@Override public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
});
- Animator animator = new Animator(glc);
- animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
- QuitAdapter quitAdapter = new QuitAdapter();
- new com.jogamp.newt.event.awt.AWTKeyAdapter(quitAdapter).addTo(glc);
- new com.jogamp.newt.event.awt.AWTWindowAdapter(quitAdapter).addTo(glc);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new com.jogamp.newt.event.awt.AWTKeyAdapter(quitAdapter, glc).addTo(glc);
+ new com.jogamp.newt.event.awt.AWTWindowAdapter(quitAdapter, glc).addTo(glc);
+
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -167,13 +165,16 @@ public class TestPNGTextureFromFileAWT extends UITestCase {
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
+
+ Animator animator = new Animator(glc);
+ animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
animator.start();
while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
Thread.sleep(100);
}
-
+
animator.stop();
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
@@ -185,45 +186,45 @@ public class TestPNGTextureFromFileAWT extends UITestCase {
} catch( Throwable throwable ) {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
- }
+ }
}
-
+
@Test
public void testGrayAWTILoaderGL2() throws InterruptedException, IOException {
- testImpl(true, grayTextureStream, true);
- }
+ testImpl(true, grayTextureStream, true);
+ }
@Test
public void testGrayAWTILoaderES2() throws InterruptedException, IOException {
- testImpl(false, grayTextureStream, true);
+ testImpl(false, grayTextureStream, true);
}
-
+
@Test
public void testGrayPNGJLoaderGL2() throws InterruptedException, IOException {
- testImpl(true, grayTextureStream, false);
+ testImpl(true, grayTextureStream, false);
}
@Test
public void testGrayPNGJLoaderES2() throws InterruptedException, IOException {
- testImpl(false, grayTextureStream, false);
+ testImpl(false, grayTextureStream, false);
}
-
+
@Test
public void testTestAWTILoaderGL2() throws InterruptedException, IOException {
- testImpl(true, testTextureStream, true);
+ testImpl(true, testTextureStream, true);
}
@Test
public void testTestAWTILoaderES2() throws InterruptedException, IOException {
- testImpl(false, testTextureStream, true);
+ testImpl(false, testTextureStream, true);
}
-
+
@Test
public void testTestPNGJLoaderGL2() throws InterruptedException, IOException {
- testImpl(true, testTextureStream, false);
+ testImpl(true, testTextureStream, false);
}
@Test
public void testTestPNGJLoaderES2() throws InterruptedException, IOException {
- testImpl(false, testTextureStream, false);
+ testImpl(false, testTextureStream, false);
}
-
+
public static void main(String args[]) throws IOException {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
@@ -231,6 +232,6 @@ public class TestPNGTextureFromFileAWT extends UITestCase {
duration = MiscUtils.atol(args[i], duration);
}
}
- org.junit.runner.JUnitCore.main(TestPNGTextureFromFileAWT.class.getName());
+ org.junit.runner.JUnitCore.main(TestPNGTextureFromFileAWT.class.getName());
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java
index 86cf4654e..5549254c4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureSequence01AWT.java
@@ -66,11 +66,11 @@ public class TestTextureSequence01AWT extends UITestCase {
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { }
});
glc.addGLEventListener(new TextureSequenceCubeES2(texSource, false, -2.3f, 0f, 0f));
- final Animator animator = new Animator(glc);
- animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
- QuitAdapter quitAdapter = new QuitAdapter();
- new com.jogamp.newt.event.awt.AWTKeyAdapter(quitAdapter).addTo(glc);
- new com.jogamp.newt.event.awt.AWTWindowAdapter(quitAdapter).addTo(glc);
+
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ new com.jogamp.newt.event.awt.AWTKeyAdapter(quitAdapter, glc).addTo(glc);
+ new com.jogamp.newt.event.awt.AWTWindowAdapter(quitAdapter, glc).addTo(glc);
+
try {
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -81,6 +81,9 @@ public class TestTextureSequence01AWT extends UITestCase {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
}
+
+ final Animator animator = new Animator(glc);
+ animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
animator.start();
while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java
index f1906f560..a459a7f1f 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java
@@ -3,14 +3,14 @@
*
* 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
@@ -20,12 +20,12 @@
* 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.opengl.test.junit.newt.event;
import javax.media.opengl.awt.GLCanvas ;
@@ -61,7 +61,7 @@ public class TestNewtEventModifiersAWTCanvas extends BaseNewtEventModifiers {
final GLCanvas canvas = new GLCanvas() ;
canvas.addGLEventListener( new RedSquareES2() ) ;
- new AWTMouseAdapter( _testMouseListener ).addTo( (java.awt.Component)canvas ) ;
+ new AWTMouseAdapter( _testMouseListener, canvas ).addTo( canvas ) ;
_testFrame = new JFrame( "Event Modifier Test AWTCanvas" ) ;
_testFrame.setDefaultCloseOperation( WindowConstants.EXIT_ON_CLOSE ) ;
@@ -73,10 +73,10 @@ public class TestNewtEventModifiersAWTCanvas extends BaseNewtEventModifiers {
_testFrame.setVisible( true ) ;
}
}) ;
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(_testFrame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(_testFrame, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(canvas, true));
Assert.assertTrue(AWTRobotUtil.waitForRealized(canvas, true));
-
+
AWTRobotUtil.assertRequestFocusAndWait(null, canvas, canvas, null, null); // programmatic
Assert.assertNotNull(_robot);
AWTRobotUtil.requestFocus(_robot, canvas, false); // within unit framework, prev. tests (TestFocus02SwingAWTRobot) 'confuses' Windows keyboard input