aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java35
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java35
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.java15
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java39
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java33
5 files changed, 97 insertions, 60 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java
index 776c3c7eb..5ae473e18 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTKeyAdapter.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.util;
import java.awt.event.KeyEvent;
@@ -37,6 +37,7 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent
String prefix;
int keyPressed, keyReleased;
+ int consumed;
boolean pressed;
List<EventObject> queue = new ArrayList<EventObject>();
boolean verbose = true;
@@ -51,30 +52,35 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent
public synchronized boolean isPressed() {
return pressed;
}
-
+
public synchronized int getCount() {
return keyReleased;
}
+ public synchronized int getConsumedCount() {
+ return consumed;
+ }
+
public synchronized int getKeyPressedCount(boolean autoRepeatOnly) {
- return keyPressed;
+ return keyPressed;
}
-
+
public synchronized int getKeyReleasedCount(boolean autoRepeatOnly) {
- return keyReleased;
+ return keyReleased;
}
-
+
public synchronized List<EventObject> getQueued() {
return queue;
}
-
+
public synchronized int getQueueSize() {
return queue.size();
}
-
+
public synchronized void reset() {
keyPressed = 0;
keyReleased = 0;
+ consumed = 0;
pressed = false;
queue.clear();
}
@@ -91,12 +97,15 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements KeyEvent
public synchronized void keyReleased(KeyEvent e) {
pressed = false;
keyReleased++;
+ if(e.isConsumed()) {
+ consumed++;
+ }
queue.add(e);
if( verbose ) {
System.err.println("KEY AWT RELEASED ["+pressed+"]: "+prefix+", "+e);
}
}
- public String toString() { return prefix+"[pressed "+pressed+", keyReleased "+keyReleased+"]"; }
+ public String toString() { return prefix+"[pressed "+pressed+", keyReleased "+keyReleased+", consumed "+consumed+"]"; }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java
index 31362bfa1..f6cbd0a04 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTMouseAdapter.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.util;
import java.awt.event.MouseEvent;
@@ -36,6 +36,7 @@ import java.util.List;
public class AWTMouseAdapter extends java.awt.event.MouseAdapter implements InputEventCountAdapter {
String prefix;
int mouseClicked;
+ int consumed;
boolean pressed;
List<EventObject> queue = new ArrayList<EventObject>();
boolean verbose = true;
@@ -46,25 +47,30 @@ public class AWTMouseAdapter extends java.awt.event.MouseAdapter implements Inpu
}
public synchronized void setVerbose(boolean v) { verbose = false; }
-
+
public synchronized boolean isPressed() {
return pressed;
}
-
+
public synchronized int getCount() {
return mouseClicked;
}
-
+
+ public synchronized int getConsumedCount() {
+ return consumed;
+ }
+
public synchronized List<EventObject> getQueued() {
return queue;
}
-
+
public synchronized int getQueueSize() {
return queue.size();
}
public synchronized void reset() {
mouseClicked = 0;
+ consumed = 0;
pressed = false;
queue.clear();
}
@@ -84,15 +90,18 @@ public class AWTMouseAdapter extends java.awt.event.MouseAdapter implements Inpu
System.err.println("MOUSE AWT RELEASED ["+pressed+"]: "+prefix+", "+e);
}
}
-
+
public synchronized void mouseClicked(java.awt.event.MouseEvent e) {
mouseClicked+=e.getClickCount();
+ if(e.isConsumed()) {
+ consumed++;
+ }
queue.add(e);
if( verbose ) {
System.err.println("MOUSE AWT CLICKED ["+mouseClicked+"]: "+prefix+", "+e);
}
- }
-
- public String toString() { return prefix+"[pressed "+pressed+", clicked "+mouseClicked+"]"; }
+ }
+
+ public String toString() { return prefix+"[pressed "+pressed+", clicked "+mouseClicked+", consumed "+consumed+"]"; }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.java
index c4078436f..1804b9cb6 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/InputEventCountAdapter.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,22 +20,23 @@
* 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.util;
import java.util.EventObject;
import java.util.List;
public interface InputEventCountAdapter extends EventCountAdapter {
+ int getConsumedCount();
int getCount();
boolean isPressed();
-
- public List<EventObject> getQueued();
+
+ public List<EventObject> getQueued();
public int getQueueSize();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java
index d143b3ca1..5242da637 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTKeyAdapter.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.util;
import java.util.ArrayList;
@@ -41,6 +41,7 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
String prefix;
int keyPressed, keyReleased;
int keyPressedAR, keyReleasedAR;
+ int consumed;
boolean pressed;
List<EventObject> queue = new ArrayList<EventObject>();
boolean verbose = true;
@@ -49,29 +50,33 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
this.prefix = prefix;
reset();
}
-
+
public synchronized void setVerbose(boolean v) { verbose = false; }
public synchronized boolean isPressed() {
return pressed;
}
-
+
public synchronized int getCount() {
return keyReleased;
}
+ public synchronized int getConsumedCount() {
+ return consumed;
+ }
+
public synchronized int getKeyPressedCount(boolean autoRepeatOnly) {
- return autoRepeatOnly ? keyPressedAR: keyPressed;
+ return autoRepeatOnly ? keyPressedAR: keyPressed;
}
-
+
public synchronized int getKeyReleasedCount(boolean autoRepeatOnly) {
- return autoRepeatOnly ? keyReleasedAR: keyReleased;
+ return autoRepeatOnly ? keyReleasedAR: keyReleased;
}
-
+
public synchronized List<EventObject> getQueued() {
return queue;
}
-
+
public synchronized int getQueueSize() {
return queue.size();
}
@@ -79,6 +84,7 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
public synchronized void reset() {
keyPressed = 0;
keyReleased = 0;
+ consumed = 0;
keyPressedAR = 0;
keyReleasedAR = 0;
pressed = false;
@@ -96,10 +102,13 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
System.err.println("KEY NEWT PRESSED ["+pressed+"]: "+prefix+", "+e);
}
}
-
+
public synchronized void keyReleased(KeyEvent e) {
pressed = false;
keyReleased++;
+ if(e.isConsumed()) {
+ consumed++;
+ }
if( 0 != ( e.getModifiers() & InputEvent.AUTOREPEAT_MASK ) ) {
keyReleasedAR++;
}
@@ -108,7 +117,7 @@ public class NEWTKeyAdapter extends KeyAdapter implements KeyEventCountAdapter {
System.err.println("KEY NEWT RELEASED ["+pressed+"]: "+prefix+", "+e);
}
}
-
- public String toString() { return prefix+"[pressed "+pressed+", keyReleased "+keyReleased+"]"; }
+
+ public String toString() { return prefix+"[pressed "+pressed+", keyReleased "+keyReleased+", consumed "+consumed+"]"; }
}
diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java
index 644523782..6850fcf47 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTMouseAdapter.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.util;
import java.util.ArrayList;
@@ -39,6 +39,7 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda
String prefix;
int mouseClicked;
+ int consumed;
boolean pressed;
List<EventObject> queue = new ArrayList<EventObject>();
boolean verbose = true;
@@ -49,25 +50,30 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda
}
public synchronized void setVerbose(boolean v) { verbose = false; }
-
+
public synchronized boolean isPressed() {
return pressed;
}
-
+
public synchronized int getCount() {
return mouseClicked;
}
+ public synchronized int getConsumedCount() {
+ return consumed;
+ }
+
public synchronized List<EventObject> getQueued() {
return queue;
}
-
+
public synchronized int getQueueSize() {
return queue.size();
}
public synchronized void reset() {
mouseClicked = 0;
+ consumed = 0;
pressed = false;
queue.clear();
}
@@ -79,7 +85,7 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda
System.err.println("MOUSE NEWT PRESSED ["+pressed+"]: "+prefix+", "+e);
}
}
-
+
public synchronized void mouseReleased(MouseEvent e) {
pressed = false;
queue.add(e);
@@ -87,15 +93,18 @@ public class NEWTMouseAdapter extends MouseAdapter implements InputEventCountAda
System.err.println("MOUSE NEWT RELEASED ["+pressed+"]: "+prefix+", "+e);
}
}
-
+
public synchronized void mouseClicked(MouseEvent e) {
mouseClicked+=e.getClickCount();
+ if(e.isConsumed()) {
+ consumed++;
+ }
queue.add(e);
if( verbose ) {
System.err.println("MOUSE NEWT CLICKED ["+mouseClicked+"]: "+prefix+", "+e);
}
}
-
- public String toString() { return prefix+"[pressed "+pressed+", clicked "+mouseClicked+"]"; }
+
+ public String toString() { return prefix+"[pressed "+pressed+", clicked "+mouseClicked+", consumed "+consumed+"]"; }
}