summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/scripts/tests.sh10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java136
2 files changed, 67 insertions, 79 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 2a75ffc5b..809618ce1 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -284,7 +284,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
-testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testawtswt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasSWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieCube $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.av.MovieSimple $*
@@ -340,15 +340,13 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLPointsNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug651NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLMesaBug658NEWT $*
+testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestX11DefaultDisplay $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer01GLCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestOffscreenLayer02NewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestAddRemove01GLCanvasSwingAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestAddRemove02GLWindowNewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestAddRemove03GLWindowNEWT $*
-#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.acore.TestGLAutoDrawableDelegateNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableDelegateOnOffscrnCapsNEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT $*
@@ -378,6 +376,9 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestGLContextDrawableSwitch21Newt2AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.glels.TestBug722GLContextDrawableSwitchNewt2AWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT $*
+#testnoawt com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen02BitmapNEWT $*
+
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug461FBOSupersamplingSwingAWT
@@ -400,6 +401,7 @@ testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.TestScreenMode02NEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.ManualScreenMode03NEWT $*
#testnoawt -Djava.awt.headless=true com.jogamp.opengl.test.junit.newt.TestGLWindows01NEWT $*
+#testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindowWarpPointer01NEWT $*
#
# awt (testawt)
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java
index bff0d418c..a2c620492 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java
@@ -28,6 +28,8 @@
package com.jogamp.opengl.test.junit.jogl.acore;
+import javax.media.nativewindow.AbstractGraphicsDevice;
+import javax.media.nativewindow.NativeWindowFactory;
import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;
@@ -36,10 +38,12 @@ import org.junit.BeforeClass;
import org.junit.Test;
import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.test.junit.jogl.demos.PointsDemo;
-import com.jogamp.opengl.test.junit.jogl.demos.es1.PointsDemoES1;
-import com.jogamp.opengl.test.junit.jogl.demos.es2.PointsDemoES2;
+import com.jogamp.opengl.test.junit.jogl.demos.es1.RedSquareES1;
+import com.jogamp.opengl.test.junit.util.DumpGLInfo;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
/**
* This is a clone of TestGLPointsNEWT which uses the ability to specify
@@ -48,6 +52,7 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
*
*/
public class TestX11DefaultDisplay extends UITestCase {
+ static long duration = 500; // ms
static int width = 512, height = 512;
static String x11DefaultDisplay = ":0.0";
@@ -56,100 +61,81 @@ public class TestX11DefaultDisplay extends UITestCase {
System.setProperty("nativewindow.x11.display.default", x11DefaultDisplay);
}
- protected void runTestGL0(GLCapabilities caps, PointsDemo demo) throws InterruptedException {
- GLWindow glWindow = GLWindow.create(caps);
+ protected void runTestGL(GLCapabilities caps) throws InterruptedException {
+ final GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle(getSimpleTestName("."));
+ glWindow.setSize(width, height);
+ final RedSquareES1 demo = new RedSquareES1();
glWindow.addGLEventListener(demo);
+
final SnapshotGLEventListener snap = new SnapshotGLEventListener();
snap.setPostSNDetail(demo.getClass().getSimpleName());
glWindow.addGLEventListener(snap);
-
- glWindow.setSize(width, height);
- glWindow.setVisible(true);
- demo.setSmoothPoints(false);
- snap.setMakeSnapshot();
- snap.setPostSNDetail("flat");
- glWindow.display();
+ Animator animator = new Animator(glWindow);
+ QuitAdapter quitAdapter = new QuitAdapter();
+
+ glWindow.addKeyListener(quitAdapter);
+ glWindow.addWindowListener(quitAdapter);
+
+ animator.start();
- demo.setSmoothPoints(true);
- snap.setMakeSnapshot();
- snap.setPostSNDetail("smooth");
- glWindow.display();
+ glWindow.setVisible(true);
+
+ System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
+ System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
+ System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets());
- demo.setPointParams(2f, 40f, 0.01f, 0.0f, 0.01f, 1f);
+ animator.setUpdateFPSFrames(60, System.err);
snap.setMakeSnapshot();
- snap.setPostSNDetail("attn0");
- glWindow.display();
-
- glWindow.removeGLEventListener(demo);
-
+
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
+ Thread.sleep(100);
+ }
+
+ animator.stop();
glWindow.destroy();
}
-
- protected void runTestGL(GLCapabilities caps, PointsDemo demo, boolean forceFFPEmu) throws InterruptedException {
- runTestGL0(caps, demo);
- }
@Test
- public void test01FFP__GL2() throws InterruptedException {
- if(!GLProfile.isAvailable(GLProfile.GL2)) { System.err.println("GL2 n/a"); return; }
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2));
- runTestGL(caps, new PointsDemoES1(), false);
- }
-
- @Test
- public void test02FFP__ES1() throws InterruptedException {
- if(!GLProfile.isAvailable(GLProfile.GLES1)) { System.err.println("GLES1 n/a"); return; }
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES1));
- runTestGL(caps, new PointsDemoES1(), false);
- }
-
- @Test
- public void test03FFP__ES2() throws InterruptedException {
- if(!GLProfile.isAvailable(GLProfile.GLES2)) { System.err.println("GLES2 n/a"); return; }
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
- PointsDemoES1 demo = new PointsDemoES1();
- demo.setForceFFPEmu(true, false, false, false);
- runTestGL(caps, demo, false);
+ public void test00_DefaultDevice() {
+ final AbstractGraphicsDevice defaultDevice = GLProfile.getDefaultDevice();
+ System.out.println("GLProfile "+GLProfile.glAvailabilityToString());
+ System.out.println("GLProfile.getDefaultDevice(): "+defaultDevice);
+ GLProfile glp = GLProfile.getDefault();
+ System.out.println("GLProfile.getDefault(): "+glp);
+
+ GLCapabilities caps = new GLCapabilities(glp);
+ GLWindow glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+
+ glWindow.addGLEventListener(new DumpGLInfo());
+
+ glWindow.setSize(128, 128);
+ glWindow.setVisible(true);
+
+ glWindow.display();
+ glWindow.destroy();
+
+ if( NativeWindowFactory.TYPE_X11 == NativeWindowFactory.getNativeWindowType(true) ) {
+ Assert.assertEquals("X11 Default device does not match", defaultDevice.getConnection(), x11DefaultDisplay);
+ }
}
@Test
- public void test04FFP__GL2ES2() throws InterruptedException {
- if(!GLProfile.isAvailable(GLProfile.GL2ES2)) { System.err.println("GL2ES2 n/a"); return; }
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2ES2));
- PointsDemoES1 demo = new PointsDemoES1();
- demo.setForceFFPEmu(true, false, false, false);
- runTestGL(caps, demo, false);
+ public void test01_GLDefaultRendering() throws InterruptedException {
+ GLCapabilities caps = new GLCapabilities(null);
+ runTestGL(caps);
}
- @Test
- public void test11GLSL_GL2() throws InterruptedException {
- if(!GLProfile.isAvailable(GLProfile.GL2)) { System.err.println("GL2 n/a"); return; }
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GL2));
- runTestGL(caps, new PointsDemoES2(), false);
- }
-
- @Test
- public void test12GLSL_ES2() throws InterruptedException {
- if(!GLProfile.isAvailable(GLProfile.GLES2)) { System.err.println("GLES2 n/a"); return; }
- GLCapabilities caps = new GLCapabilities(GLProfile.get(GLProfile.GLES2));
- runTestGL(caps, new PointsDemoES2(), false); // should be FFPEmu implicit
- }
-
- static int atoi(String a) {
- int i=0;
- try {
- i = Integer.parseInt(a);
- } catch (Exception ex) { ex.printStackTrace(); }
- return i;
- }
-
public static void main(String args[]) {
for(int i=0; i<args.length; i++) {
- if(args[i].equals("-x11DefaultDisplay")) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ } else if(args[i].equals("-x11DefaultDisplay")) {
x11DefaultDisplay = args[++i];
}
}