diff options
author | Julien Gouesse <[email protected]> | 2010-12-01 19:47:11 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-02-01 04:22:33 +0100 |
commit | daea466337b1ed37e7e59d5a482ec69290155220 (patch) | |
tree | 6637090dce32303174627316ab2ae40324b43c96 | |
parent | 7fac7bd6fd3524bb9ce438410fa972f07884878d (diff) |
JUnit tests for gluProject and gluUnproject
-rwxr-xr-x | src/junit/com/jogamp/test/junit/jogl/glu/TestGluUnprojectDouble.java | 29 | ||||
-rwxr-xr-x | src/junit/com/jogamp/test/junit/jogl/glu/TestGluUnprojectFloat.java | 30 |
2 files changed, 59 insertions, 0 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/glu/TestGluUnprojectDouble.java b/src/junit/com/jogamp/test/junit/jogl/glu/TestGluUnprojectDouble.java new file mode 100755 index 000000000..bc37e1395 --- /dev/null +++ b/src/junit/com/jogamp/test/junit/jogl/glu/TestGluUnprojectDouble.java @@ -0,0 +1,29 @@ +package com.jogamp.test.junit.jogl.glu; + +import javax.media.opengl.glu.GLU; + +import org.junit.Assert; +import org.junit.Test; + +/** + * @author Julien Gouesse + */ +public class TestGluUnprojectDouble { + + @Test + public void test(){ + final GLU glu = new GLU(); + final int[] pickedPoint = new int[]{400,300}; + final double pickedPointDepth = 0; + final double[] sceneModelViewValues = new double[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}; + final double[] projectionValues = new double[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}; + final int[] viewport = new int[]{0,0,800,600}; + final double[] objCoords = new double[]{Double.NaN,Double.NaN,Double.NaN}; + glu.gluUnProject(pickedPoint[0], pickedPoint[1], pickedPointDepth, sceneModelViewValues, 0, projectionValues, 0, viewport, 0, objCoords, 0); + Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2])); + } + + public static void main(String args[]) { + org.junit.runner.JUnitCore.main(TestGluUnprojectDouble.class.getName()); + } +} diff --git a/src/junit/com/jogamp/test/junit/jogl/glu/TestGluUnprojectFloat.java b/src/junit/com/jogamp/test/junit/jogl/glu/TestGluUnprojectFloat.java new file mode 100755 index 000000000..01cda2201 --- /dev/null +++ b/src/junit/com/jogamp/test/junit/jogl/glu/TestGluUnprojectFloat.java @@ -0,0 +1,30 @@ +package com.jogamp.test.junit.jogl.glu; + +import javax.media.opengl.glu.GLU; + +import org.junit.Assert; +import org.junit.Test; + +/** + * @author Julien Gouesse + */ +public class TestGluUnprojectFloat { + + + @Test + public void test(){ + final GLU glu = new GLU(); + final int[] pickedPoint = new int[]{400,300}; + final float pickedPointDepth = 0; + final float[] sceneModelViewValues = new float[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}; + final float[] projectionValues = new float[]{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}; + final int[] viewport = new int[]{0,0,800,600}; + final float[] objCoords = new float[]{Float.NaN,Float.NaN,Float.NaN}; + glu.gluUnProject(pickedPoint[0], pickedPoint[1], pickedPointDepth, sceneModelViewValues, 0, projectionValues, 0, viewport, 0, objCoords, 0); + Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2])); + } + + public static void main(String args[]) { + org.junit.runner.JUnitCore.main(TestGluUnprojectFloat.class.getName()); + } +} |