aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/test
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-04-16 05:40:09 +0200
committerSven Gothel <[email protected]>2010-04-16 05:40:09 +0200
commit60da84a5ca8fa5e74e995ad0343c8967ba9463a5 (patch)
tree629622e0882c754b9a1d1af4accb4d8206f4c2d6 /src/junit/com/jogamp/test
parent3d8679872f38a56026d87838451eb84da54509f6 (diff)
Fix broken Offscreen/Pbuffer query introduced in bd4904fb04ab2168aeaf76e74385b3991429289a
- Have to set the requested values in GLCapabilities if not relaxed and valid, otherwise the result is always onscreen, since the onscreen/pbuffer bits can be set for the same config. - Let GLContext implementations throw an Exception in case of no surface handle. JUnit Tests: - MiscUtils.setField -> MiscUtils.setFieldIfExists To allow _not_ throwing an exception :)
Diffstat (limited to 'src/junit/com/jogamp/test')
-rwxr-xr-xsrc/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java8
-rw-r--r--src/junit/com/jogamp/test/junit/util/MiscUtils.java5
2 files changed, 6 insertions, 7 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java
index 1a0553ded..55ad83d25 100755
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java
@@ -55,11 +55,11 @@ public class WindowUtilNEWT {
Assert.assertNotNull(demo);
Assert.assertNotNull(window);
if(debug) {
- MiscUtils.setField(demo, "glDebug", true);
- MiscUtils.setField(demo, "glTrace", true);
+ MiscUtils.setFieldIfExists(demo, "glDebug", true);
+ MiscUtils.setFieldIfExists(demo, "glTrace", true);
}
- if(!MiscUtils.setField(demo, "window", window)) {
- MiscUtils.setField(demo, "glWindow", glWindow);
+ if(!MiscUtils.setFieldIfExists(demo, "window", window)) {
+ MiscUtils.setFieldIfExists(demo, "glWindow", glWindow);
}
}
diff --git a/src/junit/com/jogamp/test/junit/util/MiscUtils.java b/src/junit/com/jogamp/test/junit/util/MiscUtils.java
index 8e53d9255..d28d0e7cb 100644
--- a/src/junit/com/jogamp/test/junit/util/MiscUtils.java
+++ b/src/junit/com/jogamp/test/junit/util/MiscUtils.java
@@ -40,13 +40,12 @@ public class MiscUtils {
try {
return Integer.parseInt(str);
} catch (Exception ex) {
- // FIXME
ex.printStackTrace();
}
return def;
}
- public static boolean setField(Object instance, String fieldName, Object value) {
+ public static boolean setFieldIfExists(Object instance, String fieldName, Object value) {
try {
Field f = instance.getClass().getField(fieldName);
if(value instanceof Boolean || f.getType().isInstance(value)) {
@@ -58,7 +57,7 @@ public class MiscUtils {
} catch (IllegalAccessException ex) {
throw new RuntimeException(ex);
} catch (NoSuchFieldException nsfe) {
- throw new RuntimeException(instance.getClass()+" has no '"+fieldName+"' field", nsfe);
+ // OK - throw new RuntimeException(instance.getClass()+" has no '"+fieldName+"' field", nsfe);
}
return false;
}