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 --- make/scripts/tests.sh | 10 +- .../junit/jogl/acore/TestX11DefaultDisplay.java | 136 +++++++++------------ 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()