diff options
Diffstat (limited to 'src/test/com/jogamp/opengl')
4 files changed, 85 insertions, 28 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java index 48c3c89b3..c2eebbfd8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove01GLCanvasSwingAWT.java @@ -55,13 +55,14 @@ import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { - static long durationPerTest = 50; + static long durationPerTest = 100; static int addRemoveCount = 15; static int pauseEach = 0; static int pauseDuration = 500; static boolean noOnscreenTest = false; static boolean noOffscreenTest = false; - static boolean shallUseOffscreenPBufferLayer = false; + static boolean offscreenPBufferOnly = false; + static boolean offscreenFBOOnly = false; static GLProfile glp; static int width, height; static boolean waitForKey = false; @@ -143,6 +144,9 @@ public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { throws AWTException, InterruptedException, InvocationTargetException { + if(waitForKey) { + UITestCase.waitForKey("Start"); + } for(int i=0; i<addRemoveOpCount; i++) { System.err.println("Loop # "+i+" / "+addRemoveCount); final GLCanvas glc = new GLCanvas(caps); @@ -195,29 +199,47 @@ public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { return; } GLCapabilities caps = new GLCapabilities(glp); - if(shallUseOffscreenPBufferLayer) { - caps.setPBuffer(true); - caps.setOnscreen(true); // simulate normal behavior .. - } runTestGL(true, caps, addRemoveCount); } @Test - public void test02Offscreen() + public void test02OffscreenFBO() throws AWTException, InterruptedException, InvocationTargetException { if( noOffscreenTest || !JAWTUtil.isOffscreenLayerSupported() ) { System.err.println("No offscreen test requested or platform doesn't support offscreen rendering."); return; } + if( offscreenPBufferOnly ) { + System.err.println("Only PBuffer test is requested."); + return; + } GLCapabilities caps = new GLCapabilities(glp); - if(shallUseOffscreenPBufferLayer) { + if(offscreenPBufferOnly) { caps.setPBuffer(true); caps.setOnscreen(true); // simulate normal behavior .. } runTestGL(false, caps, addRemoveCount); } + @Test + public void test03OffscreenPBuffer() + throws AWTException, InterruptedException, InvocationTargetException + { + if( noOffscreenTest || !JAWTUtil.isOffscreenLayerSupported() ) { + System.err.println("No offscreen test requested or platform doesn't support offscreen rendering."); + return; + } + if( offscreenFBOOnly ) { + System.err.println("Only FBO test is requested."); + return; + } + GLCapabilities caps = new GLCapabilities(glp); + caps.setPBuffer(true); + caps.setOnscreen(true); // simulate normal behavior .. + runTestGL(false, caps, addRemoveCount); + } + public static void main(String args[]) throws IOException { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { @@ -238,8 +260,10 @@ public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { noOnscreenTest = true; } else if(args[i].equals("-noOffscreen")) { noOffscreenTest = true; + } else if(args[i].equals("-layeredFBO")) { + offscreenFBOOnly = true; } else if(args[i].equals("-layeredPBuffer")) { - shallUseOffscreenPBufferLayer = true; + offscreenPBufferOnly = true; } else if(args[i].equals("-wait")) { waitForKey = true; } else if(args[i].equals("-waitPost")) { @@ -247,6 +271,7 @@ public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { } } System.err.println("waitForKey "+waitForKey); + System.err.println("waitForKeyPost "+waitForKeyPost); System.err.println("addRemoveCount "+addRemoveCount); System.err.println("pauseEach "+pauseEach); @@ -254,10 +279,9 @@ public class TestAddRemove01GLCanvasSwingAWT extends UITestCase { System.err.println("noOnscreenTest "+noOnscreenTest); System.err.println("noOffscreenTest "+noOffscreenTest); - System.err.println("shallUseOffscreenPBufferLayer "+shallUseOffscreenPBufferLayer); - if(waitForKey) { - UITestCase.waitForKey("Start"); - } - org.junit.runner.JUnitCore.main(TestAddRemove01GLCanvasSwingAWT.class.getName()); + System.err.println("offscreenPBufferOnly "+offscreenPBufferOnly); + System.err.println("offscreenFBOOnly "+offscreenFBOOnly); + + org.junit.runner.JUnitCore.main(TestAddRemove01GLCanvasSwingAWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java index ce88abfba..8b447485c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestAddRemove02GLWindowNewtCanvasAWT.java @@ -63,10 +63,12 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { static int pauseDuration = 500; static boolean noOnscreenTest = false; static boolean noOffscreenTest = false; - static boolean shallUseOffscreenPBufferLayer = false; + static boolean offscreenPBufferOnly = false; + static boolean offscreenFBOOnly = false; static GLProfile glp; static int width, height; static boolean waitForKey = false; + static boolean waitForKeyPost = false; @BeforeClass public static void initClass() { @@ -183,6 +185,9 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { Thread.sleep(pauseDuration); } } + if(waitForKeyPost) { + UITestCase.waitForKey("End"); + } } @Test @@ -194,26 +199,40 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { return; } GLCapabilities caps = new GLCapabilities(glp); - if(shallUseOffscreenPBufferLayer) { - caps.setPBuffer(true); - caps.setOnscreen(true); // simulate normal behavior .. - } runTestGL(true, caps, addRemoveCount); } @Test - public void test02Offscreen() + public void test02OffscreenFBO() throws AWTException, InterruptedException, InvocationTargetException { if( noOffscreenTest || !JAWTUtil.isOffscreenLayerSupported() ) { System.err.println("No offscreen test requested or platform doesn't support offscreen rendering."); return; } + if( offscreenPBufferOnly ) { + System.err.println("Only PBuffer test is requested."); + return; + } GLCapabilities caps = new GLCapabilities(glp); - if(shallUseOffscreenPBufferLayer) { - caps.setPBuffer(true); - caps.setOnscreen(true); // simulate normal behavior .. + runTestGL(false, caps, addRemoveCount); + } + + @Test + public void test03OffscreenPBuffer() + throws AWTException, InterruptedException, InvocationTargetException + { + if( noOffscreenTest || !JAWTUtil.isOffscreenLayerSupported() ) { + System.err.println("No offscreen test requested or platform doesn't support offscreen rendering."); + return; } + if( offscreenFBOOnly ) { + System.err.println("Only FBO test is requested."); + return; + } + GLCapabilities caps = new GLCapabilities(glp); + caps.setPBuffer(true); + caps.setOnscreen(true); // simulate normal behavior .. runTestGL(false, caps, addRemoveCount); } @@ -237,13 +256,18 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { noOnscreenTest = true; } else if(args[i].equals("-noOffscreen")) { noOffscreenTest = true; + } else if(args[i].equals("-layeredFBO")) { + offscreenFBOOnly = true; } else if(args[i].equals("-layeredPBuffer")) { - shallUseOffscreenPBufferLayer = true; + offscreenPBufferOnly = true; } else if(args[i].equals("-wait")) { waitForKey = true; + } else if(args[i].equals("-waitPost")) { + waitForKeyPost = true; } } System.err.println("waitForKey "+waitForKey); + System.err.println("waitForKeyPost "+waitForKeyPost); System.err.println("addRemoveCount "+addRemoveCount); System.err.println("pauseEach "+pauseEach); @@ -251,7 +275,8 @@ public class TestAddRemove02GLWindowNewtCanvasAWT extends UITestCase { System.err.println("noOnscreenTest "+noOnscreenTest); System.err.println("noOffscreenTest "+noOffscreenTest); - System.err.println("shallUseOffscreenPBufferLayer "+shallUseOffscreenPBufferLayer); + System.err.println("offscreenPBufferOnly "+offscreenPBufferOnly); + System.err.println("offscreenFBOOnly "+offscreenFBOOnly); if(waitForKey) { UITestCase.waitForKey("Start"); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java index a6b3eb85d..d8a2e7810 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java @@ -155,7 +155,7 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { colorPanel.setBackground(Color.white); colorPanel.repaint(); }}); - + robot = new Robot(); robot.setAutoWaitForIdle(true); @@ -210,6 +210,8 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { AWTRobotUtil.toFrontAndRequestFocus(robot, frame); + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(drawable, true)); + drawable.addGLEventListener(new GearsES2()); for(int i=0; i<100; i++) { @@ -262,6 +264,8 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { GLWindow win0 = GLWindow.create(caps); win0.setSize(100,100); win0.setVisible(true); + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(win0, true)); + Screen screen = win0.getScreen(); win0.setPosition(screen.getWidth()-150, 0); win0.addGLEventListener(new GearsES2()); @@ -274,6 +278,7 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { runTestGL(newtCanvasAWT, win1); win0.destroy(); + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(win0, false)); Assert.assertEquals(false, win0.isNativeValid()); Assert.assertEquals(true, anim.isAnimating()); // due to newtCanvasAWT/win1 @@ -313,8 +318,7 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { GLCanvas glCanvas = new GLCanvas(caps); anim.add(glCanvas); runTestGL(glCanvas, glCanvas); - - Assert.assertEquals(true, anim.isAnimating()); + anim.remove(glCanvas); Assert.assertEquals(false, anim.isAnimating()); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java index b0e58b5ec..0af42ec03 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java @@ -159,6 +159,8 @@ public class TestParenting04AWT extends UITestCase { } canvas1.setNEWTChild(glWindow2); // put g2 -> w1. free g1 of w1 canvas2.setNEWTChild(glWindow1); // put g1 -> w2 + frame1.invalidate(); + frame2.invalidate(); frame1.validate(); frame2.validate(); } @@ -176,6 +178,8 @@ public class TestParenting04AWT extends UITestCase { } canvas1.setNEWTChild(glWindow1); canvas2.setNEWTChild(glWindow2); + frame1.invalidate(); + frame2.invalidate(); frame1.validate(); frame2.validate(); } |