aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-07-04 14:14:13 +0200
committerSven Gothel <[email protected]>2013-07-04 14:14:13 +0200
commit2f3be40737c15547e8c7c9e19ccdb2b3b1e2ea56 (patch)
tree66c21a0703eead93704912c528d22d248535649a
parent9c7ab101cf5261db3ef6160c0aa1906ffcce188b (diff)
TestScreenMode* Cleanup (reset)
- TestScreenMode01aNEWT and TestScreenMode01dNEWT test auto-reset (destroying last Screen ref. reinstates orig MonitorMode) - Other tests do manual reset. - Add ant test target 'junit.run.newt.monitormode' to test only monitor-mode / fullscreen cases
-rw-r--r--make/build-test.xml38
-rwxr-xr-xmake/scripts/tests-win.bat4
-rwxr-xr-xmake/scripts/tests-x64-dbg.bat5
-rw-r--r--make/scripts/tests.sh8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java68
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java79
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java5
9 files changed, 129 insertions, 86 deletions
diff --git a/make/build-test.xml b/make/build-test.xml
index e00348c38..a42f97b3c 100644
--- a/make/build-test.xml
+++ b/make/build-test.xml
@@ -484,6 +484,44 @@
</junit>
</target>
+ <target name="junit.run.newt.monitormode" depends="test.compile">
+ <!-- Test*AWT* -->
+ <junit jvm="${jvmJava.exe}" forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
+ <env key="${system.env.library.path}" path="${obj.all.paths}"/>
+ <jvmarg value="${junit.run.arg0}"/>
+ <jvmarg value="${junit.run.arg1}"/>
+ <jvmarg value="${jvmDataModel.arg}"/>
+ <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
+
+ <!--
+ <jvmarg value="-Dnewt.debug.EDT"/>
+ <jvmarg value="-Djogl.debug=all"/>
+ <jvmarg value="-Dgluegen.debug.NativeLibrary=true"/>
+ <jvmarg value="-Dgluegen.debug.ProcAddressHelper=true"/>
+ <jvmarg value="-Djogl.debug.GLSLState"/>
+ <jvmarg value="-Dnativewindow.debug=all"/>
+ <jvmarg value="-Dnewt.debug=all"/>
+ <jvmarg value="-verbose:jni"/>
+ <jvmarg value="-client"/>
+ <jvmarg value="-d32"/>
+ -->
+
+ <formatter usefile="false" type="plain"/>
+ <formatter usefile="true" type="xml"/>
+ <!--classpath refid="junit_jogl_awt.run.classpath"/-->
+ <classpath refid="junit_jogl_swt.run.classpath"/>
+
+ <batchtest todir="${results.test}">
+ <fileset dir="${classes}">
+ <include name="${java.dir.junit}/**/newt/mm/Test**"/>
+ <exclude name="**/*$$*"/>
+ </fileset>
+ <formatter usefile="false" type="brief"/>
+ <formatter usefile="true" type="xml"/>
+ </batchtest>
+ </junit>
+ </target>
+
<target name="junit.run.awt.singletest" depends="test.compile">
<!-- Test*AWT* -->
<junit jvm="${jvmJava.exe}" forkmode="perTest" showoutput="true" fork="true" haltonerror="off" timeout="${batchtest.timeout}">
diff --git a/make/scripts/tests-win.bat b/make/scripts/tests-win.bat
index b0815a5a6..da531dd66 100755
--- a/make/scripts/tests-win.bat
+++ b/make/scripts/tests-win.bat
@@ -61,7 +61,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGe
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.gl2.awt.TestGearsAWT -time 5000
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT %*
-scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT %*
+REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestElektronenMultipliziererNEWT %*
@@ -118,7 +118,7 @@ REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode00bN
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01bNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01cNEWT %*
-REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01dNEWT %*
+scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01dNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02aNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02bNEWT %*
REM scripts\java-win.bat com.jogamp.opengl.test.junit.newt.mm.ManualScreenMode03sNEWT %*
diff --git a/make/scripts/tests-x64-dbg.bat b/make/scripts/tests-x64-dbg.bat
index d0108fdf8..c8b1ef5b0 100755
--- a/make/scripts/tests-x64-dbg.bat
+++ b/make/scripts/tests-x64-dbg.bat
@@ -40,8 +40,8 @@ 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"
-REM set D_ARGS="-Dnewt.debug.Window"
-set D_ARGS="-Dnewt.debug.Window.KeyEvent"
+set D_ARGS="-Dnewt.debug.Window"
+REM set D_ARGS="-Dnewt.debug.Window.KeyEvent"
REM set D_ARGS="-Dnewt.debug.Window.MouseEvent"
REM set D_ARGS="-Dnewt.debug.Window.MouseEvent" "-Dnewt.debug.Window.KeyEvent"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display"
@@ -54,6 +54,7 @@ REM set D_ARGS="-Dnewt.debug.Display" "-Dnewt.debug.EDT" "-Dnewt.debug.Window"
REM set D_ARGS="-Dnewt.debug.Window" "-Dnewt.debug.Display" "-Dnewt.debug.EDT" "-Djogl.debug.GLContext"
REM set D_ARGS="-Dnewt.debug.Screen" "-Dnewt.debug.EDT" "-Dnativewindow.debug=all"
REM set D_ARGS="-Dnewt.debug.Screen"
+REM set D_ARGS="-Dnewt.debug.Screen" "-Dnewt.debug.Window"
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"
diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh
index 2e741b353..640e6a01d 100644
--- a/make/scripts/tests.sh
+++ b/make/scripts/tests.sh
@@ -136,7 +136,7 @@ function jrun() {
#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.Window"
+ D_ARGS="-Dnewt.debug.Window"
#D_ARGS="-Dnewt.test.Screen.disableRandR13"
#D_ARGS="-Dnewt.test.Screen.disableScreenMode -Dnewt.debug.Screen"
#D_ARGS="-Dnewt.debug.Screen -Djogl.debug.Animator"
@@ -176,7 +176,7 @@ function jrun() {
#D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Display -Dnewt.debug.EDT -Djogl.debug.GLContext"
#D_ARGS="-Dnewt.debug.Window -Djogl.debug.Animator -Dnewt.debug.Screen"
#D_ARGS="-Dnativewindow.debug.JAWT -Dnewt.debug.Window"
- D_ARGS="-Dnewt.debug.Window.KeyEvent"
+ #D_ARGS="-Dnewt.debug.Window.KeyEvent"
#D_ARGS="-Dnewt.debug.Window.MouseEvent"
#D_ARGS="-Dnewt.debug.Window.MouseEvent -Dnewt.debug.Window.KeyEvent"
#D_ARGS="-Dnewt.debug.Window -Dnativewindow.debug=all"
@@ -285,7 +285,7 @@ function testawtswt() {
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelsAWT $*
-testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
+#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasAWT $*
#testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NewtCanvasAWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NEWT $*
#testnoawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestLandscapeES2NEWT $*
@@ -406,7 +406,7 @@ testawt com.jogamp.opengl.test.junit.jogl.demos.es2.newt.TestGearsES2NewtCanvasA
#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01aNEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01bNEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01cNEWT $*
-#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01dNEWT $*
+testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode01dNEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02aNEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.mm.TestScreenMode02bNEWT $*
#testnoawt com.jogamp.opengl.test.junit.newt.mm.ManualScreenMode03aNEWT $*
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java
index f431e099b..8846812e5 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java
@@ -46,6 +46,7 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
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.UITestCase;
import java.util.List;
@@ -105,16 +106,16 @@ public class TestScreenMode01aNEWT extends UITestCase {
public void testScreenModeChange01() throws InterruptedException {
Thread.sleep(waitTimeShort);
- GLCapabilities caps = new GLCapabilities(glp);
+ final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
- Display display = NewtFactory.createDisplay(null); // local display
+ final Display display = NewtFactory.createDisplay(null); // local display
Assert.assertNotNull(display);
- Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ final Screen screen = NewtFactory.createScreen(display, 0); // screen 0
Assert.assertNotNull(screen);
- Window window0 = createWindow(screen, caps, "win0", 0, 0, width, height);
+ final Window window0 = createWindow(screen, caps, "win0", 0, 0, width, height);
Assert.assertNotNull(window0);
- List<MonitorMode> allMonitorModes = screen.getMonitorModes();
+ final List<MonitorMode> allMonitorModes = screen.getMonitorModes();
Assert.assertTrue(allMonitorModes.size()>0);
if(allMonitorModes.size()==1) {
// no support ..
@@ -123,7 +124,7 @@ public class TestScreenMode01aNEWT extends UITestCase {
return;
}
- MonitorDevice monitor = window0.getMainMonitor();
+ final MonitorDevice monitor = screen.getMonitorDevices().get(0);
List<MonitorMode> monitorModes = monitor.getSupportedModes();
Assert.assertTrue(monitorModes.size()>0);
@@ -135,13 +136,13 @@ public class TestScreenMode01aNEWT extends UITestCase {
}
Assert.assertTrue(allMonitorModes.containsAll(monitorModes));
- MonitorMode mmCurrent = monitor.queryCurrentMode();
- Assert.assertNotNull(mmCurrent);
- MonitorMode mmOrig = monitor.getOriginalMode();
+ final MonitorMode mmSet0 = monitor.queryCurrentMode();
+ Assert.assertNotNull(mmSet0);
+ final MonitorMode mmOrig = monitor.getOriginalMode();
Assert.assertNotNull(mmOrig);
System.err.println("[0] orig : "+mmOrig);
- System.err.println("[0] current: "+mmCurrent);
- Assert.assertEquals(mmCurrent, mmOrig);
+ System.err.println("[0] current: "+mmSet0);
+ Assert.assertEquals(mmSet0, mmOrig);
monitorModes = MonitorModeUtil.filterByFlags(monitorModes, 0); // no interlace, double-scan etc
@@ -171,44 +172,43 @@ public class TestScreenMode01aNEWT extends UITestCase {
Thread.sleep(waitTimeShort);
- // check manual reset ..
-
Assert.assertEquals(true,display.isNativeValid());
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window0.isNativeValid());
Assert.assertEquals(true,window0.isVisible());
- screen.addReference(); // keep it alive !
- Assert.assertTrue(monitor.setCurrentMode(mmOrig));
- Assert.assertFalse(monitor.isModeChangedByUs());
- Assert.assertEquals(mmOrig, monitor.getCurrentMode());
- Assert.assertNotSame(mm, monitor.getCurrentMode());
- Assert.assertEquals(mmOrig, monitor.queryCurrentMode());
-
+ // Auto reset by destruction!
destroyWindow(window0);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(window0, false));
+
Assert.assertEquals(false,window0.isVisible());
Assert.assertEquals(false,window0.isNativeValid());
- Assert.assertEquals(true,screen.isNativeValid()); // alive !
- Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertEquals(false,screen.isNativeValid());
+ Assert.assertEquals(false,display.isNativeValid());
Thread.sleep(waitTimeShort);
-
- Window window1 = createWindow(screen, caps, "win1",
- width+window0.getInsets().getTotalWidth(), 0,
- width, height);
- Assert.assertNotNull(window1);
- Assert.assertEquals(true,window1.isNativeValid());
- Assert.assertEquals(true,window1.isVisible());
- Thread.sleep(waitTimeShort);
+ validateScreenModeReset(mmOrig, 0);
+ }
+
+ void validateScreenModeReset(final MonitorMode mmOrig, int mmIdx) {
+ final Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+ final Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+ Assert.assertEquals(false,display.isNativeValid());
+ Assert.assertEquals(false,screen.isNativeValid());
+ screen.addReference();
+ Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertEquals(true,screen.isNativeValid());
- destroyWindow(window1);
- Assert.assertEquals(false,window1.isNativeValid());
- Assert.assertEquals(false,window1.isVisible());
+ final MonitorDevice monitor = screen.getMonitorDevices().get(0);
+ Assert.assertEquals(mmOrig, monitor.getCurrentMode());
screen.removeReference();
+ Assert.assertEquals(false,display.isNativeValid());
Assert.assertEquals(false,screen.isNativeValid());
- Assert.assertEquals(false,display.isNativeValid());
}
public static void main(String args[]) throws IOException {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java
index c80760c1f..fbd08b619 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java
@@ -46,6 +46,7 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
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;
import com.jogamp.opengl.util.Animator;
@@ -230,6 +231,8 @@ public class TestScreenMode01bNEWT extends UITestCase {
Thread.sleep(duration);
anim.stop();
destroyWindow(window0);
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(window0, false));
+
Assert.assertEquals(false,window0.isVisible());
Assert.assertEquals(false,window0.isNativeValid());
Assert.assertEquals(true,display.isNativeValid());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java
index 48ebaf86e..afb26d75c 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java
@@ -53,11 +53,17 @@ import com.jogamp.opengl.test.junit.util.UITestCase;
import java.util.List;
import javax.media.nativewindow.util.Dimension;
+import javax.media.nativewindow.util.Rectangle;
+import javax.media.nativewindow.util.RectangleImmutable;
/**
* Demonstrates fullscreen without MonitorMode change
* and fullscreen before and after MonitorMode change.
* <p>
+ * Also tests MonitorMode reset, by destroying the last Screen (reference),
+ * i.e. the original MonitorMode should get reinstated!
+ * </p>
+ * <p>
* Also documents NV RANDR/GL bug, see {@link TestScreenMode01dNEWT#cleanupGL()}.</p>
*/
public class TestScreenMode01dNEWT extends UITestCase {
@@ -137,7 +143,7 @@ public class TestScreenMode01dNEWT extends UITestCase {
}
@Test
- public void testFullscreenChange01() throws InterruptedException {
+ public void test01FullscreenChange01() throws InterruptedException {
Thread.sleep(waitTimeShort);
GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
@@ -183,7 +189,7 @@ public class TestScreenMode01dNEWT extends UITestCase {
}
@Test
- public void testScreenModeChange01() throws InterruptedException {
+ public void test02ScreenModeChange01() throws InterruptedException {
Thread.sleep(waitTimeShort);
GLCapabilities caps = new GLCapabilities(glp);
@@ -195,7 +201,8 @@ public class TestScreenMode01dNEWT extends UITestCase {
GLWindow window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */);
Assert.assertNotNull(window);
- MonitorDevice monitor = window.getMainMonitor();
+ final RectangleImmutable winRect = new Rectangle(window.getX(), window.getY(), window.getWidth(), window.getHeight());
+ final MonitorDevice monitor = screen.getMainMonitor(winRect);
List<MonitorMode> monitorModes = monitor.getSupportedModes();
Assert.assertTrue(monitorModes.size()>0);
@@ -244,8 +251,6 @@ public class TestScreenMode01dNEWT extends UITestCase {
Thread.sleep(waitTimeLong);
- // check reset ..
-
Assert.assertEquals(true,display.isNativeValid());
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window.isNativeValid());
@@ -265,33 +270,20 @@ public class TestScreenMode01dNEWT extends UITestCase {
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
- screen.createNative(); // trigger native re-creation
-
- Assert.assertEquals(true,display.isNativeValid());
- Assert.assertEquals(true,screen.isNativeValid());
-
- mmCurrent = monitor.getCurrentMode();
- System.err.println("[1] current/orig: "+mmCurrent);
- screen.destroy();
- Assert.assertEquals(false,screen.isNativeValid());
- Assert.assertEquals(false,display.isNativeValid());
-
- Assert.assertNotNull(mmCurrent);
- Assert.assertEquals(mmCurrent, mmOrig);
-
+ validateScreenModeReset(mmOrig, winRect);
cleanupGL();
}
@Test
- public void testScreenModeChangeWithFS01Pre() throws InterruptedException {
+ public void test03ScreenModeChangeWithFS01Post() throws InterruptedException {
Thread.sleep(waitTimeShort);
- testScreenModeChangeWithFS01Impl(true) ;
+ testScreenModeChangeWithFS01Impl(false) ;
}
@Test
- public void testScreenModeChangeWithFS01Post() throws InterruptedException {
+ public void test04ScreenModeChangeWithFS01Pre() throws InterruptedException {
Thread.sleep(waitTimeShort);
- testScreenModeChangeWithFS01Impl(false) ;
+ testScreenModeChangeWithFS01Impl(true) ;
}
protected void testScreenModeChangeWithFS01Impl(boolean preFS) throws InterruptedException {
@@ -302,7 +294,8 @@ public class TestScreenMode01dNEWT extends UITestCase {
Animator animator = new Animator(window);
animator.start();
- MonitorDevice monitor = window.getMainMonitor();
+ final RectangleImmutable winRect = new Rectangle(window.getX(), window.getY(), window.getWidth(), window.getHeight());
+ final MonitorDevice monitor = screen.getMainMonitor(winRect);
MonitorMode mmCurrent = monitor.queryCurrentMode();
Assert.assertNotNull(mmCurrent);
MonitorMode mmOrig = monitor.getOriginalMode();
@@ -347,8 +340,14 @@ public class TestScreenMode01dNEWT extends UITestCase {
Thread.sleep(waitTimeLong);
- // check reset ..
-
+ if(!preFS) {
+ System.err.println("[0] set !FS post 0: "+window.isFullscreen());
+ window.setFullscreen(false);
+ Assert.assertEquals(false, window.isFullscreen());
+ System.err.println("[0] set !FS post X: "+window.isFullscreen());
+ Thread.sleep(waitTimeShort);
+ }
+
Assert.assertEquals(true,display.isNativeValid());
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window.isNativeValid());
@@ -368,23 +367,29 @@ public class TestScreenMode01dNEWT extends UITestCase {
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
- screen.createNative(); // trigger native re-creation
+ validateScreenModeReset(mmOrig, winRect);
+ cleanupGL();
+ }
+ void validateScreenModeReset(final MonitorMode mmOrig, final RectangleImmutable rect) {
+ final Display display = NewtFactory.createDisplay(null); // local display
+ Assert.assertNotNull(display);
+ final Screen screen = NewtFactory.createScreen(display, 0); // screen 0
+ Assert.assertNotNull(screen);
+ Assert.assertEquals(false,display.isNativeValid());
+ Assert.assertEquals(false,screen.isNativeValid());
+ screen.addReference();
Assert.assertEquals(true,display.isNativeValid());
Assert.assertEquals(true,screen.isNativeValid());
- mmCurrent = monitor.getCurrentMode();
- System.err.println("[1] current/orig: "+mmCurrent);
- screen.destroy();
- Assert.assertEquals(false,screen.isNativeValid());
- Assert.assertEquals(false,display.isNativeValid());
-
- Assert.assertNotNull(mmCurrent);
- Assert.assertEquals(mmCurrent, mmOrig);
+ final MonitorDevice monitor = screen.getMainMonitor(rect);
+ Assert.assertEquals(mmOrig, monitor.getCurrentMode());
- cleanupGL();
+ screen.removeReference();
+ Assert.assertEquals(false,display.isNativeValid());
+ Assert.assertEquals(false,screen.isNativeValid());
}
-
+
public static void main(String args[]) throws IOException {
String tstname = TestScreenMode01dNEWT.class.getName();
org.junit.runner.JUnitCore.main(tstname);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java
index aee9c28c2..f261a24a5 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java
@@ -59,10 +59,6 @@ import javax.media.nativewindow.util.Dimension;
* <p>
* MonitorMode change does not use highest resolution.
* </p>
- * <p>
- * Also tests MonitorMode reset after last Screen is dereferenced,
- * i.e. MonitorMode should be reinstated.
- * </p>
*/
public class TestScreenMode02aNEWT extends UITestCase {
static GLProfile glp;
@@ -200,6 +196,7 @@ public class TestScreenMode02aNEWT extends UITestCase {
}
if(changeMode) {
+ // manual restore!
monitor.setCurrentMode(mmOrig);
Assert.assertFalse(monitor.isModeChangedByUs());
Assert.assertEquals(mmOrig, monitor.getCurrentMode());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java
index bd7ac55db..f0dbb1ffc 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java
@@ -204,17 +204,16 @@ public class TestScreenMode02bNEWT extends UITestCase {
window.setFullscreen(false);
}
+ // manual restore!
monitor.setCurrentMode(mmOrig);
Assert.assertFalse(monitor.isModeChangedByUs());
- Assert.assertEquals(mmOrig, monitor.getCurrentMode());
+ Assert.assertEquals(mmOrig, monitor.queryCurrentMode());
Thread.sleep(waitTimeShort);
if( preVis ) {
window.setFullscreen(false);
}
- // check auto reset ..
-
Assert.assertEquals(true,display.isNativeValid());
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window.isNativeValid());