diff options
8 files changed, 401 insertions, 132 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 432f8f346..b7db47e11 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -478,7 +478,7 @@ function testawtswt() { #testnoawt com.jogamp.opengl.test.junit.newt.TestWindowClosingProtocol02NEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows01NEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows02NEWTAnimated $* -testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows03NEWTAnimResize $* +#testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows03NEWTAnimResize $* #testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindowInvisiblePointer01NEWT $* #testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle01NEWT #testnoawt com.jogamp.opengl.test.junit.newt.TestDisplayLifecycle02NEWT @@ -504,6 +504,7 @@ testnoawt com.jogamp.opengl.test.junit.newt.TestGLWindows03NEWTAnimResize $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03bB849AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos03cB849AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816JTabbedPanelVisibilityB849B878AWT $* +testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816GLCanvasFrameHoppingB849B889AWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04aAWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug816OSXCALayerPos04bAWT $* #testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug675BeansInDesignTimeAWT $* diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index a99737613..87966c9c6 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -124,21 +124,32 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, private boolean globalVisibility = localVisibility; private boolean visibilityPropagation = false; - private String id(Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); } + private String id(Object obj) { return "0x" + ( null!=obj ? Integer.toHexString(obj.hashCode()) : "nil" ); } + private String str(Object obj) { + if( null == obj ) { + return "null"; + } else if( obj instanceof Component ) { + final Component c = (Component)obj; + return c.getClass().getSimpleName()+"[visible "+c.isVisible()+", showing "+c.isShowing()+", valid "+c.isValid()+ + ", displayable "+c.isDisplayable()+", "+c.getX()+"/"+c.getY()+" "+c.getWidth()+"x"+c.getHeight()+"]"; + } else { + return obj.getClass().getSimpleName()+"[..]"; + } + } private String s(ComponentEvent e) { return "visible[local "+localVisibility+", global "+globalVisibility+", propag. "+visibilityPropagation+"],"+Platform.getNewline()+ - " ** COMP "+id(e.getComponent())+": "+e.getComponent()+Platform.getNewline()+ - " ** SOURCE "+id(e.getSource())+": "+e.getSource()+Platform.getNewline()+ - " ** THIS "+component; + " ** COMP "+id(e.getComponent())+": "+str(e.getComponent())+Platform.getNewline()+ + " ** SOURCE "+id(e.getSource())+": "+str(e.getSource())+Platform.getNewline()+ + " ** THIS "+id(component)+": "+str(component); } private String s(HierarchyEvent e) { return "visible[local "+localVisibility+", global "+globalVisibility+", propag. "+visibilityPropagation+"], changeBits 0x"+Long.toHexString(e.getChangeFlags())+Platform.getNewline()+ - " ** COMP "+id(e.getComponent())+": "+e.getComponent()+Platform.getNewline()+ - " ** SOURCE "+id(e.getSource())+": "+e.getSource()+Platform.getNewline()+ - " ** CHANGED "+id(e.getChanged())+": "+e.getChanged()+Platform.getNewline()+ - " ** CHANGEDPARENT "+id(e.getChangedParent())+": "+e.getChangedParent()+Platform.getNewline()+ - " ** THIS "+component; + " ** COMP "+id(e.getComponent())+": "+str(e.getComponent())+Platform.getNewline()+ + " ** SOURCE "+id(e.getSource())+": "+str(e.getSource())+Platform.getNewline()+ + " ** CHANGED "+id(e.getChanged())+": "+str(e.getChanged())+Platform.getNewline()+ + " ** CHANGEDPARENT "+id(e.getChangedParent())+": "+str(e.getChangedParent())+Platform.getNewline()+ + " ** THIS "+id(component)+": "+str(component); } @Override @@ -207,7 +218,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } else if( changed == component ) { // Update component's local visibility state if(!visibilityPropagation) { - localVisibility = showing; + localVisibility = component.isVisible(); } visibilityPropagation = false; if(DEBUG) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java new file mode 100644 index 000000000..51d00a5a1 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java @@ -0,0 +1,262 @@ +/** + * Copyright 2013 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ +package com.jogamp.opengl.test.junit.jogl.awt; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.lang.reflect.InvocationTargetException; + +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLProfile; +import javax.media.opengl.awt.GLCanvas; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +import org.junit.Assert; +import org.junit.FixMethodOrder; +import org.junit.Test; +import org.junit.runners.MethodSorters; + +import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; +import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.MiscUtils; +import com.jogamp.opengl.test.junit.util.UITestCase; + +/** + * Moving GLCanvas between 2 AWT JFrame + * <p> + * Validates bugs: + * <ul> + * <li>Bug 816: OSX CALayer Positioning Bug</li> + * <li>Bug 729: OSX CALayer shall honor the Component's visibility state</li> + * <li>Bug 849: AWT GLAutoDrawables (JAWTWindow) shall honor it's parent visibility state</li> + * <li>Bug 878: JAWTWindow's HierarchyListener doesn't set component visible (again) on 'addNotify(..)' - GLCanvas in JtabbedPane disappear</li> + * <li>Bug 889: GLCanvas disappear when moves between two JFrame</li> + * </ul> + * </p> + */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestBug816GLCanvasFrameHoppingB849B889AWT extends UITestCase { + static long durationPerTest = 500*4; // ms + static boolean manual = false; + + @Test + public void test01AllVisible() throws InterruptedException, InvocationTargetException { + test(false); + } + + @Test + public void test02VisibleWithCanvas() throws InterruptedException, InvocationTargetException { + test(true); + } + + private void test(final boolean onlyVisibleWithCanvas) throws InterruptedException, InvocationTargetException { + final JFrame frame1 = new JFrame("Bug889 #1"); + final JPanel panel1 = new javax.swing.JPanel(); + panel1.setLayout(new BorderLayout()); + panel1.setSize(new java.awt.Dimension(640, 480)); + frame1.setContentPane(panel1); + frame1.setSize(640, 480); + frame1.setLocation(64, 64); + + final JFrame frame2 = new JFrame("Bug889 #2"); + final JPanel panel2 = new javax.swing.JPanel(); + panel2.setLayout(new BorderLayout()); + panel2.setSize(new java.awt.Dimension(640, 480)); + frame2.setContentPane(panel2); + frame2.setSize(640, 480); + frame2.setLocation(800, 64); + + GLProfile profile = GLProfile.get(GLProfile.GL2ES2); + GLCapabilities glCapabilities = new GLCapabilities(profile); + final GLCanvas glCanvas = new GLCanvas(glCapabilities); + glCanvas.setSize(new java.awt.Dimension(640, 480)); + glCanvas.addGLEventListener(new GearsES2(1)); + panel1.add(glCanvas, BorderLayout.CENTER); + + JButton bMoveP1toP2 = new JButton("Move to Panel2"); + bMoveP1toP2.addActionListener(new ActionListener() { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { + System.err.println("XXXX Move P1 -> P2 - START"); + dumpGLCanvasStats(glCanvas); + panel2.add(glCanvas, BorderLayout.CENTER); + if( onlyVisibleWithCanvas ) { + frame1.setVisible(false); + frame2.setVisible(true); + frame2.toFront(); + } else { + frame1.validate(); + frame2.validate(); + } + dumpGLCanvasStats(glCanvas); + System.err.println("XXXX Move P1 -> P2 - END"); + } + }); + panel1.add(bMoveP1toP2, BorderLayout.NORTH); + + JButton bMoveP2toP1 = new JButton("Move to Panel1"); + bMoveP2toP1.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + System.err.println("XXXX Move P2 -> P1 - START"); + dumpGLCanvasStats(glCanvas); + panel1.add(glCanvas, BorderLayout.CENTER); + if( onlyVisibleWithCanvas ) { + frame2.setVisible(false); + frame1.setVisible(true); + frame1.toFront(); + } else { + frame2.validate(); + frame1.validate(); + } + dumpGLCanvasStats(glCanvas); + System.err.println("XXXX Move P2 -> P1 - END"); + } + }); + panel2.add(bMoveP2toP1, BorderLayout.NORTH); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + // frame1.pack(); + System.err.println("XXX SetVisible ON XXX GLCanvas on Panel1("+id(panel1)+")"); + if( onlyVisibleWithCanvas ) { + frame1.setVisible(true); + } else { + frame1.setVisible(true); + frame2.setVisible(true); + } + }}); + Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true)); + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true)); + dumpGLCanvasStats(glCanvas); + + if(manual) { + for(long w=durationPerTest; w>0; w-=100) { + Thread.sleep(100); + } + } else { + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + System.err.println("XXXX Add GLCanvas Panel1("+id(panel1)+" -> Panel2("+id(panel2)+") START"); + dumpGLCanvasStats(glCanvas); + panel2.add(glCanvas, BorderLayout.CENTER); + if( onlyVisibleWithCanvas ) { + frame1.setVisible(false); + frame2.setVisible(true); + frame2.toFront(); + } else { + frame1.validate(); + frame2.validate(); + } + dumpGLCanvasStats(glCanvas); + }}); + Thread.sleep(durationPerTest/4); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + System.err.println("XXXX Add GLCanvas Panel2("+id(panel2)+") -> Panel1("+id(panel1)+" START"); + dumpGLCanvasStats(glCanvas); + panel1.add(glCanvas, BorderLayout.CENTER); + if( onlyVisibleWithCanvas ) { + frame2.setVisible(false); + frame1.setVisible(true); + frame1.toFront(); + } else { + frame2.validate(); + frame1.validate(); + } + dumpGLCanvasStats(glCanvas); + }}); + Thread.sleep(durationPerTest/4); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + System.err.println("XXXX Add GLCanvas Panel1("+id(panel1)+" -> Panel2("+id(panel2)+") START"); + dumpGLCanvasStats(glCanvas); + panel2.add(glCanvas, BorderLayout.CENTER); + if( onlyVisibleWithCanvas ) { + frame1.setVisible(false); + frame2.setVisible(true); + frame2.toFront(); + } else { + frame1.validate(); + frame2.validate(); + } + dumpGLCanvasStats(glCanvas); + }}); + Thread.sleep(durationPerTest/4); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + System.err.println("XXXX Add GLCanvas Panel2("+id(panel2)+") -> Panel1("+id(panel1)+" START"); + dumpGLCanvasStats(glCanvas); + panel1.add(glCanvas, BorderLayout.CENTER); + if( onlyVisibleWithCanvas ) { + frame2.setVisible(false); + frame1.setVisible(true); + frame1.toFront(); + } else { + frame2.validate(); + frame1.validate(); + } + dumpGLCanvasStats(glCanvas); + }}); + Thread.sleep(durationPerTest/4); + } + + SwingUtilities.invokeLater(new Runnable() { + public void run() { + System.err.println("XXX SetVisible OFF XXX"); + frame1.dispose(); + frame2.dispose(); + } }); + } + + private static String id(Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); } + + static void dumpGLCanvasStats(GLCanvas glCanvas) { + System.err.println("XXXX GLCanvas: comp "+glCanvas+", visible "+glCanvas.isVisible()+", showing "+glCanvas.isShowing()+ + ", displayable "+glCanvas.isDisplayable()+", "+glCanvas.getWidth()+"x"+glCanvas.getHeight()); + } + + public static void main(String args[]) { + for(int i=0; i<args.length; i++) { + if(args[i].equals("-time")) { + durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest); + } else if(args[i].equals("-manual")) { + manual = true; + } + } + org.junit.runner.JUnitCore.main(TestBug816GLCanvasFrameHoppingB849B889AWT.class.getName()); + } + +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java index fade6c33a..5a7c5c9eb 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import javax.media.opengl.*; @@ -78,10 +78,10 @@ import org.junit.runners.MethodSorters; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestBug816OSXCALayerPos01AWT extends UITestCase { public enum FrameLayout { None, Flow, DoubleBorderCenterSurrounded, Box, Split }; - - static long duration = 1600; // ms + + static long duration = 1600; // ms static int width, height; - + static boolean forceES2 = false; static boolean forceGL3 = false; static int swapInterval = 1; @@ -110,14 +110,14 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { comp2.setPreferredSize(new_sz2); comp2.setSize(new_sz2); } - if( null != frame ) { + if( null != frame ) { frame.pack(); } } } ); } catch( Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); - } + } } static void setFrameSize(final Frame frame, final boolean frameLayout, final java.awt.Dimension new_sz) { try { @@ -131,9 +131,9 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { } catch( Throwable throwable ) { throwable.printStackTrace(); Assume.assumeNoException( throwable ); - } + } } - + protected void runTestGL(GLCapabilities caps, FrameLayout frameLayout, final boolean twoCanvas, final boolean resizeByComp) throws InterruptedException, InvocationTargetException { final JFrame frame = new JFrame("Bug816: "+this.getTestMethodName()); Assert.assertNotNull(frame); @@ -148,12 +148,12 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { } else { glCanvas2 = null; } - + final Dimension glcDim = new Dimension(width/2, height); final Dimension frameDim = new Dimension(twoCanvas ? width + 64: width/2 + 64, height + 64); - + setComponentSize(null, glCanvas1, glcDim, glCanvas2, glcDim); - + switch( frameLayout) { case None: { framePane.add(glCanvas1); @@ -227,11 +227,11 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { model.setExtent(1); hsb.setEnabled(true); } - JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, + JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, twoCanvas ? glCanvas2 : vsp, glCanvas1 ); horizontalSplitPane.setResizeWeight(0.5); - JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, - true, horizontalSplitPane, hsp); + JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + true, horizontalSplitPane, hsp); verticalSplitPane.setResizeWeight(0.5); framePane.add(verticalSplitPane); } @@ -243,7 +243,7 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { final RedSquareES2 demo2 = new RedSquareES2(swapInterval); glCanvas2.addGLEventListener(demo2); } - + final Animator animator = new Animator(); animator.add(glCanvas1); if( twoCanvas ) { @@ -261,18 +261,17 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { setFrameSize(frame, true, frameDim); } frame.setVisible(true); - }}); + }}); Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); - Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); if( twoCanvas ) { Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas2, true)); } - + animator.start(); Assert.assertTrue(animator.isStarted()); Assert.assertTrue(animator.isAnimating()); - animator.setUpdateFPSFrames(60, System.err); - + System.err.println("canvas1 pos/siz: "+glCanvas1.getX()+"/"+glCanvas1.getY()+" "+glCanvas1.getWidth()+"x"+glCanvas1.getHeight()); if( twoCanvas ) { System.err.println("canvas2 pos/siz: "+glCanvas2.getX()+"/"+glCanvas2.getY()+" "+glCanvas2.getWidth()+"x"+glCanvas2.getHeight()); @@ -290,7 +289,7 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { if( twoCanvas ) { System.err.println("resize canvas2 pos/siz: "+glCanvas2.getX()+"/"+glCanvas2.getY()+" "+glCanvas2.getWidth()+"x"+glCanvas2.getHeight()); } - + final long t0 = System.currentTimeMillis(); long t1 = t0; while(!quitAdapter.shouldQuit() && t1 - t0 < duration) { @@ -305,7 +304,7 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { } else { Assert.assertNull(glCanvas2); } - + Assert.assertNotNull(animator); animator.stop(); Assert.assertFalse(animator.isAnimating()); @@ -329,14 +328,14 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { static GLProfile getGLP() { return GLProfile.getMaxProgrammableCore(true); } - + @Test public void test00_Compo_None_One() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 0 ) { return ; } final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.None, false /* twoCanvas */, true /* resizeByComp */); } - + @Test public void test01_Compo_Flow_One() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 1 ) { return ; } @@ -350,21 +349,21 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, false /* twoCanvas */, true /* resizeByComp */); } - + @Test public void test03_Compo_Box_One() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 3 ) { return ; } final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.Box, false /* twoCanvas */, true /* resizeByComp */); } - + @Test public void test04_Compo_Split_One() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 4 ) { return ; } final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.Split, false /* twoCanvas */, true /* resizeByComp */); } - + @Test public void test05_Compo_Flow_Two() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 5 ) { return ; } @@ -378,28 +377,28 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, true/* twoCanvas */, true /* resizeByComp */); } - + @Test public void test07_Compo_Box_Two() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 7 ) { return ; } final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.Box, true/* twoCanvas */, true /* resizeByComp */); } - + @Test public void test08_Compo_Split_Two() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 8 ) { return ; } final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.Split, true/* twoCanvas */, true /* resizeByComp */); } - + @Test public void test10_Frame_None_One() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 10 ) { return ; } final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.None, false /* twoCanvas */, false /* resizeByComp */); } - + @Test public void test11_Frame_Flow_One() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 11 ) { return ; } @@ -413,21 +412,21 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, false /* twoCanvas */, false /* resizeByComp */); } - + @Test public void test13_Frame_Box_One() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 13 ) { return ; } final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.Box, false /* twoCanvas */, false /* resizeByComp */); } - + @Test public void test14_Frame_Split_One() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 14) { return ; } final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.Split, false /* twoCanvas */, false /* resizeByComp */); } - + @Test public void test15_Frame_Flow_Two() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 15 ) { return ; } @@ -441,23 +440,23 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.DoubleBorderCenterSurrounded, true/* twoCanvas */, false /* resizeByComp */); } - + @Test public void test17_Frame_Box_Two() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 17 ) { return ; } final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.Box, true/* twoCanvas */, false /* resizeByComp */); } - + @Test public void test18_Frame_Split_Two() throws InterruptedException, InvocationTargetException { if( testNum != -1 && testNum != 18 ) { return ; } final GLCapabilities caps = new GLCapabilities(getGLP()); runTestGL(caps, FrameLayout.Split, true/* twoCanvas */, false /* resizeByComp */); } - + static int testNum = -1; - + public static void main(String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { @@ -475,12 +474,12 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { swapInterval = MiscUtils.atoi(args[i], swapInterval); } } - + System.err.println("resize "+rwsize); System.err.println("forceES2 "+forceES2); System.err.println("forceGL3 "+forceGL3); System.err.println("swapInterval "+swapInterval); - + org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos01AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java index 073956459..df24fc6e0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import javax.media.opengl.*; @@ -64,32 +64,32 @@ import org.junit.runners.MethodSorters; */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestBug816OSXCALayerPos02AWT extends UITestCase { - static long duration = 1600; // ms + static long duration = 1600; // ms static int width=640, height=480; - + @Test public void test() throws InterruptedException, InvocationTargetException { final GLCapabilities caps = new GLCapabilities(getGLP()); - + final JFrame frame = new JFrame("TestBug816OSXCALayerPos02AWT"); Assert.assertNotNull(frame); final GLCanvas glCanvas1 = new GLCanvas(caps); Assert.assertNotNull(glCanvas1); glCanvas1.addGLEventListener(new GearsES2(1)); - + final Animator animator = new Animator(); animator.add(glCanvas1); QuitAdapter quitAdapter = new QuitAdapter(); - + new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); - // Build a GUI where the canvas 3D is located at top right of the frame + // Build a GUI where the canvas 3D is located at top right of the frame // and can be resized with split panes dividers - JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, - true, new JScrollPane(), glCanvas1); + JSplitPane verticalSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, + true, new JScrollPane(), glCanvas1); verticalSplitPane.setResizeWeight(0.5); - JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, + JSplitPane horizontalSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, new JScrollPane(), verticalSplitPane); horizontalSplitPane.setResizeWeight(0.5); JRootPane intermediateRootPane = new JRootPane(); @@ -100,15 +100,14 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase { public void run() { frame.setSize(width, height); frame.setVisible(true); - }}); + }}); Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); - Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); - + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); + animator.start(); Assert.assertTrue(animator.isStarted()); Assert.assertTrue(animator.isAnimating()); - animator.setUpdateFPSFrames(60, System.err); - + final long t0 = System.currentTimeMillis(); long t1 = t0; while(!quitAdapter.shouldQuit() && t1 - t0 < duration) { @@ -118,7 +117,7 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase { Assert.assertNotNull(frame); Assert.assertNotNull(glCanvas1); - + Assert.assertNotNull(animator); animator.stop(); Assert.assertFalse(animator.isAnimating()); @@ -139,7 +138,7 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase { static GLProfile getGLP() { return GLProfile.getMaxProgrammableCore(true); } - + public static void main(String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { @@ -147,7 +146,7 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase { duration = MiscUtils.atol(args[i], duration); } } - + org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos02AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java index 7df6d0427..e1a0944e1 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import java.awt.BorderLayout; @@ -71,24 +71,24 @@ import com.jogamp.opengl.util.Animator; */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase { - static long duration = 1600; // ms + static long duration = 1600; // ms static int width=640, height=480; - + @Test public void test() throws InterruptedException, InvocationTargetException { final GLCapabilities caps = new GLCapabilities(getGLP()); - + final Frame frame = new Frame("TestBug816OSXCALayerPos03aAWT"); Assert.assertNotNull(frame); final GLCanvas glCanvas1 = new GLCanvas(caps); Assert.assertNotNull(glCanvas1); glCanvas1.addGLEventListener(new GearsES2(1)); - + final Animator animator = new Animator(); animator.add(glCanvas1); QuitAdapter quitAdapter = new QuitAdapter(); - + new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); // Create a check box that hides / shows canvas @@ -112,15 +112,14 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase { public void run() { frame.setSize(width, height); frame.setVisible(true); - }}); + }}); Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); - Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); - + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); + animator.start(); Assert.assertTrue(animator.isStarted()); Assert.assertTrue(animator.isAnimating()); - animator.setUpdateFPSFrames(60, System.err); - + final long t0 = System.currentTimeMillis(); long t1 = t0; while(!quitAdapter.shouldQuit() && t1 - t0 < duration) { @@ -130,7 +129,7 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase { Assert.assertNotNull(frame); Assert.assertNotNull(glCanvas1); - + Assert.assertNotNull(animator); animator.stop(); Assert.assertFalse(animator.isAnimating()); @@ -151,7 +150,7 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase { static GLProfile getGLP() { return GLProfile.getMaxProgrammableCore(true); } - + public static void main(String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { @@ -159,7 +158,7 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase { duration = MiscUtils.atol(args[i], duration); } } - + org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos03aB729AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java index 210113d28..b9ee6a4f6 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import java.awt.BorderLayout; @@ -74,13 +74,13 @@ import com.jogamp.opengl.util.Animator; */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase { - static long duration = 1600; // ms + static long duration = 1600; // ms static int width=640, height=480; - + @Test public void test() throws InterruptedException, InvocationTargetException { final GLCapabilities caps = new GLCapabilities(getGLP()); - + final Frame frame = new Frame("TestBug816OSXCALayerPos03bAWT"); Assert.assertNotNull(frame); @@ -90,11 +90,11 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase { // Put it in a panel final Panel panel = new Panel(new GridLayout(1, 1)); panel.add(glCanvas1); - + final Animator animator = new Animator(); animator.add(glCanvas1); QuitAdapter quitAdapter = new QuitAdapter(); - + new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); // Create a check box that hides / shows canvas @@ -118,15 +118,14 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase { public void run() { frame.setSize(width, height); frame.setVisible(true); - }}); + }}); Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); - Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); - + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); + animator.start(); Assert.assertTrue(animator.isStarted()); Assert.assertTrue(animator.isAnimating()); - animator.setUpdateFPSFrames(60, System.err); - + final long t0 = System.currentTimeMillis(); long t1 = t0; while(!quitAdapter.shouldQuit() && t1 - t0 < duration) { @@ -136,7 +135,7 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase { Assert.assertNotNull(frame); Assert.assertNotNull(glCanvas1); - + Assert.assertNotNull(animator); animator.stop(); Assert.assertFalse(animator.isAnimating()); @@ -157,7 +156,7 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase { static GLProfile getGLP() { return GLProfile.getMaxProgrammableCore(true); } - + public static void main(String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { @@ -165,7 +164,7 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase { duration = MiscUtils.atol(args[i], duration); } } - + org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos03bB849AWT.class.getName()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java index 54d20b729..9a536d50c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java @@ -3,14 +3,14 @@ * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: - * + * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. - * + * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR @@ -20,12 +20,12 @@ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * + * * The views and conclusions contained in the software and documentation are those of the * authors and should not be interpreted as representing official policies, either expressed * or implied, of JogAmp Community. */ - + package com.jogamp.opengl.test.junit.jogl.awt; import java.awt.BorderLayout; @@ -75,28 +75,28 @@ import com.jogamp.opengl.util.Animator; */ @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase { - static long duration = 1600; // ms + static long duration = 1600; // ms static int width=640, height=480; - + @Test public void test() throws InterruptedException, InvocationTargetException { final GLCapabilities caps = new GLCapabilities(getGLP()); - + final JFrame frame = new JFrame("TestBug816OSXCALayerPos03cAWT"); Assert.assertNotNull(frame); final Container framePane = frame.getContentPane(); - + final GLCanvas glCanvas1 = new GLCanvas(caps); Assert.assertNotNull(glCanvas1); glCanvas1.addGLEventListener(new GearsES2(1)); // Put it in a panel final JPanel panel = new JPanel(new GridLayout(1, 1)); panel.add(glCanvas1); - + final Animator animator = new Animator(); animator.add(glCanvas1); QuitAdapter quitAdapter = new QuitAdapter(); - + new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); // Create a check box that hides / shows canvas @@ -120,15 +120,14 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase { public void run() { frame.setSize(width, height); frame.setVisible(true); - }}); + }}); Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); - Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); - + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); + animator.start(); Assert.assertTrue(animator.isStarted()); Assert.assertTrue(animator.isAnimating()); - animator.setUpdateFPSFrames(60, System.err); - + final long t0 = System.currentTimeMillis(); long t1 = t0; while(!quitAdapter.shouldQuit() && t1 - t0 < duration) { @@ -138,7 +137,7 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase { Assert.assertNotNull(frame); Assert.assertNotNull(glCanvas1); - + Assert.assertNotNull(animator); animator.stop(); Assert.assertFalse(animator.isAnimating()); @@ -159,7 +158,7 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase { static GLProfile getGLP() { return GLProfile.getMaxProgrammableCore(true); } - + public static void main(String args[]) { for(int i=0; i<args.length; i++) { if(args[i].equals("-time")) { @@ -167,7 +166,7 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase { duration = MiscUtils.atol(args[i], duration); } } - + org.junit.runner.JUnitCore.main(TestBug816OSXCALayerPos03cB849AWT.class.getName()); } } |