aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/junit/com/jogamp')
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java4
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java35
-rw-r--r--src/junit/com/jogamp/test/junit/util/AWTKeyAdapter.java2
-rw-r--r--src/junit/com/jogamp/test/junit/util/AWTMouseAdapter.java48
-rw-r--r--src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java163
-rw-r--r--src/junit/com/jogamp/test/junit/util/NEWTMouseAdapter.java52
6 files changed, 253 insertions, 51 deletions
diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
index 77514f83c..514749459 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java
@@ -152,7 +152,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
Assert.assertEquals(0, glWindow1FA.getCount());
Assert.assertEquals(0, newtCanvasAWTFA.getCount());
System.err.println("FOCUS AWT Button sync");
- Assert.assertTrue(AWTRobotUtil.testKeyInput(robot, buttonKA));
+ Assert.assertEquals(2, AWTRobotUtil.testKeyType(robot, 2, button, buttonKA));
// Request the AWT focus, which should automatically provide the NEWT window with focus.
Thread.sleep(100); // allow event sync
@@ -161,7 +161,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase {
Assert.assertEquals(0, newtCanvasAWTFA.getCount());
Assert.assertEquals(0, buttonFA.getCount());
System.err.println("FOCUS NEWT Canvas/GLWindow sync");
- Assert.assertTrue(AWTRobotUtil.testKeyInput(robot, glWindow1KA));
+ Assert.assertEquals(2, AWTRobotUtil.testKeyType(robot, 2, glWindow1, glWindow1KA));
Assert.assertEquals("AWT parent canvas received keyboard events", 0, newtCanvasAWTKA.getCount());
// Remove listeners to avoid logging during dispose/destroy.
diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
index 26f2163f6..145b32a5f 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java
@@ -111,18 +111,24 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
glWindow1.addWindowListener(glWindow1FA);
NEWTKeyAdapter glWindow1KA = new NEWTKeyAdapter("GLWindow1");
glWindow1.addKeyListener(glWindow1KA);
+ NEWTMouseAdapter glWindow1MA = new NEWTMouseAdapter("GLWindow1");
+ glWindow1.addMouseListener(glWindow1MA);
NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
AWTFocusAdapter newtCanvasAWTFA = new AWTFocusAdapter("NewtCanvasAWT");
newtCanvasAWT.addFocusListener(newtCanvasAWTFA);
AWTKeyAdapter newtCanvasAWTKA = new AWTKeyAdapter("NewtCanvasAWT");
newtCanvasAWT.addKeyListener(newtCanvasAWTKA);
+ AWTMouseAdapter newtCanvasAWTMA = new AWTMouseAdapter("NewtCanvasAWT");
+ newtCanvasAWT.addMouseListener(newtCanvasAWTMA);
Button buttonNorthInner = new Button("north");
AWTFocusAdapter buttonNorthInnerFA = new AWTFocusAdapter("ButtonNorthInner");
buttonNorthInner.addFocusListener(buttonNorthInnerFA);
AWTKeyAdapter buttonNorthInnerKA = new AWTKeyAdapter("ButtonNorthInner");
buttonNorthInner.addKeyListener(buttonNorthInnerKA);
+ AWTMouseAdapter buttonNorthInnerMA = new AWTMouseAdapter("ButtonNorthInner");
+ buttonNorthInner.addMouseListener(buttonNorthInnerMA);
Container container1 = new Container();
container1.setLayout(new BorderLayout());
container1.add(buttonNorthInner, BorderLayout.NORTH);
@@ -136,6 +142,8 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
buttonNorthOuter.addFocusListener(buttonNorthOuterFA);
AWTKeyAdapter buttonNorthOuterKA = new AWTKeyAdapter("ButtonNorthOuter");
buttonNorthOuter.addKeyListener(buttonNorthOuterKA);
+ AWTMouseAdapter buttonNorthOuterMA = new AWTMouseAdapter("ButtonNorthOuter");
+ buttonNorthOuter.addMouseListener(buttonNorthOuterMA);
JPanel jPanel1 = new JPanel();
jPanel1.setLayout(new BorderLayout());
jPanel1.add(buttonNorthOuter, BorderLayout.NORTH);
@@ -172,7 +180,11 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
Assert.assertEquals(0, buttonNorthInnerFA.getCount());
Assert.assertEquals(0, jFrame1FA.getCount());
System.err.println("FOCUS AWT Button Outer sync");
- Assert.assertTrue(AWTRobotUtil.testKeyInput(robot, buttonNorthOuterKA));
+ Assert.assertEquals(2, AWTRobotUtil.testKeyType(robot, 2, buttonNorthOuter, buttonNorthOuterKA));
+ Assert.assertEquals(1, AWTRobotUtil.testMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
+ buttonNorthOuter, buttonNorthOuterMA));
+ Assert.assertEquals(3, AWTRobotUtil.testMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
+ buttonNorthOuter, buttonNorthOuterMA));
// NEWT Focus
Thread.sleep(100); // allow event sync
@@ -183,8 +195,13 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
Assert.assertEquals(0, buttonNorthOuterFA.getCount());
Assert.assertEquals(0, jFrame1FA.getCount());
System.err.println("FOCUS NEWT Canvas/GLWindow sync");
- Assert.assertTrue(AWTRobotUtil.testKeyInput(robot, glWindow1KA));
+ Assert.assertEquals(2, AWTRobotUtil.testKeyType(robot, 2, glWindow1, glWindow1KA));
Assert.assertEquals("AWT parent canvas received keyboard events", 0, newtCanvasAWTKA.getCount());
+ Assert.assertEquals(1, AWTRobotUtil.testMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
+ glWindow1, glWindow1MA));
+ Assert.assertEquals(3, AWTRobotUtil.testMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
+ glWindow1, glWindow1MA));
+ Assert.assertEquals("AWT parent canvas received mouse events", 0, newtCanvasAWTMA.getCount());
// Button Inner Focus
Thread.sleep(100); // allow event sync
@@ -195,7 +212,11 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
Assert.assertEquals(0, buttonNorthOuterFA.getCount());
Assert.assertEquals(0, jFrame1FA.getCount());
System.err.println("FOCUS AWT Button sync");
- Assert.assertTrue(AWTRobotUtil.testKeyInput(robot, buttonNorthInnerKA));
+ Assert.assertEquals(2, AWTRobotUtil.testKeyType(robot, 2, buttonNorthInner, buttonNorthInnerKA));
+ Assert.assertEquals(1, AWTRobotUtil.testMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
+ buttonNorthInner, buttonNorthInnerMA));
+ Assert.assertEquals(3, AWTRobotUtil.testMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
+ buttonNorthInner, buttonNorthInnerMA));
// NEWT Focus
Thread.sleep(100); // allow event sync
@@ -206,8 +227,14 @@ public class TestFocus02SwingAWTRobot extends UITestCase {
Assert.assertEquals(0, buttonNorthOuterFA.getCount());
Assert.assertEquals(0, jFrame1FA.getCount());
System.err.println("FOCUS NEWT Canvas/GLWindow sync");
- Assert.assertTrue(AWTRobotUtil.testKeyInput(robot, glWindow1KA));
+ Assert.assertEquals(2, AWTRobotUtil.testKeyType(robot, 2, glWindow1, glWindow1KA));
Assert.assertEquals("AWT parent canvas received keyboard events", 0, newtCanvasAWTKA.getCount());
+ Assert.assertEquals(1, AWTRobotUtil.testMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 1,
+ glWindow1, glWindow1MA));
+ Assert.assertEquals(3, AWTRobotUtil.testMouseClick(robot, java.awt.event.InputEvent.BUTTON1_MASK, 2,
+ glWindow1, glWindow1MA));
+ Assert.assertEquals("AWT parent canvas received mouse events", 0, newtCanvasAWTMA.getCount());
+
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
diff --git a/src/junit/com/jogamp/test/junit/util/AWTKeyAdapter.java b/src/junit/com/jogamp/test/junit/util/AWTKeyAdapter.java
index 5ee715cdf..607ccc220 100644
--- a/src/junit/com/jogamp/test/junit/util/AWTKeyAdapter.java
+++ b/src/junit/com/jogamp/test/junit/util/AWTKeyAdapter.java
@@ -28,7 +28,6 @@
package com.jogamp.test.junit.util;
-
public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements EventCountAdapter {
String prefix;
@@ -42,7 +41,6 @@ public class AWTKeyAdapter extends java.awt.event.KeyAdapter implements EventCou
return keyTyped;
}
- @Override
public void keyTyped(java.awt.event.KeyEvent e) {
++keyTyped;
System.err.println("KEY AWT TYPED ["+keyTyped+"]: "+prefix+", "+e);
diff --git a/src/junit/com/jogamp/test/junit/util/AWTMouseAdapter.java b/src/junit/com/jogamp/test/junit/util/AWTMouseAdapter.java
new file mode 100644
index 000000000..e841dc8e1
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/util/AWTMouseAdapter.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 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
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.test.junit.util;
+
+public class AWTMouseAdapter extends java.awt.event.MouseAdapter implements EventCountAdapter {
+ String prefix;
+ int mouseClicked;
+
+ public AWTMouseAdapter(String prefix) {
+ this.prefix = prefix;
+ }
+
+ public int getCount() {
+ return mouseClicked;
+ }
+
+ public void mouseClicked(java.awt.event.MouseEvent e) {
+ mouseClicked+=e.getClickCount();
+ System.err.println("MOUSE AWT CLICKED ["+mouseClicked+"]: "+prefix+", "+e);
+ }
+}
+
diff --git a/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java b/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java
index 5240178a7..38998e854 100644
--- a/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java
+++ b/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java
@@ -44,6 +44,43 @@ public class AWTRobotUtil {
public static int TIME_OUT = 1000; // 1s
+ public static Point getCenterLocation(Object obj, boolean frameTitlebar)
+ throws InterruptedException, InvocationTargetException {
+ Component comp = null;
+ com.jogamp.newt.Window win = null;
+
+ if(obj instanceof com.jogamp.newt.Window) {
+ win = (com.jogamp.newt.Window) obj;
+ } else if(obj instanceof Component) {
+ comp = (Component) obj;
+ } else {
+ throw new RuntimeException("Neither AWT nor NEWT: "+obj);
+ }
+
+ int x0, y0;
+ if(null!=comp) {
+ Point p0 = comp.getLocationOnScreen();
+ Rectangle r0 = comp.getBounds();
+ if( frameTitlebar && comp instanceof JFrame ) {
+ JFrame jFrame = (JFrame) comp;
+ Container cont = jFrame.getContentPane();
+ Point p1 = cont.getLocationOnScreen();
+ int dx = (int) ( r0.getWidth() / 2.0 + .5 );
+ int dy = (int) ( ( p1.getY() - p0.getY() ) / 2.0 + .5 );
+ x0 = (int) ( p0.getX() + dx + .5 ) ;
+ y0 = (int) ( p0.getY() + dy + .5 ) ;
+ } else {
+ x0 = (int) ( p0.getX() + r0.getWidth() / 2.0 + .5 ) ;
+ y0 = (int) ( p0.getY() + r0.getHeight() / 2.0 + .5 ) ;
+ }
+ } else {
+ x0 = win.getX() + win.getWidth() / 2 ;
+ y0 = win.getY() + win.getHeight() / 2 ;
+ }
+
+ return new Point(x0, y0);
+ }
+
/**
* toFront, call setVisible(true) and toFront(),
* after positioning the mouse in the middle of the window via robot.
@@ -58,14 +95,9 @@ public class AWTRobotUtil {
robot = new Robot();
robot.setAutoWaitForIdle(true);
}
- Point p0 = window.getLocationOnScreen();
- Rectangle r0 = window.getBounds();
- int dx = (int) ( r0.getWidth() / 2.0 + .5 );
- int dy = (int) ( r0.getHeight() / 2.0 + .5 );
- int x0 = (int) ( p0.getX() + dx + .5 ) ;
- int y0 = (int) ( p0.getY() + dy + .5 ) ;
- System.err.println("robot pos: "+x0+"/"+y0);
- robot.mouseMove( x0, y0 );
+ Point p0 = getCenterLocation(window, false);
+ System.err.println("robot pos: "+p0);
+ robot.mouseMove( (int) p0.getX(), (int) p0.getY() );
robot.delay(50);
final Window f_window = window;
@@ -86,11 +118,39 @@ public class AWTRobotUtil {
}
/**
+ * centerMouse
+ */
+ public static void centerMouse(Robot robot, Object obj)
+ throws AWTException, InterruptedException, InvocationTargetException {
+ Component comp = null;
+ com.jogamp.newt.Window win = null;
+
+ if(null == robot) {
+ robot = new Robot();
+ robot.setAutoWaitForIdle(true);
+ }
+
+ if(obj instanceof com.jogamp.newt.Window) {
+ win = (com.jogamp.newt.Window) obj;
+ } else if(obj instanceof Component) {
+ comp = (Component) obj;
+ } else {
+ throw new RuntimeException("Neither AWT nor NEWT: "+obj);
+ }
+
+ Point p0 = getCenterLocation(obj, false);
+ System.err.println("robot pos: "+p0);
+
+ robot.mouseMove( (int) p0.getX(), (int) p0.getY() );
+ robot.delay(50);
+ }
+
+ /**
* requestFocus, if robot is valid, use mouse operation,
* otherwise programatic, ie call requestFocus
*/
public static void requestFocus(Robot robot, Object obj)
- throws InterruptedException, InvocationTargetException {
+ throws AWTException, InterruptedException, InvocationTargetException {
Component comp = null;
com.jogamp.newt.Window win = null;
@@ -115,29 +175,8 @@ public class AWTRobotUtil {
return;
}
- int x0, y0;
- if(null!=comp) {
- Point p0 = comp.getLocationOnScreen();
- Rectangle r0 = comp.getBounds();
- if( comp instanceof JFrame ) {
- JFrame jFrame = (JFrame) comp;
- Container cont = jFrame.getContentPane();
- Point p1 = cont.getLocationOnScreen();
- int dx = (int) ( r0.getWidth() / 2.0 + .5 );
- int dy = (int) ( ( p1.getY() - p0.getY() ) / 2.0 + .5 );
- x0 = (int) ( p0.getX() + dx + .5 ) ;
- y0 = (int) ( p0.getY() + dy + .5 ) ;
- } else {
- x0 = (int) ( p0.getX() + r0.getWidth() / 2.0 + .5 ) ;
- y0 = (int) ( p0.getY() + r0.getHeight() / 2.0 + .5 ) ;
- }
- } else {
- x0 = win.getX() + win.getWidth() / 2 ;
- y0 = win.getY() + win.getHeight() / 2 ;
- }
+ centerMouse(robot, obj);
- System.err.println("robot pos: "+x0+"/"+y0);
- robot.mouseMove( x0, y0 );
robot.delay(50);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.delay(50);
@@ -169,7 +208,7 @@ public class AWTRobotUtil {
}
public static boolean requestFocusAndWait(Robot robot, Object requestFocus, Object waitForFocus)
- throws InterruptedException, InvocationTargetException {
+ throws AWTException, InterruptedException, InvocationTargetException {
requestFocus(robot, requestFocus);
return waitForFocus(waitForFocus);
@@ -177,35 +216,73 @@ public class AWTRobotUtil {
/**
* @param keyTypedCounter shall return the number of keys typed (press + release)
- * @return True if the object received 2 keys within TIME_OUT
+ * @return True if typeCount keys within TIME_OUT has been received
*/
- public static boolean testKeyInput(Robot robot, EventCountAdapter keyTypedCounter)
+ public static int testKeyType(Robot robot, int typeCount, Object obj, EventCountAdapter keyTypedCounter)
throws AWTException, InterruptedException, InvocationTargetException {
Component comp = null;
com.jogamp.newt.Window win = null;
+ if(null == robot) {
+ robot = new Robot();
+ robot.setAutoWaitForIdle(true);
+ }
+
+ centerMouse(robot, obj);
+
int c0 = keyTypedCounter.getCount();
+ for(int i=0; i<typeCount; i++) {
+ robot.keyPress(java.awt.event.KeyEvent.VK_A);
+ robot.delay(50);
+ robot.keyRelease(java.awt.event.KeyEvent.VK_A);
+ robot.delay(50);
+ }
+
+ // Wait for the key events to be processed.
+ int wait;
+ for (wait=0; wait<10 && (keyTypedCounter.getCount()-c0)<typeCount; wait++) {
+ Thread.sleep(TIME_OUT/10);
+ }
+ return keyTypedCounter.getCount()-c0;
+ }
+
+ /**
+ * @param mouseButton ie InputEvent.BUTTON1_MASK
+ * @param clickCount ie 1, or 2
+ * @return True if the desired clickCount within TIME_OUT has been received
+ */
+ public static int testMouseClick(Robot robot, int mouseButton, int clickCount,
+ Object obj, EventCountAdapter mouseClickCounter)
+ throws AWTException, InterruptedException, InvocationTargetException {
+
if(null == robot) {
robot = new Robot();
robot.setAutoWaitForIdle(true);
}
- robot.keyPress(java.awt.event.KeyEvent.VK_A);
- robot.delay(50);
- robot.keyRelease(java.awt.event.KeyEvent.VK_A);
- robot.delay(50);
- robot.keyPress(java.awt.event.KeyEvent.VK_B);
- robot.delay(50);
- robot.keyRelease(java.awt.event.KeyEvent.VK_B);
+ final int clickTO = com.jogamp.newt.event.MouseEvent.getClickTimeout();
+
+ centerMouse(robot, obj);
+
+ robot.delay(2*clickTO);
+
+ int c0 = mouseClickCounter.getCount();
+
+ for(int i=0; i<clickCount; i++) {
+ robot.mousePress(mouseButton);
+ robot.delay(clickTO/4);
+ robot.mouseRelease(mouseButton);
+ robot.delay(clickTO/4);
+ }
robot.delay(50);
// Wait for the key events to be processed.
int wait;
- for (wait=0; wait<10 && (keyTypedCounter.getCount()-c0)<2; wait++) {
+ for (wait=0; wait<10 && (mouseClickCounter.getCount()-c0)<clickCount; wait++) {
Thread.sleep(TIME_OUT/10);
}
- return wait<10;
+ return mouseClickCounter.getCount()-c0;
}
}
diff --git a/src/junit/com/jogamp/test/junit/util/NEWTMouseAdapter.java b/src/junit/com/jogamp/test/junit/util/NEWTMouseAdapter.java
new file mode 100644
index 000000000..36943a805
--- /dev/null
+++ b/src/junit/com/jogamp/test/junit/util/NEWTMouseAdapter.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 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
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+package com.jogamp.test.junit.util;
+
+import com.jogamp.newt.event.MouseAdapter;
+import com.jogamp.newt.event.MouseEvent;
+
+public class NEWTMouseAdapter extends MouseAdapter implements EventCountAdapter {
+
+ String prefix;
+ int mouseClicked;
+
+ public NEWTMouseAdapter(String prefix) {
+ this.prefix = prefix;
+ }
+
+ public int getCount() {
+ return mouseClicked;
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ mouseClicked+=e.getClickCount();
+ System.err.println("MOUSE NEWT CLICKED ["+mouseClicked+"]: "+prefix+", "+e);
+ }
+}
+