From d75a03408e4d81b911b9efd3163c456399c93123 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 23 Dec 2010 06:32:47 +0100 Subject: AMD/X11: Added AMD/X11 workaround On AMD/X11 the create/destroy sequence must be the same even though this is agains the chicken/egg logic here .. --- .../junit/jogl/acore/TestSharedContextListAWT.java | 60 ++++++++++++++++------ .../jogl/acore/TestSharedContextListNEWT.java | 9 +++- 2 files changed, 52 insertions(+), 17 deletions(-) diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java index dd3518fe3..6d9801d48 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java @@ -37,8 +37,10 @@ import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.gl2.gears.Gears; +import com.jogamp.opengl.test.junit.util.AWTRobotUtil; import java.awt.Frame; +import javax.swing.SwingUtilities; import org.junit.Assert; import org.junit.BeforeClass; @@ -76,17 +78,15 @@ public class TestSharedContextListAWT extends UITestCase { Assert.assertNotNull(sharedDrawable); sharedDrawable.destroy(); } + protected Frame createFrame(int x, int y, boolean useShared) { + return new Frame("Shared Gears AWT Test: "+x+"/"+y+" shared "+useShared); + } - protected Frame runTestGL(Animator animator, int x, int y, boolean useShared) { - Frame frame = new Frame("Shared Gears AWT Test: "+x+"/"+y+" shared "+useShared); - Assert.assertNotNull(frame); - - GLCanvas glCanvas = new GLCanvas(caps, useShared ? sharedDrawable.getContext() : null); + protected GLCanvas runTestGL(final Frame frame, final Animator animator, final int x, final int y, final boolean useShared) + throws InterruptedException + { + final GLCanvas glCanvas = new GLCanvas(caps, useShared ? sharedDrawable.getContext() : null); Assert.assertNotNull(glCanvas); - frame.add(glCanvas); - frame.setSize(width, height); - frame.setLocation(x, y); - Gears gears = new Gears(); if(useShared) { gears.setGears(sharedGears.getGear1(), sharedGears.getGear2(), sharedGears.getGear3()); @@ -95,27 +95,55 @@ public class TestSharedContextListAWT extends UITestCase { animator.add(glCanvas); - frame.setVisible(true); - - return frame; + SwingUtilities.invokeLater(new Runnable() { + public void run() { + frame.add(glCanvas); + frame.pack(); + frame.setSize(width, height); + frame.setLocation(x, y); + frame.validate(); + frame.setVisible(true); + } }); + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true)); + + return glCanvas; } @Test public void test01() throws InterruptedException { initShared(); + + Frame f1 = createFrame(0, 0, true); + Frame f2 = createFrame(width, 0, true); + Frame f3 = createFrame(0, height, false); + Animator animator = new Animator(); - Frame f1 = runTestGL(animator, 0, 0, true); - Frame f2 = runTestGL(animator, width, 0, true); - Frame f3 = runTestGL(animator, 0, height, false); + + GLCanvas glc1 = runTestGL(f1, animator, 0, 0, true); + GLCanvas glc2 = runTestGL(f2, animator, width, 0, true); + GLCanvas glc3 = runTestGL(f3, animator, 0, height, false); + animator.start(); while(animator.isAnimating() && animator.getDuration()