diff options
author | Sven Gothel <[email protected]> | 2019-04-09 22:20:53 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-04-09 22:20:53 +0200 |
commit | bb588480a2978da6b8ffec821821f19eb6a83e40 (patch) | |
tree | e94d0b2bb2eb4eb635592026fc1772ddd252f136 /src/test/com | |
parent | 705c7f7b3fb36c1d654f5d9b9016859506d93764 (diff) |
Cleanup AWTRobotUtil: Extract GLTestUtil + NewtTestUtil; all three based on TestUtil
Diffstat (limited to 'src/test/com')
32 files changed, 536 insertions, 287 deletions
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java index d122a0709..dfe6fca67 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java @@ -47,7 +47,7 @@ import com.jogamp.opengl.FBObject; import com.jogamp.opengl.test.junit.jogl.demos.es2.FBOMix2DemosES2; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.jogl.demos.es2.MultisampleDemoES2; -import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; /** @@ -339,7 +339,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { szStep = 1; glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); // SWAP_EVEN Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); // - SWAP_ODD glad.display(); // - SWAP_EVEN @@ -387,7 +387,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { szStep = 4; glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); // SWAP_ODD Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); // - SWAP_EVEN glad.display(); // - SWAP_ODD @@ -446,7 +446,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { szStep = 3; glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java index bf870b257..cddf002cf 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java @@ -56,6 +56,7 @@ import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; /** @@ -199,7 +200,7 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { // 1 - szStep = 2 final int[] expSurfaceSize = glad.getNativeSurface().convertToPixelUnits(new int[] { widthStep*szStep, heightStep*szStep }); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -210,7 +211,7 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { expSurfaceSize[1] = heightStep*szStep; glad.getNativeSurface().convertToPixelUnits(expSurfaceSize); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -221,7 +222,7 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { expSurfaceSize[1] = heightStep*szStep; glad.getNativeSurface().convertToPixelUnits(expSurfaceSize); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); snapshotGLEventListener.setMakeSnapshot(); glad.display(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java index daa784fbb..81dfe7b73 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java @@ -48,7 +48,7 @@ import org.junit.runners.MethodSorters; import com.jogamp.opengl.JoglVersion; 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.GLTestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; /** @@ -128,7 +128,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase { // 1 - szStep = 2 Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -136,7 +136,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase { szStep = 1; glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -144,7 +144,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase { szStep = 4; glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java index dad7fb1ed..d8e3c8c6e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java @@ -48,7 +48,7 @@ import org.junit.runners.MethodSorters; import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; -import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; /** @@ -128,7 +128,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase { // 1 - szStep = 2 Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -136,7 +136,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase { szStep = 1; glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -144,7 +144,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase { szStep = 4; glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLProfileDeviceNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLProfileDeviceNEWT.java index 1e264d21a..4ab7c5a2e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLProfileDeviceNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLProfileDeviceNEWT.java @@ -48,8 +48,8 @@ import org.junit.runners.MethodSorters; import com.jogamp.opengl.JoglVersion; 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.GLEventListenerCounter; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; /** @@ -104,14 +104,14 @@ public class TestGLAutoDrawableFactoryGLProfileDeviceNEWT extends UITestCase { // 1 - szStep = 2 Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); glad.display(); // 2, 3 (resize + display) szStep = 1; glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); glad.display(); Thread.sleep(50); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java index 7e53f9579..0936732bc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java @@ -48,7 +48,7 @@ import org.junit.runners.MethodSorters; import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; -import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; /** @@ -120,7 +120,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase { // 1 - szStep = 2 Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -128,7 +128,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase { szStep = 1; glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -136,7 +136,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase { szStep = 4; glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); + GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); snapshotGLEventListener.setMakeSnapshot(); glad.display(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java index 347463eae..b97de9975 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java @@ -55,6 +55,7 @@ import org.junit.runners.MethodSorters; import com.jogamp.opengl.JoglVersion; 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.GLTestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; /** @@ -198,7 +199,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { // 1 - szStep = 2 final int[] expSurfaceSize = glad.getNativeSurface().convertToPixelUnits(new int[] { widthStep*szStep, heightStep*szStep }); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -209,7 +210,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { expSurfaceSize[1] = heightStep*szStep; glad.getNativeSurface().convertToPixelUnits(expSurfaceSize); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); glad.display(); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -221,7 +222,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { expSurfaceSize[1] = heightStep*szStep; glad.getNativeSurface().convertToPixelUnits(expSurfaceSize); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); glad.display(); snapshotGLEventListener.setMakeSnapshot(); glad.display(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java index bb5861fdc..b95f6d97e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java @@ -52,6 +52,7 @@ import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; /** @@ -154,7 +155,7 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { // 1 - szStep = 2 final int[] expSurfaceSize = glad.getNativeSurface().convertToPixelUnits(new int[] { widthStep*szStep, heightStep*szStep }); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -165,7 +166,7 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { expSurfaceSize[1] = heightStep*szStep; glad.getNativeSurface().convertToPixelUnits(expSurfaceSize); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -176,7 +177,7 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { expSurfaceSize[1] = heightStep*szStep; glad.getNativeSurface().convertToPixelUnits(expSurfaceSize); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); snapshotGLEventListener.setMakeSnapshot(); glad.display(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java index 57d3fcb3d..1e05cf276 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java @@ -58,6 +58,7 @@ import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.JoglVersion; 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.GLTestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; /** @@ -210,7 +211,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase // 1 - szStep = 2 final int[] expSurfaceSize = glad.getNativeSurface().convertToPixelUnits(new int[] { widthStep*szStep, heightStep*szStep }); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -221,7 +222,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase expSurfaceSize[1] = heightStep*szStep; glad.getNativeSurface().convertToPixelUnits(expSurfaceSize); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); glad.display(); snapshotGLEventListener.setMakeSnapshot(); glad.display(); @@ -233,7 +234,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase expSurfaceSize[1] = heightStep*szStep; glad.getNativeSurface().convertToPixelUnits(expSurfaceSize); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glad, expSurfaceSize[0], expSurfaceSize[1])); glad.display(); snapshotGLEventListener.setMakeSnapshot(); glad.display(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java index 2a83912b9..cd1cfaced 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java @@ -77,8 +77,9 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.TestUtil; +import com.jogamp.opengl.test.junit.util.TestUtil.WindowClosingListener; import com.jogamp.opengl.test.junit.util.UITestCase; -import com.jogamp.opengl.test.junit.util.AWTRobotUtil.WindowClosingListener; import com.jogamp.opengl.util.Animator; @@ -553,7 +554,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase { */ public void testContextSharingCreateVisibleDestroy(final boolean useNewt, final boolean shareContext) throws InterruptedException, InvocationTargetException { final JFrame frame = new JFrame("Simple JOGL App for testing context sharing"); - final WindowClosingListener awtClosingListener = AWTRobotUtil.addClosingListener(frame); + final TestUtil.WindowClosingListener awtClosingListener = AWTRobotUtil.addClosingListener(frame); // // GLDrawableFactory factory = GLDrawableFactory.getFactory(GLProfile.get(GLProfile.GL2)); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java index ba7176ad0..2ea167979 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java @@ -41,6 +41,7 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.GLAutoDrawableDelegate; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1; @@ -104,7 +105,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase { // init and render one frame, which will setup the Gears display lists sharedDrawable.display(); final GLContext ctxM = sharedDrawable.getContext(); - Assert.assertTrue("Master ctx not created", AWTRobotUtil.waitForContextCreated(sharedDrawable, true)); + Assert.assertTrue("Master ctx not created", GLTestUtil.waitForContextCreated(sharedDrawable, true)); Assert.assertTrue("Master Ctx is shared before shared creation", !ctxM.isShared()); Assert.assertTrue("Master Gears is shared", !sharedGears.usesSharedGears()); } @@ -136,7 +137,7 @@ public class TestSharedContextVBOES1NEWT extends UITestCase { glWindow.setVisible(true); Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(glWindow, true)); MiscUtils.dumpSharedGLContext("Master Context", sharedDrawable.getContext()); MiscUtils.dumpSharedGLContext("New Context", glWindow.getContext()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java index bee121126..0b8a69576 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java @@ -39,6 +39,7 @@ import com.jogamp.opengl.awt.GLCanvas; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -137,17 +138,17 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); final GLContext ctx1 = c1.getContext(); @@ -284,17 +285,17 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); final GLContext ctx1 = c1.getContext(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java index 94238503e..8bbce1fba 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java @@ -39,6 +39,7 @@ import com.jogamp.opengl.awt.GLJPanel; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -128,17 +129,17 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); final GLContext ctx1 = c1.getContext(); @@ -237,17 +238,17 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); final GLContext ctx1 = c1.getContext(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java index fcca1884d..2819e05de 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java @@ -40,6 +40,7 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -94,7 +95,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true)); glWindow.display(); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(glWindow, true)); Assert.assertTrue("Gears not initialized", gears.waitForInit(true)); return glWindow; @@ -186,7 +187,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { f3.destroy(); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false)); { final List<GLContext> ctx1Shares = ctx1.getCreatedShares(); final List<GLContext> ctx2Shares = ctx2.getCreatedShares(); @@ -207,7 +208,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { f2.destroy(); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false)); { final List<GLContext> ctx1Shares = ctx1.getCreatedShares(); final List<GLContext> ctx2Shares = ctx2.getCreatedShares(); @@ -228,7 +229,7 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase { f1.destroy(); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false)); { final List<GLContext> ctx1Shares = ctx1.getCreatedShares(); final List<GLContext> ctx2Shares = ctx2.getCreatedShares(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java index 962d10bf4..102a01dff 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java @@ -39,6 +39,7 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -116,7 +117,7 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { // init and render one frame, which will setup the Gears display lists sharedDrawable.display(); final GLContext ctxM = sharedDrawable.getContext(); - Assert.assertTrue("Master ctx not created", AWTRobotUtil.waitForContextCreated(sharedDrawable, true)); + Assert.assertTrue("Master ctx not created", GLTestUtil.waitForContextCreated(sharedDrawable, true)); Assert.assertTrue("Master Ctx is shared before shared creation", !ctxM.isShared()); Assert.assertTrue("Master Gears not initialized", sharedGears.waitForInit(true)); System.err.println("Master Gears Init done: "+sharedGears); @@ -151,7 +152,7 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { glWindow.setVisible(true); Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(glWindow, true)); final GLContext sharedMasterContext = sharedDrawable.getContext(); MiscUtils.dumpSharedGLContext("Master Context", sharedMasterContext); @@ -193,13 +194,13 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { f3.destroy(); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false)); releaseShared(); } @@ -231,13 +232,13 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { f3.destroy(); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false)); releaseShared(); } @@ -264,13 +265,13 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { f3.destroy(); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false)); releaseShared(); } @@ -302,13 +303,13 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase { f3.destroy(); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false)); releaseShared(); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java index 83138c44b..4606c37db 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java @@ -39,6 +39,7 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -130,31 +131,31 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false)); f1.setVisible(true); // kick off f1 GLContext .. and hence allow f2 + f3 creation Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); final GLContext ctx1 = f1.getContext(); @@ -252,30 +253,30 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false)); f1.setVisible(true); // kicks off f1 GLContext .. and hence gears of f2 + f3 completion Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); final GLContext ctx1 = f1.getContext(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java index 6fd11c033..5eef967dc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java @@ -39,6 +39,7 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -131,22 +132,22 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false)); f1.setVisible(true); // kicks off f1 GLContext .. and hence gears of f2 + f3 completion Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); final GearsES2 g3 = new GearsES2(0); @@ -159,7 +160,7 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); final GLContext ctx1 = f1.getContext(); @@ -269,22 +270,22 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false)); f1.setVisible(true); // test pending creation of f2 Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); final Animator a3 = new Animator(); @@ -299,7 +300,7 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); final GLContext ctx1 = f1.getContext(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java index 61d109ba1..a89f1bcd0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java @@ -42,6 +42,7 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -134,31 +135,31 @@ public class TestSharedContextVBOES2NEWT4 extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false)); f1.setVisible(true); // kick off f1 GLContext .. and hence allow f2 + f3 creation Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); Assert.assertFalse("Unexpected exception (animator) caught", gotAnimException.get()); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java index 84ccfa8b5..248551118 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java @@ -37,7 +37,7 @@ import com.jogamp.opengl.GLProfile; import com.jogamp.nativewindow.swt.SWTAccessor; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.swt.GLCanvas; -import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -204,13 +204,13 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase { Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid) - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); final GLContext ctx1 = c1.getContext(); @@ -269,7 +269,7 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase { Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid) - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); final Animator a2 = new Animator(); @@ -298,10 +298,10 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase { } } ); a3.start(); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); final GLContext ctx1 = c1.getContext(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java index 8e52ea329..19bd85c7d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java @@ -36,6 +36,7 @@ import com.jogamp.opengl.awt.GLJPanel; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -118,17 +119,17 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); try { @@ -220,17 +221,17 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); try { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java index 58af4bf2d..f7d383d68 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java @@ -35,6 +35,7 @@ import com.jogamp.opengl.GLCapabilities; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.util.Animator; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; @@ -110,17 +111,17 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); try { @@ -193,17 +194,17 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase { Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true)); Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true)); Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true)); Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, true)); Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true)); - Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true)); + Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true)); Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true)); try { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java index b769e312c..e29e7cfd9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java @@ -32,8 +32,7 @@ import com.jogamp.nativewindow.*; import com.jogamp.opengl.*; import com.jogamp.opengl.util.Animator; - -import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.GLTestUtil; import com.jogamp.opengl.test.junit.util.MiscUtils; import com.jogamp.opengl.test.junit.util.UITestCase; import com.jogamp.opengl.test.junit.util.QuitAdapter; @@ -97,7 +96,7 @@ public class TestGearsNewtAWTWrapper extends UITestCase { glWindow.display(); final int[] expSurfaceSize = glWindow.getNativeSurface().convertToPixelUnits(new int[] { width/div, height/div }); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glWindow, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glWindow, expSurfaceSize[0], expSurfaceSize[1])); Thread.sleep(600); div = 2; @@ -107,7 +106,7 @@ public class TestGearsNewtAWTWrapper extends UITestCase { expSurfaceSize[1] = height/div; glWindow.getNativeSurface().convertToPixelUnits(expSurfaceSize); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glWindow, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glWindow, expSurfaceSize[0], expSurfaceSize[1])); Thread.sleep(600); div = 1; @@ -117,7 +116,7 @@ public class TestGearsNewtAWTWrapper extends UITestCase { expSurfaceSize[1] = height/div; glWindow.getNativeSurface().convertToPixelUnits(expSurfaceSize); Assert.assertTrue("Surface Size not reached: Expected "+expSurfaceSize[0]+"x"+expSurfaceSize[1]+", Is "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight(), - AWTRobotUtil.waitForSize(glWindow, expSurfaceSize[0], expSurfaceSize[1])); + GLTestUtil.waitForSize(glWindow, expSurfaceSize[0], expSurfaceSize[1])); Thread.sleep(600); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java index a93aaca79..da6cf66ac 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java @@ -47,8 +47,9 @@ import com.jogamp.newt.Window; import com.jogamp.newt.awt.NewtCanvasAWT; import com.jogamp.newt.opengl.GLWindow; import com.jogamp.opengl.test.junit.util.AWTRobotUtil; +import com.jogamp.opengl.test.junit.util.TestUtil; +import com.jogamp.opengl.test.junit.util.TestUtil.WindowClosingListener; import com.jogamp.opengl.test.junit.util.UITestCase; -import com.jogamp.opengl.test.junit.util.AWTRobotUtil.WindowClosingListener; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestCloseNewtAWT extends UITestCase { @@ -114,7 +115,7 @@ public class TestCloseNewtAWT extends UITestCase { }); Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); Assert.assertEquals(true, AWTRobotUtil.waitForRealized(newtWindow, true)); - final WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(frame); + final TestUtil.WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(frame); Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true, closingListener)); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java index 57f87ab97..68872b740 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java @@ -46,8 +46,9 @@ import com.jogamp.opengl.awt.GLCanvas; 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.TestUtil; +import com.jogamp.opengl.test.junit.util.TestUtil.WindowClosingListener; import com.jogamp.opengl.test.junit.util.UITestCase; -import com.jogamp.opengl.test.junit.util.AWTRobotUtil.WindowClosingListener; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestWindowClosingProtocol01AWT extends UITestCase { @@ -55,7 +56,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { @Test public void testCloseFrameGLCanvas() throws InterruptedException, InvocationTargetException { final Frame frame = new Frame("testCloseFrameGLCanvas AWT"); - final WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(frame); + final TestUtil.WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(frame); final GLProfile glp = GLProfile.getGL2ES2(); final GLCapabilities caps = new GLCapabilities(glp); final GLCanvas glCanvas = new GLCanvas(caps); @@ -115,7 +116,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase { @Test public void testCloseJFrameGLCanvas() throws InterruptedException, InvocationTargetException { final JFrame frame = new JFrame("testCloseJFrameGLCanvas AWT"); - final WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(frame); + final TestUtil.WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(frame); final GLProfile glp = GLProfile.getGL2ES2(); final GLCapabilities caps = new GLCapabilities(glp); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java index 8b639d5da..313a1dfb9 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java @@ -45,6 +45,7 @@ import com.jogamp.newt.opengl.GLWindow; 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.TestUtil; import com.jogamp.opengl.test.junit.util.UITestCase; @FixMethodOrder(MethodSorters.NAME_ASCENDING) @@ -55,7 +56,7 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase { final GLProfile glp = GLProfile.getGL2ES2(); final GLCapabilities caps = new GLCapabilities(glp); final GLWindow glWindow = GLWindow.create(caps); - final AWTRobotUtil.WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(glWindow); + final TestUtil.WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(glWindow); glWindow.addGLEventListener(new GearsES2()); glWindow.setSize(512, 512); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java index 1859a8f87..2661be4a5 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java @@ -47,8 +47,9 @@ import com.jogamp.opengl.GLProfile; 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.TestUtil; +import com.jogamp.opengl.test.junit.util.TestUtil.WindowClosingListener; import com.jogamp.opengl.test.junit.util.UITestCase; -import com.jogamp.opengl.test.junit.util.AWTRobotUtil.WindowClosingListener; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class TestWindowClosingProtocol03NewtAWT extends UITestCase { @@ -56,12 +57,12 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase { @Test public void testCloseJFrameNewtCanvasAWT() throws InterruptedException, InvocationTargetException { final JFrame frame = new JFrame("testCloseJFrameNewtCanvasAWT"); - final WindowClosingListener awtClosingListener = AWTRobotUtil.addClosingListener(frame); + final TestUtil.WindowClosingListener awtClosingListener = AWTRobotUtil.addClosingListener(frame); final GLProfile glp = GLProfile.getGL2ES2(); final GLCapabilities caps = new GLCapabilities(glp); final GLWindow glWindow = GLWindow.create(caps); - final AWTRobotUtil.WindowClosingListener newtClosingListener = AWTRobotUtil.addClosingListener(glWindow); + final TestUtil.WindowClosingListener newtClosingListener = AWTRobotUtil.addClosingListener(glWindow); glWindow.addGLEventListener(new GearsES2()); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java index d5ce78ce5..6cebda97a 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java @@ -188,7 +188,7 @@ public class TestParentingFocus01SwingAWTRobot extends UITestCase { // Should be OK to have the AWT component assume it also has the focus. // Assert.assertTrue("Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA, // AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA)); - if( !AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA) ) { + if( !TestUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA) ) { System.err.println("Info: Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA); } System.err.println("FOCUS NEWT Canvas/GLWindow sync"); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java index f9ae91fc8..278ff118b 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java @@ -212,7 +212,7 @@ public class TestParentingFocus02SwingAWTRobot extends UITestCase { // Should be OK to have the AWT component assume it also has the focus. // Assert.assertTrue("Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA, // AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA)); - if( !AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA) ) { + if( !TestUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA) ) { System.err.println("Info: Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA); } Assert.assertEquals(false, buttonNorthInnerFA.focusGained()); @@ -252,7 +252,7 @@ public class TestParentingFocus02SwingAWTRobot extends UITestCase { // Should be OK to have the AWT component assume it also has the focus. // Assert.assertTrue("Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA, // AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA)); - if( !AWTRobotUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA) ) { + if( !TestUtil.waitForFocus(glWindow1FA, newtCanvasAWTFA) ) { System.err.println("Info: Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA); } diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java index 477b761bd..65ba3239a 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java @@ -42,25 +42,19 @@ import java.awt.Robot; import com.jogamp.nativewindow.NativeWindow; import com.jogamp.nativewindow.NativeWindowFactory; +import com.jogamp.newt.Window; import com.jogamp.opengl.GLAutoDrawable; -import com.jogamp.opengl.GLContext; -import com.jogamp.opengl.GLDrawable; import org.junit.Assert; import com.jogamp.common.ExceptionUtils; import com.jogamp.common.util.awt.AWTEDTExecutor; -import com.jogamp.newt.event.WindowEvent; -public class AWTRobotUtil { +public class AWTRobotUtil extends TestUtil { static final boolean DEBUG = false; - public static final int RETRY_NUMBER = 5; public static final int ROBOT_DELAY = 100; // ms - public static final int TIME_OUT = 2000; // 2s - public static final int POLL_DIVIDER = 20; // TO/20 - public static final int TIME_SLICE = TIME_OUT / POLL_DIVIDER ; public static Integer AWT_CLICK_TO = null; static class OurUncaughtExceptionHandler implements UncaughtExceptionHandler { @@ -389,28 +383,12 @@ public class AWTRobotUtil { * * @return True if the Window became the global focused Window within TIME_OUT */ - public static boolean waitForFocus(final FocusEventCountAdapter gain, - final FocusEventCountAdapter lost) throws InterruptedException { - int wait; - for (wait=0; wait<POLL_DIVIDER; wait++) { - if( ( null == lost || lost.focusLost() ) && ( null == gain || gain.focusGained() ) ) { - return true; - } - Thread.sleep(TIME_SLICE); - } - return false; - } - - /** - * - * @return True if the Window became the global focused Window within TIME_OUT - */ public static boolean waitForFocus(final Object obj, final FocusEventCountAdapter gain, - final FocusEventCountAdapter lost) throws InterruptedException { + final FocusEventCountAdapter lost) throws InterruptedException { if(!waitForFocus(obj)) { return false; } - return waitForFocus(gain, lost); + return TestUtil.waitForFocus(gain, lost); } public static void assertRequestFocusAndWait(final Robot robot, final Object requestFocus, final Object waitForFocus, @@ -689,18 +667,6 @@ public class AWTRobotUtil { } /** - * - * @return True if the GLDrawable receives the expected size within TIME_OUT - */ - public static boolean waitForSize(final GLDrawable drawable, final int width, final int height) throws InterruptedException { - int wait; - for (wait=0; wait<POLL_DIVIDER && ( width != drawable.getSurfaceWidth() || height != drawable.getSurfaceHeight() ) ; wait++) { - Thread.sleep(TIME_SLICE); - } - return wait<POLL_DIVIDER; - } - - /** * @param obj the component to wait for * @param realized true if waiting for component to become realized, otherwise false * @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT @@ -718,29 +684,15 @@ public class AWTRobotUtil { * @throws InterruptedException */ public static boolean waitForRealized(final Object obj, final Runnable waitAction, final boolean realized) throws InterruptedException { - long t0 = System.currentTimeMillis(); - long t1 = t0; if(obj instanceof com.jogamp.newt.Screen) { - final com.jogamp.newt.Screen screen = (com.jogamp.newt.Screen) obj; - while( (t1-t0) < TIME_OUT && realized != screen.isNativeValid() ) { - if( null != waitAction ) { - waitAction.run(); - } else { - Thread.sleep(TIME_SLICE); - } - t1 = System.currentTimeMillis(); - } + return NewtTestUtil.waitForRealized((com.jogamp.newt.Screen) obj, waitAction, realized); } else if(obj instanceof com.jogamp.newt.Window) { - final com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj; - while( (t1-t0) < TIME_OUT && realized != win.isNativeValid() ) { - if( null != waitAction ) { - waitAction.run(); - } else { - Thread.sleep(TIME_SLICE); - } - t1 = System.currentTimeMillis(); - } + return NewtTestUtil.waitForRealized((com.jogamp.newt.Window) obj, waitAction, realized); + } else if(obj instanceof GLAutoDrawable) { + return GLTestUtil.waitForRealized((GLAutoDrawable) obj, waitAction, realized); } else if (NativeWindowFactory.isAWTAvailable() && obj instanceof java.awt.Component) { + long t0 = System.currentTimeMillis(); + long t1 = t0; final java.awt.Component comp = (java.awt.Component) obj; while( (t1-t0) < TIME_OUT && realized != comp.isShowing() ) { if( null != waitAction ) { @@ -778,45 +730,10 @@ public class AWTRobotUtil { System.err.println("XXX: FORCE REPAINT POST - glad: "+glad); } } - } else if(obj instanceof GLAutoDrawable) { - final GLAutoDrawable glad = (GLAutoDrawable) obj; - while( (t1-t0) < TIME_OUT && realized != glad.isRealized() ) { - if( null != waitAction ) { - waitAction.run(); - } else { - Thread.sleep(TIME_SLICE); - } - t1 = System.currentTimeMillis(); - } + return (t1-t0) < TIME_OUT; } else { throw new RuntimeException("Neither AWT nor NEWT nor GLAutoDrawable: "+obj); } - return (t1-t0) < TIME_OUT; - } - - /** - * - * @return True if the GLContext becomes created or not within TIME_OUT - */ - public static boolean waitForContextCreated(final GLAutoDrawable autoDrawable, final boolean created) throws InterruptedException { - if( null == autoDrawable ) { - return !created; - } - int wait; - for (wait=0; wait<POLL_DIVIDER ; wait++) { - final GLContext ctx = autoDrawable.getContext(); - if( created ) { - if( null != ctx && ctx.isCreated() ) { - break; - } - } else { - if( null == ctx || !ctx.isCreated() ) { - break; - } - } - Thread.sleep(TIME_SLICE); - } - return wait<POLL_DIVIDER; } /** @@ -831,9 +748,9 @@ public class AWTRobotUtil { * @return True if the Window is closing and closed (if willClose is true), each within TIME_OUT * @throws InterruptedException */ - public static boolean closeWindow(final Object obj, final boolean willClose, final WindowClosingListener closingListener) throws InterruptedException { - closingListener.reset(); + public static boolean closeWindow(final Object obj, final boolean willClose, final TestUtil.WindowClosingListener closingListener) throws InterruptedException { if(obj instanceof java.awt.Window) { + closingListener.reset(); final java.awt.Window win = (java.awt.Window) obj; final java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit(); final java.awt.EventQueue evtQ = tk.getSystemEventQueue(); @@ -841,24 +758,15 @@ public class AWTRobotUtil { public void run() { evtQ.postEvent(new java.awt.event.WindowEvent(win, java.awt.event.WindowEvent.WINDOW_CLOSING)); } }); + return waitUntilClosed(willClose, closingListener); } else if(obj instanceof com.jogamp.newt.Window) { - final com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj; - WindowImplAccess.windowDestroyNotify(win); - } - int wait; - for (wait=0; wait<POLL_DIVIDER && !closingListener.isWindowClosing(); wait++) { - Thread.sleep(TIME_SLICE); - } - if(wait<POLL_DIVIDER && willClose) { - for (wait=0; wait<POLL_DIVIDER && !closingListener.isWindowClosed(); wait++) { - Thread.sleep(TIME_SLICE); - } + return NewtTestUtil.closeWindow((com.jogamp.newt.Window) obj, willClose, closingListener); + } else { + throw new RuntimeException("Neither AWT nor NEWT: "+obj); } - return wait<POLL_DIVIDER; } - public static WindowClosingListener addClosingListener(final Object obj) { - WindowClosingListener cl = null; + public static TestUtil.WindowClosingListener addClosingListener(final Object obj) { if(obj instanceof java.awt.Window) { final java.awt.Window win = (java.awt.Window) obj; final AWTWindowClosingAdapter acl = new AWTWindowClosingAdapter(); @@ -866,26 +774,15 @@ public class AWTRobotUtil { public void run() { win.addWindowListener(acl); } } ); - cl = acl; + return acl; } else if(obj instanceof com.jogamp.newt.Window) { - final com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj; - final NEWTWindowClosingAdapter ncl = new NEWTWindowClosingAdapter(); - win.addWindowListener(ncl); - cl = ncl; + return addClosingListener(obj); } else { throw new RuntimeException("Neither AWT nor NEWT: "+obj); } - return cl; - } - public static interface WindowClosingListener { - void reset(); - public int getWindowClosingCount(); - public int getWindowClosedCount(); - public boolean isWindowClosing(); - public boolean isWindowClosed(); } static class AWTWindowClosingAdapter - extends java.awt.event.WindowAdapter implements WindowClosingListener + extends java.awt.event.WindowAdapter implements TestUtil.WindowClosingListener { AtomicInteger closing = new AtomicInteger(0); AtomicInteger closed = new AtomicInteger(0); @@ -918,40 +815,6 @@ public class AWTRobotUtil { return "AWTWindowClosingAdapter[closing "+closing+", closed "+closed+"]"; } } - static class NEWTWindowClosingAdapter - extends com.jogamp.newt.event.WindowAdapter implements WindowClosingListener - { - AtomicInteger closing = new AtomicInteger(0); - AtomicInteger closed = new AtomicInteger(0); - - public void reset() { - closing.set(0); - closed.set(0); - } - public int getWindowClosingCount() { - return closing.get(); - } - public int getWindowClosedCount() { - return closed.get(); - } - public boolean isWindowClosing() { - return 0 < closing.get(); - } - public boolean isWindowClosed() { - return 0 < closed.get(); - } - public void windowDestroyNotify(final WindowEvent e) { - closing.incrementAndGet(); - System.err.println("NEWTWindowClosingAdapter.windowDestroyNotify: "+this); - } - public void windowDestroyed(final WindowEvent e) { - closed.incrementAndGet(); - System.err.println("NEWTWindowClosingAdapter.windowDestroyed: "+this); - } - public String toString() { - return "NEWTWindowClosingAdapter[closing "+closing+", closed "+closed+"]"; - } - } } diff --git a/src/test/com/jogamp/opengl/test/junit/util/GLTestUtil.java b/src/test/com/jogamp/opengl/test/junit/util/GLTestUtil.java new file mode 100644 index 000000000..d7ab35055 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/util/GLTestUtil.java @@ -0,0 +1,98 @@ +/** + * Copyright 2019 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + + +package com.jogamp.opengl.test.junit.util; + +import com.jogamp.opengl.GLAutoDrawable; +import com.jogamp.opengl.GLContext; +import com.jogamp.opengl.GLDrawable; + +public class GLTestUtil extends TestUtil { + + /** + * @return True if the GLContext becomes created or not within TIME_OUT + */ + public static boolean waitForContextCreated(final GLAutoDrawable autoDrawable, final boolean created) throws InterruptedException { + if( null == autoDrawable ) { + return !created; + } + int wait; + for (wait=0; wait<POLL_DIVIDER ; wait++) { + final GLContext ctx = autoDrawable.getContext(); + if( created ) { + if( null != ctx && ctx.isCreated() ) { + break; + } + } else { + if( null == ctx || !ctx.isCreated() ) { + break; + } + } + Thread.sleep(TIME_SLICE); + } + return wait<POLL_DIVIDER; + } + + /** + * + * @return True if the GLDrawable receives the expected size within TIME_OUT + */ + public static boolean waitForSize(final GLDrawable drawable, final int width, final int height) throws InterruptedException { + int wait; + for (wait=0; wait<POLL_DIVIDER && ( width != drawable.getSurfaceWidth() || height != drawable.getSurfaceHeight() ) ; wait++) { + Thread.sleep(TIME_SLICE); + } + return wait<POLL_DIVIDER; + } + + /** + * @param glad the GLAutoDrawable to wait for + * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate + * @param realized true if waiting for component to become realized, otherwise false + * @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT + * @throws InterruptedException + */ + public static boolean waitForRealized(final GLAutoDrawable glad, final Runnable waitAction, final boolean realized) throws InterruptedException { + final long t0 = System.currentTimeMillis(); + long t1 = t0; + while( (t1-t0) < TIME_OUT && realized != glad.isRealized() ) { + if( null != waitAction ) { + waitAction.run(); + } else { + Thread.sleep(TIME_SLICE); + } + t1 = System.currentTimeMillis(); + } + return (t1-t0) < TIME_OUT; + } + +} + + + diff --git a/src/test/com/jogamp/opengl/test/junit/util/NewtTestUtil.java b/src/test/com/jogamp/opengl/test/junit/util/NewtTestUtil.java new file mode 100644 index 000000000..150b27262 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/util/NewtTestUtil.java @@ -0,0 +1,180 @@ +/** + * Copyright 2019 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + + +package com.jogamp.opengl.test.junit.util; + +import java.util.concurrent.atomic.AtomicInteger; + +import com.jogamp.common.util.awt.AWTEDTExecutor; +import com.jogamp.newt.Screen; +import com.jogamp.newt.Window; +import com.jogamp.newt.event.WindowEvent; +import com.jogamp.opengl.test.junit.util.AWTRobotUtil.AWTWindowClosingAdapter; + +import jogamp.newt.WindowImplAccess; + +public class NewtTestUtil extends TestUtil { + public static class NEWTWindowClosingAdapter + extends com.jogamp.newt.event.WindowAdapter implements TestUtil.WindowClosingListener + { + AtomicInteger closing = new AtomicInteger(0); + AtomicInteger closed = new AtomicInteger(0); + + public void reset() { + closing.set(0); + closed.set(0); + } + public int getWindowClosingCount() { + return closing.get(); + } + public int getWindowClosedCount() { + return closed.get(); + } + public boolean isWindowClosing() { + return 0 < closing.get(); + } + public boolean isWindowClosed() { + return 0 < closed.get(); + } + public void windowDestroyNotify(final WindowEvent e) { + closing.incrementAndGet(); + System.err.println("NEWTWindowClosingAdapter.windowDestroyNotify: "+this); + } + public void windowDestroyed(final WindowEvent e) { + closed.incrementAndGet(); + System.err.println("NEWTWindowClosingAdapter.windowDestroyed: "+this); + } + public String toString() { + return "NEWTWindowClosingAdapter[closing "+closing+", closed "+closed+"]"; + } + } + /** + * + * @return True if the Window became the global focused Window within TIME_OUT + */ + public static boolean waitForFocus(final Window win) throws InterruptedException { + int wait; + for (wait=0; wait<POLL_DIVIDER && !win.hasFocus(); wait++) { + Thread.sleep(TIME_SLICE); + } + return wait<POLL_DIVIDER; + } + + /** + * + * @return True if the Window became the global focused Window within TIME_OUT + */ + public static boolean waitForFocus(final Window win, final FocusEventCountAdapter gain, + final FocusEventCountAdapter lost) throws InterruptedException { + if(!waitForFocus(win)) { + return false; + } + return TestUtil.waitForFocus(gain, lost); + } + + /** + * + * @return True if the Component becomes <code>visible</code> within TIME_OUT + */ + public static boolean waitForVisible(final Window win, final boolean visible) throws InterruptedException { + int wait; + for (wait=0; wait<POLL_DIVIDER && visible != win.isVisible(); wait++) { + Thread.sleep(TIME_SLICE); + } + return wait<POLL_DIVIDER; + } + + /** + * @param screen the Screen to wait for + * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate + * @param realized true if waiting for component to become realized, otherwise false + * @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT + * @throws InterruptedException + */ + public static boolean waitForRealized(final Screen screen, final Runnable waitAction, final boolean realized) throws InterruptedException { + final long t0 = System.currentTimeMillis(); + long t1 = t0; + while( (t1-t0) < TIME_OUT && realized != screen.isNativeValid() ) { + if( null != waitAction ) { + waitAction.run(); + } else { + Thread.sleep(TIME_SLICE); + } + t1 = System.currentTimeMillis(); + } + return (t1-t0) < TIME_OUT; + } + /** + * @param win the Window to wait for + * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate + * @param realized true if waiting for component to become realized, otherwise false + * @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT + * @throws InterruptedException + */ + public static boolean waitForRealized(final Window win, final Runnable waitAction, final boolean realized) throws InterruptedException { + final long t0 = System.currentTimeMillis(); + long t1 = t0; + while( (t1-t0) < TIME_OUT && realized != win.isNativeValid() ) { + if( null != waitAction ) { + waitAction.run(); + } else { + Thread.sleep(TIME_SLICE); + } + t1 = System.currentTimeMillis(); + } + return (t1-t0) < TIME_OUT; + } + + public static TestUtil.WindowClosingListener addClosingListener(final Window win) { + final NewtTestUtil.NEWTWindowClosingAdapter ncl = new NewtTestUtil.NEWTWindowClosingAdapter(); + win.addWindowListener(ncl); + return ncl; + } + + /** + * Programmatically issue windowClosing on AWT or NEWT. + * Wait until the window is closing within TIME_OUT. + * + * @param obj either an AWT Window (Frame, JFrame) or NEWT Window + * @param willClose indicating that the window will close, hence this method waits for the window to be closed + * @param wcl the WindowClosingListener to determine whether the AWT or NEWT widget has been closed. It should be attached + * to the widget ASAP before any other listener, e.g. via {@link #addClosingListener(Object)}. + * The WindowClosingListener will be reset before attempting to close the widget. + * @return True if the Window is closing and closed (if willClose is true), each within TIME_OUT + * @throws InterruptedException + */ + public static boolean closeWindow(final Window win, final boolean willClose, final TestUtil.WindowClosingListener closingListener) throws InterruptedException { + closingListener.reset(); + WindowImplAccess.windowDestroyNotify(win); + return waitUntilClosed(willClose, closingListener); + } +} + + + diff --git a/src/test/com/jogamp/opengl/test/junit/util/TestUtil.java b/src/test/com/jogamp/opengl/test/junit/util/TestUtil.java new file mode 100644 index 000000000..cba8446f4 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/util/TestUtil.java @@ -0,0 +1,90 @@ +/** + * Copyright 2019 JogAmp Community. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of JogAmp Community. + */ + + +package com.jogamp.opengl.test.junit.util; + +import com.jogamp.newt.Window; + +import jogamp.newt.WindowImplAccess; + +public abstract class TestUtil { + interface WindowClosingListener { + void reset(); + public int getWindowClosingCount(); + public int getWindowClosedCount(); + public boolean isWindowClosing(); + public boolean isWindowClosed(); + } + public static final int RETRY_NUMBER = 5; + public static final int TIME_OUT = 2000; // 2s + public static final int POLL_DIVIDER = 20; // TO/20 + public static final int TIME_SLICE = TIME_OUT / POLL_DIVIDER ; + + /** + * + * @return True if the Window became the global focused Window within TIME_OUT + */ + public static boolean waitForFocus(final FocusEventCountAdapter gain, + final FocusEventCountAdapter lost) throws InterruptedException { + int wait; + for (wait=0; wait<POLL_DIVIDER; wait++) { + if( ( null == lost || lost.focusLost() ) && ( null == gain || gain.focusGained() ) ) { + return true; + } + Thread.sleep(TIME_SLICE); + } + return false; + } + + /** + * Wait until the window is closing within TIME_OUT. + * + * @param willClose indicating that the window will close, hence this method waits for the window to be closed + * @param wcl the WindowClosingListener to determine whether the AWT or NEWT widget has been closed. It should be attached + * to the widget ASAP before any other listener, e.g. via {@link #addClosingListener(Object)}. + * The WindowClosingListener will be reset before attempting to close the widget. + * @return True if the Window is closing and closed (if willClose is true), each within TIME_OUT + * @throws InterruptedException + */ + public static boolean waitUntilClosed(final boolean willClose, final TestUtil.WindowClosingListener closingListener) throws InterruptedException { + int wait; + for (wait=0; wait<POLL_DIVIDER && !closingListener.isWindowClosing(); wait++) { + Thread.sleep(TIME_SLICE); + } + if(wait<POLL_DIVIDER && willClose) { + for (wait=0; wait<POLL_DIVIDER && !closingListener.isWindowClosed(); wait++) { + Thread.sleep(TIME_SLICE); + } + } + return wait<POLL_DIVIDER; + } +} + + + |