summaryrefslogtreecommitdiffstats
path: root/src/test/com/jogamp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com/jogamp')
-rwxr-xr-xsrc/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectFloatNOUI.java55
1 files changed, 50 insertions, 5 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectFloatNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectFloatNOUI.java
index 9e48a2000..717d5e4b8 100755
--- a/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectFloatNOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectFloatNOUI.java
@@ -33,14 +33,10 @@ import javax.media.opengl.glu.GLU;
import org.junit.Assert;
import org.junit.Test;
-/**
- * @author Julien Gouesse
- */
public class TestGluUnprojectFloatNOUI {
-
@Test
- public void test(){
+ public void testNaN(){
final GLU glu = new GLU();
final int[] pickedPoint = new int[]{400,300};
final float pickedPointDepth = 0;
@@ -52,6 +48,55 @@ public class TestGluUnprojectFloatNOUI {
Assert.assertTrue(!Double.isNaN(objCoords[0])&&!Double.isNaN(objCoords[1])&&!Double.isNaN(objCoords[2]));
}
+ @Test
+ public void test01(){
+ float[] mv = new float[] { 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1 };
+
+ float[] p = new float[] { 2.3464675f, 0, 0, 0,
+ 0, 2.4142134f, 0, 0,
+ 0, 0, -1.0002f, -1,
+ 0, 0, -20.002f, 0 };
+
+ int[] v = new int[] { 0, 0, 1000, 1000 };
+
+ float[] s = new float[] { 250, 250, 0.5f };
+
+ float[] expected = new float[] { -4.2612f, -4.1417f, -19.9980f };
+ float[] result = new float[] { 0, 0, 0 };
+
+ final GLU glu = new GLU();
+ glu.gluUnProject(s[0], s[1], s[2], mv, 0, p, 0, v, 0, result, 0);
+
+ Assert.assertArrayEquals(expected, result, 0.0001f);
+ }
+
+ @Test
+ public void test02(){
+ float[] mv = new float[] { 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, -200, 1 } ;
+
+ float[] p = new float[] { 2.3464675f, 0, 0, 0,
+ 0, 2.4142134f, 0, 0,
+ 0, 0, -1.0002f, -1,
+ 0, 0, -20.002f, 0 };
+
+ int[] v = new int[] { 0, 0, 1000, 1000 };
+
+ float[] s = new float[] { 250, 250, 0.5f };
+ float[] expected = new float[] { -4.2612f, -4.1417f, 180.002f };
+ float[] result = new float[] { 0, 0, 0 };
+
+ final GLU glu = new GLU();
+ glu.gluUnProject(s[0], s[1], s[2], mv, 0, p, 0, v, 0, result, 0);
+
+ Assert.assertArrayEquals(expected, result, 0.0001f);
+ }
+
public static void main(String args[]) {
org.junit.runner.JUnitCore.main(TestGluUnprojectFloatNOUI.class.getName());
}