From c9bd1073d4fee2864162ac6f82380d538d33f322 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 2 Dec 2011 03:50:52 +0100 Subject: Test AWT Translucency: Use ReflectionUtil to use com.sun.awt.AWTUtilities, n/a on some AWT impl. --- .../opengl/test/junit/jogl/caps/TestTranslucencyAWT.java | 12 ++++++++++-- .../junit/newt/parenting/TestTranslucentParentingAWT.java | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src/test/com') diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java index e22163847..8e720965c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyAWT.java @@ -51,6 +51,7 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; +import com.jogamp.common.util.ReflectionUtil; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.util.Animator; @@ -80,8 +81,15 @@ public class TestTranslucencyAWT extends UITestCase { boolean capable1 = ( null != tcm ) ? tcm.getTransparency() == Transparency.TRANSLUCENT : false; boolean capable2 = false; try { - capable2 = com.sun.awt.AWTUtilities.isTranslucencyCapable(config); - } catch (Exception e) {} + capable2 = ((Boolean)ReflectionUtil.callStaticMethod( + "com.sun.awt.AWTUtilities", "isTranslucencyCapable", + new Class[] { GraphicsConfiguration.class }, + new Object[] { config } , + GraphicsConfiguration.class.getClassLoader())).booleanValue(); + System.err.println("com.sun.awt.AWTUtilities.isTranslucencyCapable(config) passed: "+capable2); + } catch (RuntimeException re) { + System.err.println("com.sun.awt.AWTUtilities.isTranslucencyCapable(config) failed: "+re.getMessage()); + } System.err.println(i+":"+j+" "+config+", "+tcm+", capable "+capable1+"/"+capable2); if(capable1&&capable2) { gc=configs[j]; diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java index 86a76f9ff..57b8517a6 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestTranslucentParentingAWT.java @@ -50,6 +50,7 @@ import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Test; +import com.jogamp.common.util.ReflectionUtil; import com.jogamp.newt.Window; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; @@ -89,8 +90,15 @@ public class TestTranslucentParentingAWT extends UITestCase { boolean capable1 = ( null != tcm ) ? tcm.getTransparency() == Transparency.TRANSLUCENT : false; boolean capable2 = false; try { - capable2 = com.sun.awt.AWTUtilities.isTranslucencyCapable(config); - } catch (Exception e) {} + capable2 = ((Boolean)ReflectionUtil.callStaticMethod( + "com.sun.awt.AWTUtilities", "isTranslucencyCapable", + new Class[] { GraphicsConfiguration.class }, + new Object[] { config } , + GraphicsConfiguration.class.getClassLoader())).booleanValue(); + System.err.println("com.sun.awt.AWTUtilities.isTranslucencyCapable(config) passed: "+capable2); + } catch (RuntimeException re) { + System.err.println("com.sun.awt.AWTUtilities.isTranslucencyCapable(config) failed: "+re.getMessage()); + } System.err.println(i+":"+j+" "+config+", "+tcm+", capable "+capable1+"/"+capable2); if(capable1&&capable2) { gc=configs[j]; -- cgit v1.2.3