From c6a20c623cc3f9fdf052a85ea0d779956a1ae954 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 4 Jul 2013 17:17:08 +0200 Subject: TestScreenMode*: Be more verbose setting screen mode. --- .../test/junit/newt/mm/TestScreenMode01aNEWT.java | 20 ++++++++---- .../test/junit/newt/mm/TestScreenMode01bNEWT.java | 37 ++++++++++++++-------- .../test/junit/newt/mm/TestScreenMode01dNEWT.java | 36 +++++++++++++++------ .../test/junit/newt/mm/TestScreenMode02aNEWT.java | 34 +++++++++++++------- .../test/junit/newt/mm/TestScreenMode02bNEWT.java | 32 +++++++++++++------ 5 files changed, 107 insertions(+), 52 deletions(-) (limited to 'src') 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 8846812e5..d756957d7 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 @@ -162,13 +162,19 @@ public class TestScreenMode01aNEWT extends UITestCase { Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); - MonitorMode mm = monitorModes.get(0); - System.err.println("[0] set current: "+mm); - Assert.assertTrue(monitor.setCurrentMode(mm)); - Assert.assertTrue(monitor.isModeChangedByUs()); - Assert.assertEquals(mm, monitor.getCurrentMode()); - Assert.assertNotSame(mmOrig, monitor.getCurrentMode()); - Assert.assertEquals(mm, monitor.queryCurrentMode()); + // set mode + { + MonitorMode mm = monitorModes.get(0); + System.err.println("[0] set current: "+mm); + final boolean smOk = monitor.setCurrentMode(mm); + MonitorMode mmCurrent = monitor.getCurrentMode(); + System.err.println("[0] has current: "+mmCurrent+", changeOK "+smOk); + Assert.assertTrue(monitor.isModeChangedByUs()); + Assert.assertEquals(mm, mmCurrent); + Assert.assertNotSame(mmOrig, mmCurrent); + Assert.assertEquals(mmCurrent, monitor.queryCurrentMode()); + Assert.assertTrue(smOk); + } Thread.sleep(waitTimeShort); 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 fbd08b619..2d70b42bb 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 @@ -197,15 +197,19 @@ public class TestScreenMode01bNEWT extends UITestCase { Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); - MonitorMode sm = (MonitorMode) monitorModes.get(0); - System.err.println("[1] set current: "+sm); - Assert.assertTrue(monitor.setCurrentMode(sm)); - mmCurrent = monitor.getCurrentMode(); - System.err.println("[1] current: "+mmCurrent); - Assert.assertTrue(monitor.isModeChangedByUs()); - Assert.assertEquals(sm, monitor.getCurrentMode()); - Assert.assertNotSame(mmOrig, monitor.getCurrentMode()); - Assert.assertEquals(sm, monitor.queryCurrentMode()); + // set mode + { + MonitorMode mm = monitorModes.get(0); + System.err.println("[0] set current: "+mm); + final boolean smOk = monitor.setCurrentMode(mm); + mmCurrent = monitor.getCurrentMode(); + System.err.println("[0] has current: "+mmCurrent+", changeOK "+smOk); + Assert.assertTrue(monitor.isModeChangedByUs()); + Assert.assertEquals(mm, mmCurrent); + Assert.assertNotSame(mmOrig, mmCurrent); + Assert.assertEquals(mmCurrent, monitor.queryCurrentMode()); + Assert.assertTrue(smOk); + } System.err.println("Test.1: Window screen: "+screen); System.err.println("Test.1: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getWidth()+"x"+window0.getHeight()+" within "+screen.getViewport()); @@ -218,11 +222,16 @@ public class TestScreenMode01bNEWT extends UITestCase { Assert.assertEquals(true,window0.isNativeValid()); Assert.assertEquals(true,window0.isVisible()); - Assert.assertTrue(monitor.setCurrentMode(mmOrig)); - Assert.assertFalse(monitor.isModeChangedByUs()); - Assert.assertEquals(mmOrig, monitor.getCurrentMode()); - Assert.assertNotSame(sm, monitor.getCurrentMode()); - Assert.assertEquals(mmOrig, monitor.queryCurrentMode()); + // manual restore! + { + System.err.println("[1] set orig: "+mmOrig); + final boolean smOk = monitor.setCurrentMode(mmOrig); + mmCurrent = monitor.getCurrentMode(); + System.err.println("[1] has orig?: "+mmCurrent+", changeOK "+smOk); + Assert.assertFalse(monitor.isModeChangedByUs()); + Assert.assertEquals(mmOrig, mmCurrent); + Assert.assertTrue(smOk); + } System.err.println("Test.2: Window screen: "+screen); System.err.println("Test.2: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getWidth()+"x"+window0.getHeight()+" within "+screen.getViewport()); 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 c480d1759..31829135b 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 @@ -241,13 +241,19 @@ public class TestScreenMode01dNEWT extends UITestCase { Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); - MonitorMode sm = (MonitorMode) monitorModes.get(0); - System.err.println("[0] set current: "+sm); - monitor.setCurrentMode(sm); - Assert.assertTrue(monitor.isModeChangedByUs()); - Assert.assertEquals(sm, monitor.getCurrentMode()); - Assert.assertNotSame(mmOrig, monitor.getCurrentMode()); - Assert.assertEquals(sm, monitor.queryCurrentMode()); + // set mode + { + MonitorMode sm = (MonitorMode) monitorModes.get(0); + System.err.println("[0] set current: "+sm); + final boolean smOk = monitor.setCurrentMode(sm); + mmCurrent = monitor.getCurrentMode(); + System.err.println("[0] has current: "+mmCurrent+", changeOK "+smOk); + Assert.assertTrue(monitor.isModeChangedByUs()); + Assert.assertEquals(sm, mmCurrent); + Assert.assertNotSame(mmOrig, mmCurrent); + Assert.assertEquals(mmCurrent, monitor.queryCurrentMode()); + Assert.assertTrue(smOk); + } Thread.sleep(waitTimeLong); @@ -327,10 +333,20 @@ public class TestScreenMode01dNEWT extends UITestCase { Assert.assertEquals(true, window.isFullscreen()); System.err.println("[0] set FS pre X: "+window.isFullscreen()); } - Thread.sleep(waitTimeShort); - System.err.println("[0] set current: "+monitorMode); - monitor.setCurrentMode(monitorMode); + + // set mode + { + System.err.println("[0] set current: "+monitorMode); + final boolean smOk = monitor.setCurrentMode(monitorMode); + mmCurrent = monitor.getCurrentMode(); + System.err.println("[0] has current: "+mmCurrent+", changeOK "+smOk); + Assert.assertTrue(monitor.isModeChangedByUs()); + Assert.assertEquals(monitorMode, mmCurrent); + Assert.assertNotSame(mmOrig, mmCurrent); + Assert.assertEquals(mmCurrent, monitor.queryCurrentMode()); + Assert.assertTrue(smOk); + } if(!preFS) { System.err.println("[0] set FS post 0: "+window.isFullscreen()); 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 f10477333..ceb732fda 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 @@ -149,7 +149,7 @@ public class TestScreenMode02aNEWT extends UITestCase { } Assert.assertTrue(monitorModes.size()>0); - final MonitorMode mmCurrent = monitor.getCurrentMode(); + MonitorMode mmCurrent = monitor.getCurrentMode(); Assert.assertNotNull(mmCurrent); System.err.println("[0] orig : "+mmOrig); System.err.println("[0] current: "+mmCurrent); @@ -175,13 +175,19 @@ public class TestScreenMode02aNEWT extends UITestCase { Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); - MonitorMode mm = (MonitorMode) monitorModes.get(0); - System.err.println("[0] set current: "+mm); - monitor.setCurrentMode(mm); - Assert.assertTrue(monitor.isModeChangedByUs()); - Assert.assertEquals(mm, monitor.getCurrentMode()); - Assert.assertNotSame(mmOrig, monitor.getCurrentMode()); - Assert.assertEquals(mm, monitor.queryCurrentMode()); + // set mode + { + MonitorMode mm = monitorModes.get(0); + System.err.println("[0] set current: "+mm); + final boolean smOk = monitor.setCurrentMode(mm); + mmCurrent = monitor.getCurrentMode(); + System.err.println("[0] has current: "+mmCurrent+", changeOK "+smOk); + Assert.assertTrue(monitor.isModeChangedByUs()); + Assert.assertEquals(mm, mmCurrent); + Assert.assertNotSame(mmOrig, mmCurrent); + Assert.assertEquals(mmCurrent, monitor.queryCurrentMode()); + Assert.assertTrue(smOk); + } } if( !preVis ) { @@ -201,9 +207,15 @@ public class TestScreenMode02aNEWT extends UITestCase { Thread.sleep(waitTimeShort); // manual restore! - monitor.setCurrentMode(mmOrig); - Assert.assertFalse(monitor.isModeChangedByUs()); - Assert.assertEquals(mmOrig, monitor.getCurrentMode()); + { + System.err.println("[1] set orig: "+mmOrig); + final boolean smOk = monitor.setCurrentMode(mmOrig); + MonitorMode mmCurrent = monitor.getCurrentMode(); + System.err.println("[1] has orig?: "+mmCurrent+", changeOK "+smOk); + Assert.assertFalse(monitor.isModeChangedByUs()); + Assert.assertEquals(mmOrig, mmCurrent); + Assert.assertTrue(smOk); + } Thread.sleep(waitTimeShort); } 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 f0dbb1ffc..4e1007fde 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 @@ -185,13 +185,19 @@ public class TestScreenMode02bNEWT extends UITestCase { Assert.assertNotNull(monitorModes); Assert.assertTrue(monitorModes.size()>0); - MonitorMode mm = monitorModes.get(0); // highest resolution .. - System.err.println("[0] set current: "+mm); - Assert.assertTrue(monitor.setCurrentMode(mm)); - Assert.assertTrue(monitor.isModeChangedByUs()); - Assert.assertEquals(mm, monitor.getCurrentMode()); - Assert.assertNotSame(mmOrig, monitor.getCurrentMode()); - Assert.assertEquals(mm, monitor.queryCurrentMode()); + // set mode + { + MonitorMode mm = monitorModes.get(0); // highest resolution .. + System.err.println("[0] set current: "+mm); + final boolean smOk = monitor.setCurrentMode(mm); + mmCurrent = monitor.getCurrentMode(); + System.err.println("[0] has current: "+mmCurrent+", changeOK "+smOk); + Assert.assertTrue(monitor.isModeChangedByUs()); + Assert.assertEquals(mm, mmCurrent); + Assert.assertNotSame(mmOrig, mmCurrent); + Assert.assertEquals(mmCurrent, monitor.queryCurrentMode()); + Assert.assertTrue(smOk); + } if( !preVis ) { window.setFullscreen(true); @@ -205,9 +211,15 @@ public class TestScreenMode02bNEWT extends UITestCase { } // manual restore! - monitor.setCurrentMode(mmOrig); - Assert.assertFalse(monitor.isModeChangedByUs()); - Assert.assertEquals(mmOrig, monitor.queryCurrentMode()); + { + System.err.println("[1] set orig: "+mmOrig); + final boolean smOk = monitor.setCurrentMode(mmOrig); + mmCurrent = monitor.getCurrentMode(); + System.err.println("[1] has orig?: "+mmCurrent+", changeOK "+smOk); + Assert.assertFalse(monitor.isModeChangedByUs()); + Assert.assertEquals(mmOrig, mmCurrent); + Assert.assertTrue(smOk); + } Thread.sleep(waitTimeShort); if( preVis ) { -- cgit v1.2.3