diff options
author | Sven Gothel <[email protected]> | 2013-06-30 03:52:16 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-06-30 03:52:16 +0200 |
commit | 1c717a781702b0decb0c4da71a9dadc2a8255d5b (patch) | |
tree | 34ec8f1e183f8fff339c5bc8e6bb2e27e195a635 /src/test | |
parent | 95d3c4020f9871f3520e29d314c8ae6b3b42f9eb (diff) |
Add Comparable<?>: Point*, Dimension*, Rectangle*, SurfaceSize* and MonitorMode* ; Sort List<MonitorMode> in descending order to be well determined.
Add Comparable<?>: Point*, Dimension*, Rectangle*, SurfaceSize* and MonitorMode*:
- Compare square values
- See API doc for order of special semantics (flags, rotation, ..)
Sort List<MonitorMode> in descending order to be well determined:
- Removes order by native mode id, give user a reliable natural order.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java index 123199427..7a15971d5 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00aNEWT.java @@ -41,7 +41,9 @@ import com.jogamp.newt.MonitorDevice; import com.jogamp.newt.NewtFactory; import com.jogamp.newt.MonitorMode; import com.jogamp.newt.Screen; +import com.jogamp.newt.util.MonitorModeUtil; import com.jogamp.opengl.test.junit.util.UITestCase; + import java.util.Iterator; import java.util.List; import javax.media.nativewindow.util.Dimension; @@ -56,6 +58,9 @@ import jogamp.newt.MonitorModeProps; /** * Validating consistency of MonitorMode data from Screen (all modes) * and from a particular MonitorDevice. + * <p> + * Also validates the descending order of the given MonitorMode lists. + * </p> */ public class TestScreenMode00aNEWT extends UITestCase { static int screenIdx = 0; @@ -130,8 +135,27 @@ public class TestScreenMode00aNEWT extends UITestCase { Assert.assertTrue(allMonitorModes.size()>0); { int i=0; + MonitorMode mmPre = null; + for(Iterator<MonitorMode> iMode=allMonitorModes.iterator(); iMode.hasNext(); i++) { + final MonitorMode mm = iMode.next(); + System.err.println(String.format("All-0[%03d]: %s", i, mm)); + if( null != mmPre ) { + Assert.assertTrue("Wrong order", mmPre.compareTo(mm) >= 0); + } + mmPre = mm; + } + } + MonitorModeUtil.sort(allMonitorModes, true /* ascendingOrder*/); + { + int i=0; + MonitorMode mmPre = null; for(Iterator<MonitorMode> iMode=allMonitorModes.iterator(); iMode.hasNext(); i++) { - System.err.println("All["+i+"]: "+iMode.next()); + final MonitorMode mm = iMode.next(); + System.err.println(String.format("All-1[%03d]: %s", i, mm)); + if( null != mmPre ) { + Assert.assertTrue("Wrong order", mmPre.compareTo(mm) <= 0); + } + mmPre = mm; } } @@ -144,8 +168,14 @@ public class TestScreenMode00aNEWT extends UITestCase { List<MonitorMode> modes = monitor.getSupportedModes(); Assert.assertTrue(modes.size()>0); int i=0; + MonitorMode mmPre = null; for(Iterator<MonitorMode> iMode=modes.iterator(); iMode.hasNext(); i++) { - System.err.println("["+j+"]["+i+"]: "+iMode.next()); + final MonitorMode mm = iMode.next(); + System.err.println(String.format("[%02d][%03d]: %s", j, i, mm)); + if( null != mmPre ) { + Assert.assertTrue("Wrong order", mmPre.compareTo(mm) >= 0); + } + mmPre = mm; } Assert.assertTrue(allMonitorModes.containsAll(modes)); |