aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit
diff options
context:
space:
mode:
Diffstat (limited to 'src/junit')
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/Gears.java1
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitAdapter.java (renamed from src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitKeyAdapter.java)11
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java10
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java8
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java16
5 files changed, 33 insertions, 13 deletions
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 956f4f1e3..a5bf3fda7 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
@@ -65,6 +65,7 @@ public class Gears implements GLEventListener {
gl.glEnable(GL2.GL_NORMALIZE);
MouseListener gearsMouse = new TraceMouseAdapter(new GearsMouseAdapter());
+ // MouseListener gearsMouse = new GearsMouseAdapter();
if (drawable instanceof Component) {
Component comp = (Component) drawable;
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitKeyAdapter.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitAdapter.java
index 443fd74b1..8581bc9f8 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitKeyAdapter.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/QuitAdapter.java
@@ -36,16 +36,23 @@ package com.jogamp.test.junit.jogl.demos.gl2.gears;
import com.jogamp.opengl.util.Animator;
import com.jogamp.newt.event.*;
-class QuitKeyAdapter extends KeyAdapter {
+class QuitAdapter extends WindowAdapter implements WindowListener, KeyListener {
boolean shouldQuit = false;
public boolean shouldQuit() { return shouldQuit; }
+ public void windowDestroyNotify(WindowEvent e) {
+ System.out.println("QUIT Window "+Thread.currentThread());
+ shouldQuit = true;
+ }
+
public void keyTyped(KeyEvent e) {
if(e.getKeyChar()=='q') {
- System.out.println("QUIT "+Thread.currentThread());
+ System.out.println("QUIT Key "+Thread.currentThread());
shouldQuit = true;
}
}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {}
}
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 dc0923ee8..21487c519 100755
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsAWT.java
@@ -36,7 +36,9 @@ 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.test.junit.jogl.demos.gl2.gears.Gears;
import java.awt.Frame;
@@ -76,15 +78,15 @@ public class TestGearsAWT {
glCanvas.addGLEventListener(new Gears());
Animator animator = new Animator(glCanvas);
- QuitKeyAdapter quitKeyAdapter = new QuitKeyAdapter();
+ QuitAdapter quitAdapter = new QuitAdapter();
- new AWTKeyAdapter(new TraceKeyAdapter()).addTo(glCanvas);
- new AWTKeyAdapter(quitKeyAdapter).addTo(glCanvas);
+ new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter)).addTo(glCanvas);
+ new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame);
frame.setVisible(true);
animator.start();
- while(!quitKeyAdapter.shouldQuit() && animator.isAnimating() && animator.getDuration()<duration) {
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getDuration()<duration) {
Thread.sleep(100);
}
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 835d19185..23c39290c 100755
--- 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
@@ -71,16 +71,16 @@ public class TestGearsNEWT {
glWindow.addGLEventListener(new Gears());
Animator animator = new Animator(glWindow);
- QuitKeyAdapter quitKeyAdapter = new QuitKeyAdapter();
+ QuitAdapter quitAdapter = new QuitAdapter();
- glWindow.addKeyListener(new TraceKeyAdapter());
- glWindow.addKeyListener(quitKeyAdapter);
+ glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
+ glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
glWindow.setSize(width, height);
glWindow.setVisible(true);
animator.start();
- while(!quitKeyAdapter.shouldQuit() && animator.isAnimating() && animator.getDuration()<duration) {
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getDuration()<duration) {
Thread.sleep(100);
}
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 4bbbaa271..45c782d38 100755
--- a/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/texture/TestTexture01AWT.java
@@ -48,6 +48,7 @@ import java.awt.GradientPaint;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -75,9 +76,20 @@ public class TestTexture01AWT {
g.drawImage(baseImage, 0, 0, null);
g.dispose();
+ baseImage.flush();
+ baseImage=null;
+
frame = new Frame("Texture Test");
}
+ @After
+ public void cleanup() {
+ textureImage.flush();
+ textureImage=null;
+ frame.dispose();
+ frame=null;
+ }
+
@Test
public void test1() throws InterruptedException {
GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2GL3));
@@ -97,10 +109,8 @@ public class TestTexture01AWT {
animator.stop();
frame.setVisible(false);
-
frame.remove(glCanvas);
- frame.dispose();
- frame=null;
+ glCanvas=null;
}
public static void main(String args[]) {