aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-10-16 03:48:21 +0200
committerSven Gothel <[email protected]>2011-10-16 03:48:21 +0200
commit5b30ac3297601dec581d58835ef6bddaef079c77 (patch)
tree029ea2f7ac278dc38122531e2e3efbb6a891c205 /src/test
parentaeffc47f9fea7ae94c7531e6ee4cb53bc88e64f1 (diff)
Test GearsES2: Split confine mode to centered 'J' and non centered 'j', to test actual confinement
Diffstat (limited to 'src/test')
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java18
2 files changed, 25 insertions, 5 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
index 594f427ca..3fa61bf1d 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
@@ -270,6 +270,12 @@ public class GearsES2 implements GLEventListener {
st.useProgram(gl, false);
}
+ boolean confinedFixedCenter = false;
+
+ public void setConfinedFixedCenter(boolean v) {
+ confinedFixedCenter = v;
+ }
+
class GearsKeyAdapter extends KeyAdapter {
public void keyPressed(KeyEvent e) {
int kc = e.getKeyCode();
@@ -294,7 +300,7 @@ public class GearsES2 implements GLEventListener {
public void mouseReleased(MouseEvent e) {
}
- public void mouseMoved(MouseEvent e) {
+ public void mouseMoved(MouseEvent e) {
if(e.isConfined()) {
navigate(e);
} else {
@@ -326,12 +332,12 @@ public class GearsES2 implements GLEventListener {
height=comp.getHeight();
} else {
throw new RuntimeException("Event source neither Window nor Component: "+source);
- }
+ }
final float thetaY = 360.0f * ( (float)(x-prevMouseX)/(float)width);
final float thetaX = 360.0f * ( (float)(prevMouseY-y)/(float)height);
view_rotx += thetaX;
view_roty += thetaY;
- if(e.isConfined() && null!=window) {
+ if(e.isConfined() && confinedFixedCenter && null!=window) {
x=window.getWidth()/2;
y=window.getHeight()/2;
window.warpPointer(x, y);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
index 9846b2e69..18a5a5d31 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
@@ -68,8 +68,10 @@ public class TestGearsES2NEWT extends UITestCase {
glp = GLProfile.getGL2ES2();
}
Assert.assertNotNull(glp);
- width = 512;
- height = 512;
+ // width = 512;
+ // height = 512;
+ width = 200;
+ height = 200;
}
@AfterClass
@@ -82,6 +84,7 @@ public class TestGearsES2NEWT extends UITestCase {
Assert.assertNotNull(glWindow);
glWindow.setTitle("Gears NEWT Test (translucent "+!caps.isBackgroundOpaque()+")");
glWindow.setSize(width, height);
+ glWindow.setPosition(100, 100);
glWindow.setUndecorated(undecorated);
glWindow.setAlwaysOnTop(alwaysOnTop);
glWindow.setFullscreen(fullscreen);
@@ -163,6 +166,17 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("[set mouse confined pre]: "+glWindow.isPointerConfined());
glWindow.confinePointer(!glWindow.isPointerConfined());
System.err.println("[set mouse confined post]: "+glWindow.isPointerConfined());
+ if(!glWindow.isPointerConfined()) {
+ demo.setConfinedFixedCenter(false);
+ }
+ } }.start();
+ } else if(e.getKeyChar()=='J') {
+ new Thread() {
+ public void run() {
+ System.err.println("[set mouse confined pre]: "+glWindow.isPointerConfined());
+ glWindow.confinePointer(!glWindow.isPointerConfined());
+ System.err.println("[set mouse confined post]: "+glWindow.isPointerConfined());
+ demo.setConfinedFixedCenter(glWindow.isPointerConfined());
} }.start();
} else if(e.getKeyChar()=='w') {
new Thread() {