aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-12-24 01:55:55 +0100
committerSven Gothel <[email protected]>2012-12-24 01:55:55 +0100
commitf3e2467decf2a5ee47cfb458f7071772f39ea9c6 (patch)
tree0830921491346c0449b8ad0800fdeedb14ae2ece /src
parent58eb9d922c2a16a2724aaa2188c56784d440fb99 (diff)
AWT-NEWT Modifier mapping and test: part-3 (NEWT BUTTON MASK always, ..)
- AWTNewtEventFactory's awtModifiers2Newt: - always include NEWT BUTTON_MASK (press, release, ..) where AWT doesn't include them at release (it's only a DOWN_MASK). - Test BaseNewtEventModifiers, .. - No need to call super class Before, BeforeClass, .. manually - Use RedSquareES2 as GL demo - Adapt to AWTNewtEventFactory's modifier change above (NEWT BUTTON MASK even at release) - More descriptive error/log text - Added _mandatory_ TestNewtEventModifiersNEWTWindowAWT to test native NEWT behavior. This shall be the golden behavior all translated events shall compare w/.
Diffstat (limited to 'src')
-rw-r--r--src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java150
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java75
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java7
6 files changed, 135 insertions, 125 deletions
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
index 665b7b5ee..1a61d0528 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
@@ -194,11 +194,8 @@ public class AWTNewtEventFactory {
* @param awtModsEx
* The AWT extended event modifiers.
* AWT passes mouse button specific bits here and are the preferred way check the mouse button state.
- *
- * @param mouseHint
- * Not used currently.
*/
- public static final int awtModifiers2Newt(final int awtMods, final int awtModsEx, final boolean mouseHint) {
+ public static final int awtModifiers2Newt(final int awtMods, final int awtModsEx) {
int newtMods = 0;
/** Redundant old modifiers ..
@@ -271,7 +268,9 @@ public class AWTNewtEventFactory {
rotation = -1 * ((java.awt.event.MouseWheelEvent)event).getWheelRotation();
}
- int mods = awtModifiers2Newt(event.getModifiers(), event.getModifiersEx(), true);
+ final int newtButton = awtButton2Newt(event.getButton());
+ int mods = awtModifiers2Newt(event.getModifiers(), event.getModifiersEx());
+ mods |= com.jogamp.newt.event.InputEvent.getButtonMask(newtButton); // always include NEWT BUTTON_MASK
if(null!=newtSource) {
if(newtSource.isPointerConfined()) {
mods |= com.jogamp.newt.event.InputEvent.CONFINED_MASK;
@@ -280,11 +279,10 @@ public class AWTNewtEventFactory {
mods |= com.jogamp.newt.event.InputEvent.INVISIBLE_MASK;
}
}
-
return new com.jogamp.newt.event.MouseEvent(
type, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
mods, event.getX(), event.getY(), event.getClickCount(),
- awtButton2Newt(event.getButton()), rotation);
+ newtButton, rotation);
}
return null; // no mapping ..
}
@@ -294,7 +292,7 @@ public class AWTNewtEventFactory {
if(0xFFFFFFFF != type) {
return new com.jogamp.newt.event.KeyEvent(
type, (null==newtSource)?(Object)event.getComponent():(Object)newtSource, event.getWhen(),
- awtModifiers2Newt(event.getModifiers(), event.getModifiersEx(), false),
+ awtModifiers2Newt(event.getModifiers(), event.getModifiersEx()),
event.getKeyCode(), event.getKeyChar());
}
return null; // no mapping ..
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
index 1dfdc4021..53af603ba 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
@@ -31,10 +31,6 @@ package com.jogamp.opengl.test.junit.newt.event ;
import java.io.PrintStream ;
import java.util.ArrayList ;
-import javax.media.opengl.GL ;
-import javax.media.opengl.GL2 ;
-import javax.media.opengl.GLAutoDrawable ;
-import javax.media.opengl.GLEventListener ;
import javax.media.opengl.GLProfile ;
import org.junit.After ;
@@ -44,7 +40,6 @@ import org.junit.Before ;
import org.junit.BeforeClass ;
import org.junit.Test ;
-import com.jogamp.common.os.Platform;
import com.jogamp.newt.event.MouseEvent;
import com.jogamp.opengl.test.junit.util.UITestCase ;
@@ -61,63 +56,6 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
GLProfile.initSingleton() ;
}
- // A class to draw something on a canvas. This is only
- // here so we can make sure the GL drawing area has
- // filled the window.
-
- public static class BigGreenXGLEventListener implements GLEventListener
- {
- public void init( GLAutoDrawable drawable )
- {
- GL2 gl = drawable.getGL().getGL2() ;
-
- gl.glClearColor( 0.0f, 0.0f, 0.0f, 1.0f ) ;
-
- gl.glEnable( GL.GL_LINE_SMOOTH ) ;
- gl.glEnable( GL.GL_BLEND ) ;
- gl.glBlendFunc( GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA ) ;
- }
-
- public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height )
- {
- GL2 gl = drawable.getGL().getGL2() ;
-
- gl.glViewport( 0, 0, width, height ) ;
-
- gl.glMatrixMode( GL2.GL_PROJECTION ) ;
- gl.glLoadIdentity() ;
- gl.glOrtho( -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 ) ;
-
- gl.glMatrixMode( GL2.GL_MODELVIEW ) ;
- gl.glLoadIdentity() ;
- }
-
- public void display( GLAutoDrawable drawable )
- {
- GL2 gl = drawable.getGL().getGL2() ;
-
- gl.glClear( GL2.GL_COLOR_BUFFER_BIT ) ;
-
- gl.glColor4f( 0.0f, 1.0f, 0.0f, 1.0f ) ;
-
- gl.glBegin( GL.GL_LINES ) ;
- {
- gl.glVertex2f( -1.0f, 1.0f ) ;
- gl.glVertex2f( 1.0f, -1.0f ) ;
-
- gl.glVertex2f( -1.0f, -1.0f ) ;
- gl.glVertex2f( 1.0f, 1.0f ) ;
- }
- gl.glEnd() ;
- }
-
- public void dispose( GLAutoDrawable drawable )
- {
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////
-
private static class TestMouseListener implements com.jogamp.newt.event.MouseListener
{
private static final String NO_EVENT_DELIVERY = "no event delivery" ;
@@ -152,34 +90,36 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_failures.add( NO_EVENT_DELIVERY ) ;
}
- private void _checkModifiers( com.jogamp.newt.event.MouseEvent event ) {
+ private void _checkModifiers( com.jogamp.newt.event.MouseEvent hasEvent ) {
if( _debug ) {
_debugPrintStream.print( " received NEWT " ) ;
- _debugPrintStream.print( com.jogamp.newt.event.MouseEvent.getEventTypeString( event.getEventType() ) ) ;
+ _debugPrintStream.print( com.jogamp.newt.event.MouseEvent.getEventTypeString( hasEvent.getEventType() ) ) ;
}
if( _modifierCheckEnabled ) {
+ final MouseEvent expEvent = new MouseEvent(hasEvent.getEventType(), hasEvent.getSource(), hasEvent.getWhen(), _expectedModifiers,
+ hasEvent.getX(), hasEvent.getY(), hasEvent.getClickCount(), hasEvent.getButton(), hasEvent.getWheelRotation());
+
if( _debug ) {
_debugPrintStream.println( ", checking modifiers..." ) ;
_debugPrintStream.println( " expected NEWT Modifiers:" ) ;
{
- final MouseEvent exp = new MouseEvent(MouseEvent.EVENT_MOUSE_CLICKED, null, 0, _expectedModifiers, 0, 0, 1, 1, 0);
- _debugPrintStream.println(" "+exp.getModifiersString(null).toString());
+ _debugPrintStream.println(" "+expEvent.getModifiersString(null).toString());
}
_debugPrintStream.println( " current NEWT Modifiers:" ) ;
- _debugPrintStream.println(" "+event.getModifiersString(null).toString());
+ _debugPrintStream.println(" "+hasEvent.getModifiersString(null).toString());
}
- _checkModifierMask( event, com.jogamp.newt.event.InputEvent.SHIFT_MASK ) ;
- _checkModifierMask( event, com.jogamp.newt.event.InputEvent.CTRL_MASK ) ;
- _checkModifierMask( event, com.jogamp.newt.event.InputEvent.META_MASK ) ;
- _checkModifierMask( event, com.jogamp.newt.event.InputEvent.ALT_MASK ) ;
- _checkModifierMask( event, com.jogamp.newt.event.InputEvent.ALT_GRAPH_MASK ) ;
+ _checkModifierMask( expEvent, hasEvent, com.jogamp.newt.event.InputEvent.SHIFT_MASK, "shift" ) ;
+ _checkModifierMask( expEvent, hasEvent, com.jogamp.newt.event.InputEvent.CTRL_MASK, "ctrl" ) ;
+ _checkModifierMask( expEvent, hasEvent, com.jogamp.newt.event.InputEvent.META_MASK, "meta" ) ;
+ _checkModifierMask( expEvent, hasEvent, com.jogamp.newt.event.InputEvent.ALT_MASK, "alt" ) ;
+ _checkModifierMask( expEvent, hasEvent, com.jogamp.newt.event.InputEvent.ALT_GRAPH_MASK, "graph" ) ;
for( int n = 0 ; n < _numButtonsToTest ; ++n ) {
- _checkModifierMask( event, com.jogamp.newt.event.InputEvent.getButtonMask( n + 1 ) ) ;
+ _checkModifierMask( expEvent, hasEvent, com.jogamp.newt.event.InputEvent.getButtonMask( n + 1 ), "button"+(n+1) ) ;
}
} else {
if( _debug ) {
@@ -188,7 +128,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
}
}
- private void _checkModifierMask( com.jogamp.newt.event.MouseEvent event, int mask ) {
+ private void _checkModifierMask( com.jogamp.newt.event.MouseEvent expEvent, com.jogamp.newt.event.MouseEvent hasEvent, int mask, String maskS ) {
// If the "no event delivery" failure is still in the list then
// get rid of it since that obviously isn't true anymore. We
@@ -199,15 +139,21 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_failures.clear() ;
}
- if( ( event.getModifiers() & mask ) != ( _expectedModifiers & mask ) ) {
+ if( ( hasEvent.getModifiers() & mask ) != ( expEvent.getModifiers() & mask ) ) {
StringBuilder sb = new StringBuilder();
- sb.append( com.jogamp.newt.event.MouseEvent.getEventTypeString( event.getEventType() ) ).append(": ");
- final MouseEvent exp = new MouseEvent(MouseEvent.EVENT_MOUSE_CLICKED, null, 0, _expectedModifiers, 0, 0, 1, 1, 0);
- sb.append("Expected:").append(Platform.NEWLINE);
- exp.getModifiersString(sb).append(Platform.NEWLINE);
- sb.append(", Have: ").append(Platform.NEWLINE);
- event.getModifiersString(sb).append(Platform.NEWLINE);
+ sb.append( com.jogamp.newt.event.MouseEvent.getEventTypeString( hasEvent.getEventType() ) ).append(": mask ").append(maskS).append(" 0x").append(Integer.toHexString(mask));
+ sb.append(", expected:");
+ expEvent.getModifiersString(sb);
+ sb.append(", have: ");
+ hasEvent.getModifiersString(sb);
_failures.add( sb.toString() ) ;
+ /**
+ System.err.println("*** MASK: 0x"+Integer.toHexString(mask));
+ System.err.println("*** EXP: "+expEvent);
+ System.err.println("*** EXP: 0x"+Integer.toHexString(expEvent.getModifiers()));
+ System.err.println("*** HAS: "+hasEvent);
+ System.err.println("*** HAS: 0x"+Integer.toHexString(hasEvent.getModifiers()));
+ throw new RuntimeException(sb.toString()); */
}
}
@@ -290,7 +236,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
}
@BeforeClass
- public static void beforeClass() throws Exception {
+ public static void baseBeforeClass() throws Exception {
// Who know how many buttons the AWT will say exist on given platform.
// We'll test the smaller of what NEWT supports and what the
@@ -342,7 +288,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
////////////////////////////////////////////////////////////////////////////
@Before
- public void before() throws Exception {
+ public void baseBeforeTest() throws Exception {
_testMouseListener.setModifierCheckEnabled( false ) ;
_robot.setAutoDelay( MS_ROBOT_SHORT_AUTO_DELAY ) ;
@@ -360,8 +306,8 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
}
_robot.mouseMove( INITIAL_MOUSE_X, INITIAL_MOUSE_Y ) ;
- _robot.mousePress( java.awt.event.InputEvent.BUTTON1_DOWN_MASK ) ;
- _robot.mouseRelease( java.awt.event.InputEvent.BUTTON1_DOWN_MASK ) ;
+ _robot.mousePress( java.awt.event.InputEvent.BUTTON1_MASK ); // java7: java.awt.event.InputEvent.BUTTON1_DOWN_MASK
+ _robot.mouseRelease( java.awt.event.InputEvent.BUTTON1_MASK ) ; // java7: java.awt.event.InputEvent.BUTTON1_DOWN_MASK
_testMouseListener.setModifierCheckEnabled( true ) ;
_robot.setAutoDelay( MS_ROBOT_LONG_AUTO_DELAY ) ;
@@ -410,14 +356,14 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
// so it's probably best to leave them commented out.
//@Test
- //public void testSingleButtonPressAndReleaseWithMeta() throws Exception {
- // _doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_META, java.awt.event.InputEvent.META_DOWN_MASK ) ;
- //}
+ public void testSingleButtonPressAndReleaseWithMeta() throws Exception {
+ _doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_META, java.awt.event.InputEvent.META_DOWN_MASK ) ;
+ }
//@Test
- //public void testSingleButtonPressAndReleaseWithAlt() throws Exception {
- // _doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_ALT, java.awt.event.InputEvent.ALT_DOWN_MASK ) ;
- //}
+ public void testSingleButtonPressAndReleaseWithAlt() throws Exception {
+ _doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_ALT, java.awt.event.InputEvent.ALT_DOWN_MASK ) ;
+ }
// FIXME - not sure yet what's up with ALT_GRAPH. It appears that this
// modifier didn't make it through, so I had to disable this test else
@@ -427,9 +373,9 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
// enough to not let this modifier slip through (?).
//@Test
- //public void testSingleButtonPressAndReleaseWithAltGraph() throws Exception {
- // _doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_ALT_GRAPH, java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK ) ;
- //}
+ public void testSingleButtonPressAndReleaseWithAltGraph() throws Exception {
+ _doSingleButtonPressAndRelease( java.awt.event.KeyEvent.VK_ALT_GRAPH, java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK ) ;
+ }
////////////////////////////////////////////////////////////////////////////
@@ -466,7 +412,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_checkFailures() ;
if( _debug ) { _debugPrintStream.println( "\n releasing button " + ( n + 1 ) ) ; }
- _testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask ) ) ;
+ _testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask | awtButtonMask ) ) ;
_robot.mouseRelease( awtButtonMask ) ;
_checkFailures() ;
}
@@ -501,14 +447,14 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_checkFailures() ;
if( _debug ) { _debugPrintStream.println( "\n releasing additional button " + ( m + 1 ) ) ; }
- _testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask | awtButtonMask ) ) ;
+ _testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask | awtButtonMask | _awtButtonMasks[m] ) ) ;
_robot.mouseRelease( _awtButtonMasks[m] ) ;
_checkFailures() ;
}
}
if( _debug ) { _debugPrintStream.println( "\n releasing button " + ( n + 1 ) ) ; }
- _testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask ) ) ;
+ _testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask | awtButtonMask ) ) ;
_robot.mouseRelease( awtButtonMask ) ;
_checkFailures() ;
}
@@ -539,12 +485,12 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
for (int n = _numButtonsToTest - 1 ; n >= 0 ; --n) {
- cumulativeAwtModifiers &= ~_awtButtonMasks[n] ;
-
if( _debug ) { _debugPrintStream.println( "\n releasing button " + ( n + 1 ) ) ; }
_testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask | cumulativeAwtModifiers ) ) ;
_robot.mouseRelease( _awtButtonMasks[n] ) ;
_checkFailures() ;
+
+ cumulativeAwtModifiers &= ~_awtButtonMasks[n] ;
}
}
@@ -576,7 +522,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
_checkFailures() ;
if( _debug ) { _debugPrintStream.println( "\n releasing button " + ( n + 1 ) ) ; }
- _testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask ) ) ;
+ _testMouseListener.setExpectedModifiers( _getNewtModifiersForAwtExtendedModifiers( keyModifierMask | awtButtonMask ) ) ;
_robot.mouseRelease( awtButtonMask ) ;
_checkFailures() ;
@@ -635,7 +581,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
////////////////////////////////////////////////////////////////////////////
@After
- public void after() throws Exception {
+ public void baseAfterTest() throws Exception {
_testMouseListener.setModifierCheckEnabled( false ) ;
@@ -645,7 +591,7 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
////////////////////////////////////////////////////////////////////////////
@AfterClass
- public static void afterClass() throws Exception {
+ public static void baseAfterClass() throws Exception {
// Make sure all modifiers are released, otherwise the user's
// desktop can get locked up (ask me how I know this).
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 fd68ace73..725dbe97f 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
@@ -38,6 +38,7 @@ import org.junit.AfterClass ;
import org.junit.BeforeClass ;
import com.jogamp.newt.event.awt.AWTMouseAdapter ;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
/**
* Test whether or not event modifiers are preserved by NEWT when
@@ -53,10 +54,8 @@ public class TestNewtEventModifiersAWTCanvas extends BaseNewtEventModifiers {
@BeforeClass
public static void beforeClass() throws Exception {
- BaseNewtEventModifiers.beforeClass() ;
-
final GLCanvas canvas = new GLCanvas() ;
- canvas.addGLEventListener( new BigGreenXGLEventListener() ) ;
+ canvas.addGLEventListener( new RedSquareES2() ) ;
new AWTMouseAdapter( _testMouseListener ).addTo( (java.awt.Component)canvas ) ;
_testFrame = new JFrame( "Event Modifier Test AWTCanvas" ) ;
@@ -76,8 +75,6 @@ public class TestNewtEventModifiersAWTCanvas extends BaseNewtEventModifiers {
@AfterClass
public static void afterClass() throws Exception {
- BaseNewtEventModifiers.afterClass() ;
-
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
_testFrame.dispose() ;
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java
new file mode 100644
index 000000000..d6088e6a2
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java
@@ -0,0 +1,75 @@
+/**
+ * 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.opengl.test.junit.newt.event;
+
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLProfile;
+
+import org.junit.AfterClass ;
+import org.junit.BeforeClass ;
+
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+
+/**
+ * Test whether or not event modifiers are properly delivered by NEWT.
+ */
+public class TestNewtEventModifiersNEWTWindowAWT extends BaseNewtEventModifiers {
+
+ private static GLWindow glWindow;
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ @BeforeClass
+ public static void beforeClass() throws Exception {
+ glWindow = GLWindow.create( new GLCapabilities( GLProfile.getGL2ES2() ) );
+ glWindow.setTitle("Event Modifier Test GLWindow");
+ glWindow.addGLEventListener( new RedSquareES2() ) ;
+ glWindow.addMouseListener(_testMouseListener);
+ glWindow.setSize(TEST_FRAME_WIDTH, TEST_FRAME_HEIGHT);
+ glWindow.setPosition(TEST_FRAME_X, TEST_FRAME_Y);
+ glWindow.setVisible(true);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ @AfterClass
+ public static void afterClass() throws Exception {
+ glWindow.destroy();
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+
+ public static void main(String args[]) throws Exception {
+ String testName = TestNewtEventModifiersNEWTWindowAWT.class.getName() ;
+ org.junit.runner.JUnitCore.main( testName ) ;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java
index 44f116ea1..5590300c7 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java
@@ -42,6 +42,7 @@ import org.junit.BeforeClass ;
import com.jogamp.newt.awt.NewtCanvasAWT ;
import com.jogamp.newt.opengl.GLWindow ;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
/**
* Test whether or not event modifiers are preserved by NEWT when
@@ -58,8 +59,6 @@ public class TestNewtEventModifiersNewtCanvasAWT extends BaseNewtEventModifiers
@BeforeClass
public static void beforeClass() throws Exception {
- BaseNewtEventModifiers.beforeClass() ;
-
SwingUtilities.invokeAndWait( new Runnable() {
public void run() {
@@ -73,7 +72,7 @@ public class TestNewtEventModifiersNewtCanvasAWT extends BaseNewtEventModifiers
NewtCanvasAWT canvas = new NewtCanvasAWT( _glWindow ) ;
_testFrame.getContentPane().add( canvas, BorderLayout.CENTER ) ;
- _glWindow.addGLEventListener( new BigGreenXGLEventListener() ) ;
+ _glWindow.addGLEventListener( new RedSquareES2() ) ;
}
_testFrame.setBounds( TEST_FRAME_X, TEST_FRAME_Y, TEST_FRAME_WIDTH, TEST_FRAME_HEIGHT ) ;
@@ -89,8 +88,6 @@ public class TestNewtEventModifiersNewtCanvasAWT extends BaseNewtEventModifiers
@AfterClass
public static void afterClass() throws Exception {
- BaseNewtEventModifiers.afterClass() ;
-
SwingUtilities.invokeAndWait( new Runnable() {
public void run() {
_testFrame.dispose() ;
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java
index 501e0d1bd..c0d1690de 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasSWT.java
@@ -41,6 +41,7 @@ import org.junit.BeforeClass ;
import com.jogamp.newt.opengl.GLWindow ;
import com.jogamp.newt.swt.NewtCanvasSWT ;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
/**
* Test whether or not event modifiers preserved by NEWT when
@@ -87,8 +88,6 @@ public class TestNewtEventModifiersNewtCanvasSWT extends BaseNewtEventModifiers
@BeforeClass
public static void beforeClass() throws Exception {
- BaseNewtEventModifiers.beforeClass() ;
-
_displayThread = new DisplayThread() ;
_displayThread.start() ;
@@ -111,7 +110,7 @@ public class TestNewtEventModifiersNewtCanvasSWT extends BaseNewtEventModifiers
NewtCanvasSWT.create( _testShell, SWT.NO_BACKGROUND, _glWindow ) ;
- _glWindow.addGLEventListener( new BigGreenXGLEventListener() ) ;
+ _glWindow.addGLEventListener( new RedSquareES2() ) ;
}
_testShell.setBounds( TEST_FRAME_X, TEST_FRAME_Y, TEST_FRAME_WIDTH, TEST_FRAME_HEIGHT ) ;
@@ -127,8 +126,6 @@ public class TestNewtEventModifiersNewtCanvasSWT extends BaseNewtEventModifiers
@AfterClass
public static void afterClass() throws Exception {
- BaseNewtEventModifiers.afterClass() ;
-
_glWindow.destroy() ;
_displayThread.getDisplay().syncExec( new Runnable() {