diff options
-rwxr-xr-x | make/scripts/tests.sh | 3 | ||||
-rwxr-xr-x | src/test/com/jogamp/opengl/test/junit/jogl/glu/TestGluUnprojectFloatNOUI.java | 55 |
2 files changed, 52 insertions, 6 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index b0a55ccf1..9b4f0b94b 100755 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -209,7 +209,8 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen02BitmapNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $* -testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFloatUtil01MatrixMatrixMultNOUI $* +#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFloatUtil01MatrixMatrixMultNOUI $* +testnoawt com.jogamp.opengl.test.junit.jogl.glu.TestGluUnprojectFloatNOUI $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestNEWTCloseX11DisplayBug565 $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLWindowNEWT $* #testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLProfile01NEWT $* 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()); } |