From af097fb2d5d983eb703d01f56e471a64d5d2657c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 13 Jun 2013 12:16:01 +0200 Subject: TestX11DefaultDisplay: Validate the chosen default device, test only one GLDefault/RedSquareES1; Tested w/ Xvnc4 + build-in Mesa 4.0.4 --- .../junit/jogl/acore/TestX11DefaultDisplay.java | 136 +++++++++------------ 1 file changed, 61 insertions(+), 75 deletions(-) (limited to 'src') 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()