aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-05-05 15:46:46 +0200
committerSven Gothel <[email protected]>2010-05-05 15:46:46 +0200
commitb8b7a30dcfbee99c60f9f0abeb95a973cc1dcdd5 (patch)
treeac5c8c2a61cb25b185ba5ddb79272333a78a1e68 /src
parent599bf2dea34e82e32a7b443900a0c24c92b96b80 (diff)
Fix junit test: Move quit WindowListener outside of class
Diffstat (limited to 'src')
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/TestParenting01AWT.java8
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/newt/TestParenting01NEWT.java8
-rw-r--r--src/junit/com/jogamp/test/junit/newt/WindowAction.java49
3 files changed, 53 insertions, 12 deletions
diff --git a/src/junit/com/jogamp/test/junit/newt/TestParenting01AWT.java b/src/junit/com/jogamp/test/junit/newt/TestParenting01AWT.java
index 4c21684d3..c46ec3941 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestParenting01AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestParenting01AWT.java
@@ -129,7 +129,7 @@ public class TestParenting01AWT {
Screen screen = NewtFactory.createScreen(display, 0); // screen 0
Assert.assertNotNull(screen);
- final NEWTEventFiFo eventFifo = new NEWTEventFiFo();
+ NEWTEventFiFo eventFifo = new NEWTEventFiFo();
Window window2 = NewtFactory.createWindow(overlayedAWTComponent, screen, caps);
Assert.assertNotNull(window2);
@@ -144,11 +144,7 @@ public class TestParenting01AWT {
glWindow2.setTitle("NEWT - CHILD");
glWindow2.addKeyListener(new TraceKeyAdapter(new KeyAction(eventFifo)));
- glWindow2.addWindowListener(new TraceWindowAdapter(new WindowAdapter() {
- public void windowDestroyNotify(WindowEvent e) {
- eventFifo.put(e);
- }
- }));
+ glWindow2.addWindowListener(new TraceWindowAdapter(new WindowAction(eventFifo)));
GLEventListener demo2 = new Gears();
setDemoFields(demo2, window2, glWindow2, false);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestParenting01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestParenting01NEWT.java
index 9528009ea..cd85d1c9a 100755
--- a/src/junit/com/jogamp/test/junit/newt/TestParenting01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestParenting01NEWT.java
@@ -122,7 +122,7 @@ public class TestParenting01NEWT {
int x = 1;
int y = 1;
- final NEWTEventFiFo eventFifo = new NEWTEventFiFo();
+ NEWTEventFiFo eventFifo = new NEWTEventFiFo();
Window window1 = createWindow( null, screen, caps, width, height );
Assert.assertNotNull(window1);
@@ -144,11 +144,7 @@ public class TestParenting01NEWT {
glWindow2.setTitle("testWindowParenting01NewtOnNewtParentChildDraw - CHILD");
glWindow2.setPosition(glWindow1.getWidth()/2, glWindow1.getHeight()/2);
glWindow2.addKeyListener(new TraceKeyAdapter(new KeyAction(eventFifo)));
- glWindow2.addWindowListener(new TraceWindowAdapter(new WindowAdapter() {
- public void windowDestroyNotify(WindowEvent e) {
- eventFifo.put(e);
- }
- }));
+ glWindow2.addWindowListener(new TraceWindowAdapter(new WindowAction(eventFifo)));
// glWindow2.addMouseListener(new TraceMouseAdapter());
GLEventListener demo1 = new RedSquare();
diff --git a/src/junit/com/jogamp/test/junit/newt/WindowAction.java b/src/junit/com/jogamp/test/junit/newt/WindowAction.java
new file mode 100644
index 000000000..fa50cb34a
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/newt/WindowAction.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2010 Sven Gothel. 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 of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - 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.
+ *
+ * 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.
+ */
+
+package com.jogamp.test.junit.newt;
+
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.newt.event.*;
+
+class WindowAction extends WindowAdapter {
+ NEWTEventFiFo eventFifo;
+
+ public WindowAction(NEWTEventFiFo eventFifo) {
+ this.eventFifo = eventFifo;
+ }
+
+ public void windowDestroyNotify(WindowEvent e) {
+ eventFifo.put(e);
+ }
+}
+