aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-12-11 05:23:31 +0100
committerSven Gothel <[email protected]>2013-12-11 05:23:31 +0100
commita00406f289ebaaae8d91e9ccc980829f202421a8 (patch)
tree1545d8a962a317b8de0bd37af39b0e5679b0334c
parent4fa4a60a8e536ab7270df1d74503dba9a945bb20 (diff)
Bug 922 (1/2): NEWT Window.reparentWindow(..): Provide REPARENT_HINT_BECOMES_VISIBLE hint via new method variant using hints; Deprecate other reparentWindow(..) variants w/o hints.
NEWT Window.reparentWindow(..): Provide REPARENT_HINT_BECOMES_VISIBLE hint via new method variant using hints: - Add REPARENT_HINT_FORCE_RECREATION, covering 'old' forceDestroyCreate boolean argument - Add REPARENT_HINT_BECOMES_VISIBLE, Claim window becomes visible after reparenting, which is important for e.g. preserving the GL-states in case window is invisible while reparenting. Deprecate other reparentWindow(..) variants w/o hints. Use only new variant using hints w/o semantical change.
-rw-r--r--make/scripts/tests.sh6
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java25
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java5
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java55
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java28
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java64
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java66
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java30
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java24
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java20
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java30
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java4
15 files changed, 206 insertions, 163 deletions
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 6cf493de2..9b7d43453 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -147,10 +147,8 @@ function jrun() {
#D_ARGS="-Djogl.debug.GLMediaPlayer.Native"
#D_ARGS="-Djogl.debug.AudioSink"
#D_ARGS="-Djogl.debug.GLArrayData"
- #D_ARGS="-Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.EGLDisplayUtil -Dnativewindow.debug.GraphicsConfiguration -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.EGLDisplayUtil -Dnativewindow.debug.X11Util"
- #D_ARGS="-Djogl.debug.GLDrawable"
#D_ARGS="-Dnewt.debug.Screen -Dnewt.debug.Window"
#D_ARGS="-Dnewt.debug.Screen"
#D_ARGS="-Dnewt.test.Screen.disableRandR13"
@@ -163,7 +161,6 @@ function jrun() {
#D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Animator -Djogl.debug.GLDrawable -Djogl.debug.GLContext -Djogl.debug.GLContext.TraceSwitch"
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.ExtensionAvailabilityCache"
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable -Djogl.debug.EGLDisplayUtil"
- #D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile -Djogl.debug.GLDrawable"
#D_ARGS="-Djogl.debug.GLContext -Djogl.debug.GLProfile"
#D_ARGS="-Djogl.debug.GLProfile"
#D_ARGS="-Dnativewindow.debug.NativeWindow -Dnewt.debug.Window -Dnewt.debug.Screen -Dnewt.debug.Display"
@@ -414,7 +411,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOAutoDrawableDeadlockAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestPBufferDeadlockAWT $*
-testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.x11.TestGLXCallsOnAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.acore.TestFBOOffThreadSharedContextMix2DemosES2NEWT $*
@@ -611,6 +608,7 @@ testawt com.jogamp.opengl.test.junit.jogl.acore.TestShutdownCompleteAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01aAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01bAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01cAWT $*
+testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting01dAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting02AWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParenting04AWT $*
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 869b56331..5c3bb7889 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -353,6 +353,11 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
ACTION_NATIVE_CREATION_PENDING;
}
+ /** Reparenting hint (bitfield value): Force destroy and hence {@link ReparentOperation#ACTION_NATIVE_CREATION re-creating} the window. */
+ public static final int REPARENT_HINT_FORCE_RECREATION = 1 << 0;
+ /** Reparenting hint (bitfield value): Claim window becomes visible after reparenting, which is important for e.g. preserving the GL-states in case window is invisible while reparenting. */
+ public static final int REPARENT_HINT_BECOMES_VISIBLE = 1 << 1;
+
/**
* Change this window's parent window.<br>
* <P>
@@ -365,6 +370,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
*
* @return The issued reparent action type (strategy) as defined in Window.ReparentAction
* @see #reparentWindow(NativeWindow, int, int, boolean)
+ * @deprecated Use {@link #reparentWindow(NativeWindow, int, int, int)}
*/
ReparentOperation reparentWindow(NativeWindow newParent);
@@ -382,11 +388,28 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* @param forceDestroyCreate if true, uses re-creation strategy for reparenting, default is <code>false</code>.
*
* @return The issued reparent action type (strategy) as defined in Window.ReparentAction
- * @see #reparentWindow(NativeWindow)
+ * @deprecated Use {@link #reparentWindow(NativeWindow, int, int, int)}
*/
ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, boolean forceDestroyCreate);
/**
+ * Change this window's parent window.<br>
+ * <P>
+ * In case the old parent is not null and a Window,
+ * this window is removed from it's list of children.<br>
+ * In case the new parent is not null and a Window,
+ * this window is added to it's list of children.<br></P>
+ *
+ * @param newParent The new parent NativeWindow. If null, this Window becomes a top level window.
+ * @param x new top-level position, use -1 for default position.
+ * @param y new top-level position, use -1 for default position.
+ * @param hints May contain hints (bitfield values) like {@link #REPARENT_HINT_FORCE_RECREATION} or {@link #REPARENT_HINT_BECOMES_VISIBLE}.
+ *
+ * @return The issued reparent action type (strategy) as defined in Window.ReparentAction
+ */
+ ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, int hints);
+
+ /**
* Enable or disable fullscreen mode for this window.
* <p>
* Fullscreen mode is established on the {@link #getMainMonitor() main monitor}.
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 52f19f783..208602aa1 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -397,6 +397,11 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
@Override
+ public final ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, int hints) {
+ return window.reparentWindow(newParent, x, y, hints);
+ }
+
+ @Override
public final boolean removeChild(NativeWindow win) {
return window.removeChild(win);
}
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index 21343b263..ae4cb9924 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1186,14 +1186,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private class ReparentAction implements Runnable {
final NativeWindow newParentWindow;
final int topLevelX, topLevelY;
- boolean forceDestroyCreate;
+ final int hints;
ReparentOperation operation;
- private ReparentAction(NativeWindow newParentWindow, int topLevelX, int topLevelY, boolean forceDestroyCreate) {
+ private ReparentAction(NativeWindow newParentWindow, int topLevelX, int topLevelY, int hints) {
this.newParentWindow = newParentWindow;
this.topLevelX = topLevelX;
this.topLevelY = topLevelY;
- this.forceDestroyCreate = forceDestroyCreate | DEBUG_TEST_REPARENT_INCOMPATIBLE;
+ if( DEBUG_TEST_REPARENT_INCOMPATIBLE ) {
+ hints |= REPARENT_HINT_FORCE_RECREATION;
+ }
+ this.hints = hints;
this.operation = ReparentOperation.ACTION_INVALID; // ensure it's set
}
@@ -1227,17 +1230,25 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final int x, y;
int width = oldWidth;
int height = oldHeight;
- boolean wasVisible;
+
+ final boolean wasVisible;
+ final boolean becomesVisible;
+ final boolean forceDestroyCreate;
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
- if(isNativeValid()) {
- // force recreation if offscreen, since it may become onscreen
- forceDestroyCreate |= isOffscreenInstance(WindowImpl.this, newParentWindow);
+ {
+ boolean v = 0 != ( REPARENT_HINT_FORCE_RECREATION & hints );
+ if(isNativeValid()) {
+ // force recreation if offscreen, since it may become onscreen
+ v |= isOffscreenInstance(WindowImpl.this, newParentWindow);
+ }
+ forceDestroyCreate = v;
}
wasVisible = isVisible();
+ becomesVisible = wasVisible || 0 != ( REPARENT_HINT_BECOMES_VISIBLE & hints );
Window newParentWindowNEWT = null;
if(newParentWindow instanceof Window) {
@@ -1246,8 +1257,15 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
long newParentWindowHandle = 0 ;
- if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.reparent: START ("+getThreadName()+") valid "+isNativeValid()+", windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+", visible "+wasVisible+", old parentWindow: "+Display.hashCodeNullSafe(parentWindow)+", new parentWindow: "+Display.hashCodeNullSafe(newParentWindow)+", forceDestroyCreate "+forceDestroyCreate);
+ if( DEBUG_IMPLEMENTATION) {
+ System.err.println("Window.reparent: START ("+getThreadName()+") valid "+isNativeValid()+
+ ", windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+
+ ", visible "+wasVisible+", becomesVisible "+becomesVisible+
+ ", forceDestroyCreate "+forceDestroyCreate+
+ ", HINT_FORCE_RECREATION "+( 0 != ( REPARENT_HINT_FORCE_RECREATION & hints ) )+
+ ", HINT_BECOMES_VISIBLE "+( 0 != ( REPARENT_HINT_BECOMES_VISIBLE & hints ) ) +
+ ", old parentWindow: "+Display.hashCodeNullSafe(parentWindow)+
+ ", new parentWindow: "+Display.hashCodeNullSafe(newParentWindow) );
}
if(null!=newParentWindow) {
@@ -1274,7 +1292,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
// Destroy this window and use parent's Screen.
// It may be created properly when the parent is made visible.
- destroy( false );
+ destroy( becomesVisible );
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
operation = ReparentOperation.ACTION_NATIVE_CREATION_PENDING;
} else if(newParentWindow != getParent()) {
@@ -1298,7 +1316,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
} else if ( forceDestroyCreate || !NewtFactory.isScreenCompatible(newParentWindow, screen) ) {
// Destroy this window, may create a new compatible Screen/Display, while trying to preserve resources if becoming visible again.
- destroy( wasVisible );
+ destroy( becomesVisible );
if(null!=newParentWindowNEWT) {
setScreen( (ScreenImpl) newParentWindowNEWT.getScreen() );
} else {
@@ -1336,7 +1354,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
} else if( !isNativeValid() || forceDestroyCreate ) {
// Destroy this window and mark it for [pending] creation.
// If isNativeValid() and becoming visible again - try to preserve resources, i.e. b/c on-/offscreen switch.
- destroy( isNativeValid() && wasVisible );
+ destroy( becomesVisible );
if( 0 < width && 0 < height ) {
operation = ReparentOperation.ACTION_NATIVE_CREATION;
} else {
@@ -1437,7 +1455,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.reparent: native reparenting failed ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)+" -> "+toHexString(newParentWindowHandle)+" - Trying recreation");
}
- destroy( wasVisible );
+ destroy( becomesVisible );
operation = ReparentOperation.ACTION_NATIVE_CREATION ;
}
} else {
@@ -1500,12 +1518,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final ReparentOperation reparentWindow(NativeWindow newParent) {
- return reparentWindow(newParent, -1, -1, false);
+ return reparentWindow(newParent, -1, -1, 0);
}
@Override
public ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, boolean forceDestroyCreate) {
- final ReparentAction reparentAction = new ReparentAction(newParent, x, y, forceDestroyCreate);
+ return reparentWindow(newParent, x, y, forceDestroyCreate ? REPARENT_HINT_FORCE_RECREATION : 0);
+ }
+
+ @Override
+ public ReparentOperation reparentWindow(NativeWindow newParent, int x, int y, int hints) {
+ final ReparentAction reparentAction = new ReparentAction(newParent, x, y, hints);
runOnEDTIfAvail(true, reparentAction);
return reparentAction.getOp();
}
@@ -2161,7 +2184,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
fullscreenMonitors = monitors;
fullscreenUseMainMonitor = useMainMonitor;
if( fullScreenAction.init(fullscreen) ) {
- if(fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow)) {
+ if( fullScreenAction.fsOn() && isOffscreenInstance(WindowImpl.this, parentWindow) ) {
// enable fullscreen on offscreen instance
if(null != parentWindow) {
nfs_parent = parentWindow;
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
index 4bf1f95c3..f7fbc7332 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.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,7 +20,7 @@
* 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.
@@ -42,24 +42,24 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
final NewtCanvasAWT newtCanvasAWT;
final GLWindow glWindow;
final QuitAdapter quitAdapter;
-
+
public NewtAWTReparentingKeyAdapter(Frame frame, NewtCanvasAWT newtCanvasAWT, GLWindow glWindow, QuitAdapter quitAdapter) {
this.frame = frame;
this.newtCanvasAWT = newtCanvasAWT;
this.glWindow = glWindow;
this.quitAdapter = quitAdapter;
}
-
+
public void keyReleased(KeyEvent e) {
if( !e.isPrintableKey() || e.isAutoRepeat() ) {
return;
- }
+ }
if( e.getKeySymbol() == KeyEvent.VK_I ) {
System.err.println(glWindow);
} else if( e.getKeySymbol() == KeyEvent.VK_L ) {
javax.media.nativewindow.util.Point p0 = newtCanvasAWT.getNativeWindow().getLocationOnScreen(null);
javax.media.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null);
- System.err.println("NewtCanvasAWT position: "+p0+", "+p1);
+ System.err.println("NewtCanvasAWT position: "+p0+", "+p1);
} else if( e.getKeySymbol() == KeyEvent.VK_D ) {
glWindow.setUndecorated(!glWindow.isUndecorated());
} else if( e.getKeySymbol() == KeyEvent.VK_S ) {
@@ -68,7 +68,7 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
glWindow.setPosition(100, 100);
} else {
System.err.println("XXX glWin to 0/0");
- glWindow.setPosition(0, 0);
+ glWindow.setPosition(0, 0);
}
} else if( e.getKeySymbol() == KeyEvent.VK_F ) {
if( null != quitAdapter ) {
@@ -92,8 +92,8 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
if(glWindow.getAnimator().isPaused()) {
glWindow.getAnimator().resume();
} else {
- glWindow.getAnimator().pause();
- }
+ glWindow.getAnimator().pause();
+ }
}
}.run();
} else if( e.getKeySymbol() == KeyEvent.VK_R ) {
@@ -105,7 +105,7 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
final Thread t = glWindow.setExclusiveContextThread(null);
if(glWindow.getParent()==null) {
System.err.println("XXX glWin to HOME");
- glWindow.reparentWindow(newtCanvasAWT.getNativeWindow());
+ glWindow.reparentWindow(newtCanvasAWT.getNativeWindow(), -1, -1, 0 /* hints */);
} else {
if( null != frame ) {
final InsetsImmutable nInsets = glWindow.getInsets();
@@ -121,10 +121,10 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter {
final int topLevelX = frame.getX()+frame.getWidth()+dx;
final int topLevelY = frame.getY()+dy;
System.err.println("XXX glWin to TOP.1 "+topLevelX+"/"+topLevelY+" - insets " + nInsets + ", " + aInsets);
- glWindow.reparentWindow(null, topLevelX, topLevelY, false);
+ glWindow.reparentWindow(null, topLevelX, topLevelY, 0 /* hint */);
} else {
System.err.println("XXX glWin to TOP.0");
- glWindow.reparentWindow(null);
+ glWindow.reparentWindow(null, -1, -1, 0 /* hints */);
}
}
glWindow.requestFocus();
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
index 1f19241d8..7beceb291 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.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.newt.parenting;
@@ -62,7 +62,7 @@ public class TestParenting01NEWT extends UITestCase {
}
@Test
- public void testWindowParenting01CreateVisibleDestroy() throws InterruptedException {
+ public void test01CreateVisibleDestroy() throws InterruptedException {
Assert.assertEquals(0,Display.getActiveDisplayNumber());
Display display = null;
Screen screen = null;
@@ -82,7 +82,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(0,Display.getActiveDisplayNumber());
- glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy");
+ glWindow1.setTitle("test01CreateVisibleDestroy");
glWindow1.setSize(640, 480);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -151,13 +151,13 @@ public class TestParenting01NEWT extends UITestCase {
glWindow1.resetFPSCounter();
glWindow2.resetFPSCounter();
Animator animator1 = new Animator(glWindow1);
- animator1.setUpdateFPSFrames(1, null);
+ animator1.setUpdateFPSFrames(1, null);
animator1.start();
Assert.assertEquals(true, animator1.isAnimating());
Assert.assertEquals(false, animator1.isPaused());
Assert.assertNotNull(animator1.getThread());
Animator animator2 = new Animator(glWindow2);
- animator2.setUpdateFPSFrames(1, null);
+ animator2.setUpdateFPSFrames(1, null);
animator2.start();
Assert.assertEquals(true, animator2.isAnimating());
Assert.assertEquals(false, animator2.isPaused());
@@ -286,25 +286,27 @@ public class TestParenting01NEWT extends UITestCase {
}
@Test
- public void testWindowParenting02ReparentTop2WinReparentRecreate() throws InterruptedException {
- testWindowParenting02ReparentTop2WinImpl(true);
+ public void test02aReparentTop2WinReparentRecreate() throws InterruptedException {
+ test02ReparentTop2WinImpl(true);
}
@Test
- public void testWindowParenting02ReparentTop2WinReparentNative() throws InterruptedException {
- testWindowParenting02ReparentTop2WinImpl(false);
+ public void test02bReparentTop2WinReparentNative() throws InterruptedException {
+ test02ReparentTop2WinImpl(false);
}
/**
* @param reparentRecreate true, if the followup reparent should utilize destroy/create, instead of native reparenting
*/
- protected void testWindowParenting02ReparentTop2WinImpl(boolean reparentRecreate) throws InterruptedException {
+ protected void test02ReparentTop2WinImpl(final boolean reparentRecreate) throws InterruptedException {
+ final int reparentHints = reparentRecreate ? Window.REPARENT_HINT_FORCE_RECREATION : 0;
+
Assert.assertEquals(0,Display.getActiveDisplayNumber());
Display display1 = null;
Screen screen1 = null;
GLWindow glWindow1 = GLWindow.create(glCaps);
- glWindow1.setTitle("testWindowParenting02ReparentTop2Win");
+ glWindow1.setTitle("test02ReparentTop2Win");
glWindow1.setSize(640, 480);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -379,7 +381,7 @@ public class TestParenting01NEWT extends UITestCase {
// glWindow2 -- child --> glWindow1: compatible
Assert.assertEquals(true, glWindow2.isVisible());
System.err.println("Frames(1) "+glWindow2.getTotalFPSFrames());
- reparentAction = glWindow2.reparentWindow(glWindow1, -1, -1, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(glWindow1, -1, -1, reparentHints);
System.err.println("Frames(2) "+glWindow2.getTotalFPSFrames());
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
@@ -405,7 +407,7 @@ public class TestParenting01NEWT extends UITestCase {
// glWindow2 --> top
Assert.assertEquals(true, glWindow2.isVisible());
- reparentAction = glWindow2.reparentWindow(null, -1, -1, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(null, -1, -1, reparentHints);
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
@@ -484,16 +486,18 @@ public class TestParenting01NEWT extends UITestCase {
}
@Test
- public void testWindowParenting03ReparentWin2TopReparentRecreate() throws InterruptedException {
- testWindowParenting03ReparentWin2TopImpl(true);
+ public void test03aReparentWin2TopReparentRecreate() throws InterruptedException {
+ test03ReparentWin2TopImpl(true);
}
@Test
- public void testWindowParenting03ReparentWin2TopReparentNative() throws InterruptedException {
- testWindowParenting03ReparentWin2TopImpl(false);
+ public void test03bReparentWin2TopReparentNative() throws InterruptedException {
+ test03ReparentWin2TopImpl(false);
}
- protected void testWindowParenting03ReparentWin2TopImpl(boolean reparentRecreate) throws InterruptedException {
+ protected void test03ReparentWin2TopImpl(final boolean reparentRecreate) throws InterruptedException {
+ final int reparentHints = reparentRecreate ? Window.REPARENT_HINT_FORCE_RECREATION : 0;
+
Assert.assertEquals(0,Display.getActiveDisplayNumber());
Display display1 = null;
Screen screen1 = null;
@@ -503,7 +507,7 @@ public class TestParenting01NEWT extends UITestCase {
GLWindow glWindow1 = GLWindow.create(glCaps);
screen1 = glWindow1.getScreen();
display1 = screen1.getDisplay();
- glWindow1.setTitle("testWindowParenting03ReparentWin2Top");
+ glWindow1.setTitle("test03ReparentWin2Top");
glWindow1.setSize(640, 480);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -567,14 +571,14 @@ public class TestParenting01NEWT extends UITestCase {
switch(state) {
case 0:
Assert.assertEquals(true, glWindow2.isVisible());
- reparentAction = glWindow2.reparentWindow(null, -1, -1, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(null, -1, -1, reparentHints);
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFPSFrames());
Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
-
+
Assert.assertNull(glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());
Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
@@ -582,14 +586,14 @@ public class TestParenting01NEWT extends UITestCase {
break;
case 1:
Assert.assertEquals(true, glWindow2.isVisible());
- reparentAction = glWindow2.reparentWindow(glWindow1, -1, -1, reparentRecreate);
+ reparentAction = glWindow2.reparentWindow(glWindow1, -1, -1, reparentHints);
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3 "+glWindow2.getTotalFPSFrames());
Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
-
+
Assert.assertSame(glWindow1,glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());
Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
@@ -657,7 +661,7 @@ public class TestParenting01NEWT extends UITestCase {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
- Assert.assertNotNull(glWindow);
+ Assert.assertNotNull(glWindow);
if(debug) {
MiscUtils.setFieldIfExists(demo, "glDebug", true);
MiscUtils.setFieldIfExists(demo, "glTrace", true);
@@ -689,8 +693,8 @@ public class TestParenting01NEWT extends UITestCase {
try {
TestParenting01NEWT.initClass();
TestParenting01NEWT m = new TestParenting01NEWT();
- m.testWindowParenting02ReparentTop2WinReparentRecreate();
- m.testWindowParenting01CreateVisibleDestroy();
+ m.test02aReparentTop2WinReparentRecreate();
+ m.test01CreateVisibleDestroy();
} catch (Throwable t ) {
t.printStackTrace();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java
index 6de24d1ea..420a39cb2 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.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,7 +20,7 @@
* 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.
@@ -68,7 +68,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
+ public void test01WindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
final GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
@@ -112,11 +112,11 @@ public class TestParenting01aAWT extends UITestCase {
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
final Animator animator1 = new Animator(glWindow1);
- animator1.setUpdateFPSFrames(1, null);
+ animator1.setUpdateFPSFrames(1, null);
animator1.start();
Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow1, true));
Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow1, true));
-
+
while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) {
Thread.sleep(100);
}
@@ -126,17 +126,17 @@ public class TestParenting01aAWT extends UITestCase {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(false);
- } } );
+ } } );
Assert.assertEquals(true, glWindow1.isNativeValid());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.setVisible(true);
- } } );
+ } } );
Assert.assertEquals(true, glWindow1.isNativeValid());
final boolean wasOnscreen = glWindow1.getChosenCapabilities().isOnscreen();
-
+
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.remove(newtCanvasAWT);
@@ -159,7 +159,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting02CreateVisibleDestroy2Defered() throws InterruptedException, InvocationTargetException {
+ public void test02WindowParenting02CreateVisibleDestroy2Defered() throws InterruptedException, InvocationTargetException {
final GLWindow glWindow1 = GLWindow.create(glCaps);
Assert.assertNotNull(glWindow1);
Assert.assertEquals(false, glWindow1.isVisible());
@@ -211,7 +211,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting02CreateVisibleDestroy3Odd() throws InterruptedException, InvocationTargetException {
+ public void test03WindowParenting02CreateVisibleDestroy3Odd() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -256,7 +256,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting03ReparentNewtWin2Top() throws InterruptedException, InvocationTargetException {
+ public void test04WindowParenting03ReparentNewtWin2Top() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -283,7 +283,7 @@ public class TestParenting01aAWT extends UITestCase {
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
Animator animator1 = new Animator(glWindow1);
- animator1.setUpdateFPSFrames(1, null);
+ animator1.setUpdateFPSFrames(1, null);
animator1.start();
int state = 0;
@@ -291,12 +291,12 @@ public class TestParenting01aAWT extends UITestCase {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
- glWindow1.reparentWindow(null);
+ System.err.println("Reparent CHILD -> TOP: "+glWindow1.reparentWindow(null, -1, -1, 0 /* hints */));
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParent());
break;
case 1:
- glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow());
+ System.err.println("Reparent TOP -> CHILD: "+glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow(), -1, -1, 0 /* hints */));
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
break;
@@ -315,7 +315,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting04ReparentNewtWin2TopLayouted() throws InterruptedException, InvocationTargetException {
+ public void test05WindowParenting04ReparentNewtWin2TopLayouted() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
GLEventListener demo1 = new RedSquareES2();
setDemoFields(demo1, glWindow1, false);
@@ -329,7 +329,7 @@ public class TestParenting01aAWT extends UITestCase {
frame.add(new Button("South"), BorderLayout.SOUTH);
frame.add(new Button("East"), BorderLayout.EAST);
frame.add(new Button("West"), BorderLayout.WEST);
-
+
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame.setSize(width, height);
@@ -344,11 +344,11 @@ public class TestParenting01aAWT extends UITestCase {
frame.validate();
}
});
-
+
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
Animator animator1 = new Animator(glWindow1);
- animator1.setUpdateFPSFrames(1, null);
+ animator1.setUpdateFPSFrames(1, null);
animator1.start();
int state = 0;
@@ -356,12 +356,12 @@ public class TestParenting01aAWT extends UITestCase {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
- glWindow1.reparentWindow(null);
+ System.err.println("Reparent CHILD -> TOP: "+glWindow1.reparentWindow(null, -1, -1, 0 /* hints */));
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertNull(glWindow1.getParent());
break;
case 1:
- glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow());
+ System.err.println("Reparent TOP -> CHILD: "+glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow(), -1, -1, 0 /* hints */));
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
break;
@@ -380,7 +380,7 @@ public class TestParenting01aAWT extends UITestCase {
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
+ public void test06WindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
glWindow1.setUndecorated(true);
GLEventListener demo1 = new RedSquareES2();
@@ -427,7 +427,7 @@ public class TestParenting01aAWT extends UITestCase {
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
Animator animator1 = new Animator(glWindow1);
- animator1.setUpdateFPSFrames(1, null);
+ animator1.setUpdateFPSFrames(1, null);
animator1.start();
int state = 0;
@@ -442,7 +442,7 @@ public class TestParenting01aAWT extends UITestCase {
frame1.validate();
frame2.validate();
}
- });
+ });
break;
case 1:
SwingUtilities.invokeAndWait(new Runnable() {
@@ -452,7 +452,7 @@ public class TestParenting01aAWT extends UITestCase {
frame2.validate();
frame1.validate();
}
- });
+ });
break;
}
state++;
@@ -471,7 +471,7 @@ public class TestParenting01aAWT extends UITestCase {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
- Assert.assertNotNull(glWindow);
+ Assert.assertNotNull(glWindow);
if(debug) {
MiscUtils.setFieldIfExists(demo, "glDebug", true);
MiscUtils.setFieldIfExists(demo, "glTrace", true);
@@ -498,17 +498,7 @@ public class TestParenting01aAWT extends UITestCase {
}
}
String tstname = TestParenting01aAWT.class.getName();
- org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
- tstname,
- "filtertrace=true",
- "haltOnError=false",
- "haltOnFailure=false",
- "showoutput=true",
- "outputtoformatters=true",
- "logfailedtests=true",
- "logtestlistenerevents=true",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
+ org.junit.runner.JUnitCore.main(tstname);
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java
index 45612eb1a..598e5f10f 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01bAWT.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.newt.parenting;
import org.junit.Assert;
@@ -68,16 +68,16 @@ public class TestParenting01bAWT extends UITestCase {
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2FrameFPS25Animator() throws InterruptedException, InvocationTargetException {
- testWindowParenting05ReparentAWTWinHopFrame2FrameImpl(25);
+ public void test01AWTWinHopFrame2FrameFPS25Animator() throws InterruptedException, InvocationTargetException {
+ testAWTWinHopFrame2FrameImpl(25);
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2FrameStdAnimator() throws InterruptedException, InvocationTargetException {
- testWindowParenting05ReparentAWTWinHopFrame2FrameImpl(0);
+ public void test02AWTWinHopFrame2FrameStdAnimator() throws InterruptedException, InvocationTargetException {
+ testAWTWinHopFrame2FrameImpl(0);
}
- public void testWindowParenting05ReparentAWTWinHopFrame2FrameImpl(int fps) throws InterruptedException, InvocationTargetException {
+ public void testAWTWinHopFrame2FrameImpl(int fps) throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
glWindow1.setUndecorated(true);
GLEventListener demo1 = new RedSquareES2();
@@ -85,7 +85,7 @@ public class TestParenting01bAWT extends UITestCase {
glWindow1.addGLEventListener(demo1);
final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
-
+
final Frame frame1 = new Frame("AWT Parent Frame");
frame1.setLayout(new BorderLayout());
frame1.add(new Button("North"), BorderLayout.NORTH);
@@ -96,7 +96,7 @@ public class TestParenting01bAWT extends UITestCase {
public void run() {
frame1.setSize(width, height);
frame1.setLocation(0, 0);
- frame1.setVisible(true);
+ frame1.setVisible(true);
}
});
@@ -110,7 +110,7 @@ public class TestParenting01bAWT extends UITestCase {
public void run() {
frame2.setSize(width, height);
frame2.setLocation(640, 480);
- frame2.setVisible(true);
+ frame2.setVisible(true);
}
});
@@ -142,7 +142,7 @@ public class TestParenting01bAWT extends UITestCase {
frame1.validate();
frame2.validate();
}
- });
+ });
break;
case 1:
SwingUtilities.invokeAndWait(new Runnable() {
@@ -152,7 +152,7 @@ public class TestParenting01bAWT extends UITestCase {
frame2.validate();
frame1.validate();
}
- });
+ });
break;
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java
index dd5d6eb13..1d7401728 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cAWT.java
@@ -66,7 +66,7 @@ public class TestParenting01cAWT extends UITestCase {
}
@Test
- public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
+ public void test01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
int i;
GLWindow glWindow1 = GLWindow.create(glCaps);
@@ -154,7 +154,7 @@ public class TestParenting01cAWT extends UITestCase {
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
+ public void test02AWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
GLWindow glWindow1 = GLWindow.create(glCaps);
glWindow1.setUndecorated(true);
GLEventListener demo1 = new RedSquareES2();
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
index 375f676f4..4d5c3b25d 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
@@ -121,7 +121,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
}
@Test
- public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
+ public void test01CreateVisibleDestroy1() throws InterruptedException, InvocationTargetException {
/**
* JFrame . JPanel . Container . NewtCanvasAWT . GLWindow
*/
@@ -236,7 +236,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
+ public void test02AWTWinHopFrame2Frame() throws InterruptedException, InvocationTargetException {
/**
* JFrame . JPanel . Container . NewtCanvasAWT . GLWindow
*/
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java
index d79bdcaf6..b304a2ce7 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02AWT.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.newt.parenting;
import org.junit.Assert;
@@ -65,22 +65,22 @@ public class TestParenting02AWT extends UITestCase {
}
@Test
- public void testWindowParenting01NewtChildOnAWTParentLayouted() throws InterruptedException, InvocationTargetException {
+ public void test01NewtChildOnAWTParentLayouted() throws InterruptedException, InvocationTargetException {
runNewtChildOnAWTParent(true, false);
}
@Test
- public void testWindowParenting02NewtChildOnAWTParentLayoutedDef() throws InterruptedException, InvocationTargetException {
+ public void test02NewtChildOnAWTParentLayoutedDef() throws InterruptedException, InvocationTargetException {
runNewtChildOnAWTParent(true, true);
}
@Test
- public void testWindowParenting03NewtChildOnAWTParentDirect() throws InterruptedException, InvocationTargetException {
+ public void test03NewtChildOnAWTParentDirect() throws InterruptedException, InvocationTargetException {
runNewtChildOnAWTParent(false, false);
}
@Test
- public void testWindowParenting04NewtChildOnAWTParentDirectDef() throws InterruptedException, InvocationTargetException {
+ public void test04NewtChildOnAWTParentDirectDef() throws InterruptedException, InvocationTargetException {
runNewtChildOnAWTParent(false, true);
}
@@ -152,7 +152,7 @@ public class TestParenting02AWT extends UITestCase {
} while(!glWindow.isNativeValid()) ;
final boolean wasOnscreen = glWindow.getChosenCapabilities().isOnscreen();
-
+
Assert.assertEquals(true, glWindow.isNativeValid());
Assert.assertNotNull(glWindow.getParent());
if(verbose) {
@@ -203,7 +203,7 @@ public class TestParenting02AWT extends UITestCase {
Thread.sleep(step);
duration -= step;
- while( null != ( event = (NEWTEvent) eventFifo.get() ) ) {
+ while( null != ( event = eventFifo.get() ) ) {
Window source = (Window) event.getSource();
if(event instanceof KeyEvent) {
KeyEvent keyEvent = (KeyEvent) event;
@@ -215,7 +215,7 @@ public class TestParenting02AWT extends UITestCase {
source.setFullscreen(!source.isFullscreen());
break;
}
- }
+ }
}
}
if(verbose) {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java
index 6294483f0..9f56ecdbf 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.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.newt.parenting;
@@ -92,7 +92,7 @@ public class TestParenting02NEWT extends UITestCase {
}
@Test
- public void testWindowParenting01NewtOnNewtParentChildDraw() throws InterruptedException {
+ public void test01NewtOnNewtParentChildDraw() throws InterruptedException {
GLCapabilities caps = new GLCapabilities(null);
Assert.assertNotNull(caps);
Display display = NewtFactory.createDisplay(null); // local display
@@ -112,7 +112,7 @@ public class TestParenting02NEWT extends UITestCase {
glWindow1.setSize(width, height);
Assert.assertEquals(width,glWindow1.getWidth());
Assert.assertEquals(height,glWindow1.getHeight());
- glWindow1.setTitle("testWindowParenting01NewtOnNewtParentChildDraw - PARENT");
+ glWindow1.setTitle("test01NewtOnNewtParentChildDraw - PARENT");
glWindow1.setPosition(x,y);
//glWindow1.addKeyListener(new TraceKeyAdapter(new KeyAction(eventFifo)));
//glWindow1.addWindowListener(new TraceWindowAdapter());
@@ -133,7 +133,7 @@ public class TestParenting02NEWT extends UITestCase {
glWindow2.setSize(width/2, height/2);
//Assert.assertEquals(width/2,glWindow2.getWidth());
//Assert.assertEquals(height/2,glWindow2.getHeight());
- glWindow2.setTitle("testWindowParenting01NewtOnNewtParentChildDraw - CHILD");
+ glWindow2.setTitle("test01NewtOnNewtParentChildDraw - CHILD");
glWindow2.setPosition(glWindow1.getWidth()/2, glWindow1.getHeight()/2);
//glWindow2.addKeyListener(new TraceKeyAdapter(new KeyAction(eventFifo)));
//glWindow2.addWindowListener(new TraceWindowAdapter(new WindowAction(eventFifo)));
@@ -166,7 +166,7 @@ public class TestParenting02NEWT extends UITestCase {
glWindow2.setPosition(glWindow1.getWidth()/2,glWindow1.getHeight()/2-y);
Thread.sleep(step);
- while( null != ( event = (NEWTEvent) eventFifo.get() ) ) {
+ while( null != ( event = eventFifo.get() ) ) {
Window source = (Window) event.getSource();
if(WindowEvent.EVENT_WINDOW_DESTROY_NOTIFY == event.getEventType()) {
shouldQuit = true;
@@ -180,7 +180,7 @@ public class TestParenting02NEWT extends UITestCase {
source.setFullscreen(!source.isFullscreen());
break;
}
- }
+ }
}
}
destroyWindow(null, null, window2, glWindow2);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
index 30ee0f129..b7497196c 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.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.newt.parenting;
import java.lang.reflect.*;
@@ -69,16 +69,16 @@ public class TestParenting03AWT extends UITestCase {
}
@Test
- public void testWindowParenting1AWTOneNewtChilds01() throws InterruptedException, InvocationTargetException {
- testWindowParenting1AWT(false);
+ public void test01AWTOneNewtChilds01() throws InterruptedException, InvocationTargetException {
+ testImpl(false);
}
@Test
- public void testWindowParenting1AWTTwoNewtChilds01() throws InterruptedException, InvocationTargetException {
- testWindowParenting1AWT(true);
+ public void test02AWTTwoNewtChilds01() throws InterruptedException, InvocationTargetException {
+ testImpl(true);
}
-
- public void testWindowParenting1AWT(boolean use2nd) throws InterruptedException, InvocationTargetException {
+
+ public void testImpl(boolean use2nd) throws InterruptedException, InvocationTargetException {
final Frame frame1 = new Frame("AWT Parent Frame");
GLWindow glWindow1 = GLWindow.create(glCaps);
glWindow1.setUpdateFPSFrames(1, null);
@@ -100,7 +100,7 @@ public class TestParenting03AWT extends UITestCase {
glWindow2.setUpdateFPSFrames(1, null);
newtCanvasAWT2 = new NewtCanvasAWT(glWindow2);
newtCanvasAWT2.setPreferredSize(glSize);
-
+
GLEventListener demo2 = new GearsES2(1);
setDemoFields(demo2, glWindow2, false);
glWindow2.addGLEventListener(demo2);
@@ -141,12 +141,12 @@ public class TestParenting03AWT extends UITestCase {
System.err.println("******* Frame setVisible");
frame1.setLocation(0, 0);
frame1.setSize(fSize);
- frame1.validate();
+ frame1.validate();
frame1.setVisible(true);
}});
Assert.assertEquals(newtCanvasAWT1.getNativeWindow(),glWindow1.getParent());
-
+
Assert.assertEquals(true, animator1.isAnimating());
Assert.assertEquals(false, animator1.isPaused());
Assert.assertNotNull(animator1.getThread());
@@ -157,7 +157,7 @@ public class TestParenting03AWT extends UITestCase {
Assert.assertNotNull(animator2.getThread());
Thread.sleep(waitAdd2nd);
-
+
javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
frame1.add(cont2, BorderLayout.WEST);
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 827ac525a..126aaaffa 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
@@ -70,13 +70,13 @@ public class TestParenting04AWT extends UITestCase {
}
@Test
- public void winHopFrame2FrameDirectHop() throws InterruptedException, InvocationTargetException {
+ public void test01WinHopFrame2FrameDirectHop() throws InterruptedException, InvocationTargetException {
// Will produce some artifacts .. resizing etc
winHopFrame2Frame(false);
}
@Test
- public void winHopFrame2FrameDetachFirst() throws InterruptedException, InvocationTargetException {
+ public void test02WinHopFrame2FrameDetachFirst() throws InterruptedException, InvocationTargetException {
// Note: detaching first setNEWTChild(null) is much cleaner visually
winHopFrame2Frame(true);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java
index 78b3bc464..586db8a2b 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting04SWT.java
@@ -136,13 +136,13 @@ public class TestParenting04SWT extends UITestCase {
}
@Test
- public void winHopFrame2FrameDirectHop() throws InterruptedException, InvocationTargetException {
+ public void test01WinHopFrame2FrameDirectHop() throws InterruptedException, InvocationTargetException {
// Will produce some artifacts .. resizing etc
winHopFrame2Frame(false);
}
@Test
- public void winHopFrame2FrameDetachFirst() throws InterruptedException, InvocationTargetException {
+ public void test02WinHopFrame2FrameDetachFirst() throws InterruptedException, InvocationTargetException {
// Note: detaching first setNEWTChild(null) is much cleaner visually
winHopFrame2Frame(true);
}