aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-01-23 02:17:47 +0100
committerSven Gothel <[email protected]>2012-01-23 02:17:47 +0100
commit05dfc0ca320d6578cd596cc3384a3bbc6fc4e36f (patch)
tree0b9951e6e2793b521c85a817794e667b481311ca
parentaed2c7f2919d8b6d3de5b1a1dd9ab260f0c3663c (diff)
Bug 551 validation.
Turns out, that the culprit (at least on my Win7 NVidia machine) is the runtime property "-Dsun.java2d.opengl=false". When _not_ setting this prop. the test runs fine.
-rwxr-xr-xmake/scripts/java-win64-dbg.bat4
-rwxr-xr-xmake/scripts/tests-x64.bat3
-rwxr-xr-xmake/scripts/tests.sh6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java150
4 files changed, 158 insertions, 5 deletions
diff --git a/make/scripts/java-win64-dbg.bat b/make/scripts/java-win64-dbg.bat
index db23423a3..653b19e95 100755
--- a/make/scripts/java-win64-dbg.bat
+++ b/make/scripts/java-win64-dbg.bat
@@ -23,7 +23,7 @@ REM set D_ARGS="-Djogl.debug=all"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch" "-Djogl.windows.useWGLVersionOf5WGLGDIFuncSet"
REM set D_ARGS="-Djogl.debug.GLCanvas" "-Djogl.debug.Animator" "-Djogl.debug.GLContext" "-Djogl.debug.GLContext.TraceSwitch"
-set D_ARGS="-Dnewt.debug.Window"
+REM set D_ARGS="-Dnewt.debug.Window"
REM set D_ARGS="-Djogl.debug.GLDebugMessageHandler" "-Djogl.debug.DebugGL" "-Djogl.debug.TraceGL"
REM set D_ARGS="-Djogl.debug.DebugGL" "-Djogl.debug.GLDebugMessageHandler" "-Djogl.debug.GLSLCode"
REM set D_ARGS="-Djogl.debug.GraphicsConfiguration" "-Djogl.debug.CapabilitiesChooser"
@@ -35,5 +35,7 @@ REM set D_ARGS="-Dnewt.debug.Screen" "-Dnewt.debug.EDT" "-Dnativewindow.debug=al
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display" "-Dnewt.test.Window.reparent.incompatible=true"
REM set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.java2d.opengl=true" "-Dsun.awt.noerasebackground=true"
+REM set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.java2d.d3d=false" "-Dsun.java2d.ddoffscreen=false" "-Dsun.java2d.gdiblit=false" "-Dsun.java2d.opengl=false" "-Dsun.awt.noerasebackground=true" "-Xms512m" "-Xmx1024m"
+REM set X_ARGS="-Dsun.java2d.noddraw=true" "-Dsun.java2d.d3d=false" "-Dsun.java2d.ddoffscreen=false" "-Dsun.java2d.gdiblit=false" "-Dsun.java2d.opengl=true" "-Dsun.awt.noerasebackground=true" "-Xms512m" "-Xmx1024m"
%J2RE_HOME%\bin\java -classpath %CP_ALL% "-Djava.library.path=%LIB_DIR%" %D_ARGS% %X_ARGS% %* > java-win64-dbg.log 2>&1
diff --git a/make/scripts/tests-x64.bat b/make/scripts/tests-x64.bat
index f3e871ce4..a5d730445 100755
--- a/make/scripts/tests-x64.bat
+++ b/make/scripts/tests-x64.bat
@@ -3,6 +3,7 @@ REM scripts\java-win64-dbg.bat com.jogamp.newt.opengl.GLWindow
REM scripts\java-win64-dbg.bat javax.media.opengl.awt.GLCanvas
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.offscreen.TestOffscreen01GLPBufferNEWT -time 5000
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.awt.TestAWT01GLn
+scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.jogl.awt.TestBug551AWT %*
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.awt.TestSwingAWT01GLn
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT -time 5000
REM scripts\java-win64.bat com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListNEWT -time 5000
@@ -35,7 +36,7 @@ REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestGLWindows01
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestGLWindows02NEWTAnimated
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting01NEWT
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestFocus01SwingAWTRobot %*
-scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot %*
+REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.TestFocus02SwingAWTRobot %*
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.nativewindow.TestRecursiveToolkitLockCORE
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.parenting.TestParenting03AWT %*
REM scripts\java-win64-dbg.bat com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT %*
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 385925aea..af8c1c204 100755
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -52,7 +52,6 @@ function jrun() {
#D_ARGS="-Djogl.debug.ExtensionAvailabilityCache -Djogl.debug=all -Dnativewindow.debug=all -Djogamp.debug.ProcAddressHelper=true -Djogamp.debug.NativeLibrary=true -Djogamp.debug.NativeLibrary.Lookup=true"
#D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
- #D_ARGS="-Djogamp.debug=all -Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all"
#D_ARGS="-Dnewt.debug.MainThread"
#D_ARGS="-Djogl.debug=all -Dnativewindow.debug=all"
#D_ARGS="-Djogl.debug=all"
@@ -87,7 +86,7 @@ function jrun() {
#D_ARGS="-Dnewt.debug.Window -Djogl.debug.Animator -Dnewt.debug.Screen"
#D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Window.KeyEvent"
#D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug=all"
- D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug.JAWT -Djogl.debug.Animator"
+ #D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug.JAWT -Djogl.debug.Animator"
#D_ARGS="-Dnewt.debug.Window"
#D_ARGS="-Xprof"
#D_ARGS="-Djogl.debug.Animator"
@@ -225,6 +224,7 @@ function testawtswt() {
#testawt jogamp.newt.awt.opengl.VersionApplet $*
#testawt javax.media.opengl.awt.GLCanvas $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestMainVersionGLCanvasAWT $*
+testawt com.jogamp.opengl.test.junit.jogl.awt.TestBug551AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.awt.TestAWT01GLn $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextListAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.acore.TestSharedContextNewtAWTBug523 $*
@@ -329,7 +329,7 @@ function testawtswt() {
# osx:
#testawtswt com.jogamp.opengl.test.junit.jogl.swt.TestSWTJOGLGLCanvas01GLnAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingFocusTraversal01AWT $*
-testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01GLCanvasAWT $*
+#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer01GLCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.newt.parenting.TestParentingOffscreenLayer02NewtCanvasAWT $*
$spath/count-edt-start.sh java-run.log
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java
new file mode 100644
index 000000000..365265334
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug551AWT.java
@@ -0,0 +1,150 @@
+/**
+ * Copyright 2010 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.lang.reflect.InvocationTargetException;
+import javax.media.opengl.GLProfile;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.awt.GLCanvas;
+import com.jogamp.opengl.util.Animator;
+
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+
+
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Rectangle;
+import java.awt.Window;
+import javax.swing.JFrame;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assume.*;
+import static javax.swing.SwingUtilities.*;
+
+/**
+ * Tests context creation + display on various kinds of Window implementations.
+ * @author Michael Bien, et. al.
+ */
+public class TestBug551AWT extends UITestCase {
+
+ static void checkGraphicsEnvironment() {
+ Rectangle virtualBounds = new Rectangle();
+ GraphicsEnvironment ge =GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice[] gs = ge.getScreenDevices();
+
+ //write graphics devices to log
+ System.err.println("number of graphics devices " + gs.length);
+ for(int i =0 ; i < gs.length; i++) {
+ System.err.println(gs[i].toString());
+ }
+
+ //check for bounds
+ for (int j = 0; j < gs.length; j++) {
+ GraphicsDevice gd = gs[j];
+ GraphicsConfiguration[] gc = gd.getConfigurations();
+ for (int i=0; i < gc.length; i++) {
+ System.err.println("graphics configuration for device " + j + " is: " + gc[i].getBounds());
+ virtualBounds = virtualBounds.union(gc[i].getBounds());
+ }
+ }
+
+ }
+
+ protected void runTestGL() throws InterruptedException, InvocationTargetException {
+ final Window window = new JFrame(this.getSimpleTestName());
+ final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+
+ // final array as mutable container hack
+ final GLCanvas[] glCanvas = new GLCanvas[1];
+
+ Runnable test = new Runnable() {
+ public void run() {
+ glCanvas[0] = new GLCanvas(caps);
+ glCanvas[0].addGLEventListener(new GearsES2());
+ window.add(glCanvas[0]);
+
+ // Revalidate size/layout.
+ // Always validate if component added/removed.
+ // Ensure 1st paint of GLCanvas will have a valid size, hence drawable gets created.
+ window.setSize(512, 512);
+ window.validate();
+
+ window.setVisible(true);
+ glCanvas[0].display();
+ }
+ };
+
+ Runnable cleanup = new Runnable() {
+ public void run() {
+ System.out.println("cleaning up...");
+ window.setVisible(false);
+ try {
+ window.removeAll();
+ } catch (Throwable t) {
+ assumeNoException(t);
+ t.printStackTrace();
+ }
+ window.dispose();
+ }
+
+ };
+
+ // AWT / Swing on EDT..
+ invokeAndWait(test);
+
+ Animator animator = new Animator(glCanvas[0]);
+ animator.start();
+ Thread.sleep(1000);
+ animator.stop();
+
+ // AWT / Swing on EDT..
+ invokeAndWait(cleanup);
+ }
+
+ // @Test
+ public void test01Plain() throws InterruptedException, InvocationTargetException {
+ runTestGL();
+ }
+
+ @Test
+ public void test02WithCheckGraphicsEnvironment() throws InterruptedException, InvocationTargetException {
+ checkGraphicsEnvironment();
+ runTestGL();
+ }
+
+ public static void main(String args[]) {
+ org.junit.runner.JUnitCore.main(TestBug551AWT.class.getName());
+ }
+}