summaryrefslogtreecommitdiffstats
path: root/src/test/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/com')
-rw-r--r--src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java3
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java7
-rw-r--r--src/test/com/jogamp/opengl/test/bugs/Issue344Base.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java32
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java25
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java1
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java11
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java24
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java18
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/GLProfile0XBase.java13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java11
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLProfileDeviceNEWT.java247
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java85
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java65
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java23
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextNewtAWTBug523.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES1NEWT.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3.java50
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2AWT3b.java49
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT0.java27
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT1.java86
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT2.java99
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT3.java87
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2NEWT4.java51
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextVBOES2SWT3.java60
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedExternalContextAWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java26
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java49
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java51
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase1.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug1225EventQueueInterruptedAWT.java378
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug1245JTabbedPanelCrashAWT.java228
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/GLClearOnInitReshape.java64
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LineSquareXDemoES2.java189
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java36
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/CrossFadePlayer.java7
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java32
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java36
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java14
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java231
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java5
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java148
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java46
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java32
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java22
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java25
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java17
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java35
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/javafx/PureJFXApp01.java54
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/javafx/TestNewtCanvasJFXGLn.java517
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java19
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java20
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor01.java200
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java256
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/ImageTstFiles.java128
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestImageTypeNEWT.java92
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java20
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java18
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureIONEWT.java165
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestBug1211IRQ00NEWT.java324
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestCloseNewtAWT.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java16
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java100
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java99
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestMultipleNewtCanvasAWT.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol01AWT.java31
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java9
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol03NewtAWT.java23
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestWindows02NEWT.java158
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus01SwingAWTRobot.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus02SwingAWTRobot.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java28
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java12
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java85
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtJFXReparentingKeyAdapter.java102
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtReparentingKeyAdapter.java111
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java158
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java10
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java38
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java13
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java318
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/GLTestUtil.java108
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java3
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/NEWTDemoListener.java468
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/NewtTestUtil.java206
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/TestUtil.java100
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/UITestCase.java3
197 files changed, 5524 insertions, 1953 deletions
diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
index e4fabbbcc..eff2aae49 100644
--- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
+++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2Activity.java
@@ -36,6 +36,7 @@ import com.jogamp.opengl.GLProfile;
import jogamp.newt.driver.android.NewtBaseActivity;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.newt.event.MonitorEvent;
import com.jogamp.newt.event.MouseAdapter;
import com.jogamp.newt.event.MouseEvent;
@@ -90,7 +91,7 @@ public class NEWTGearsES2Activity extends NewtBaseActivity {
public void mousePressed(final MouseEvent e) {
if( e.getPointerCount() == 3 ) {
Log.d(TAG, "MemoryHog");
- new Thread(new Runnable() {
+ new InterruptSource.Thread(null, new Runnable() {
public void run() {
final ArrayList<Buffer> buffers = new ArrayList<Buffer>();
while(true) {
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
index 89d28c08d..7430dcd38 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv0AppletAWT.java
@@ -27,7 +27,7 @@ import com.jogamp.opengl.GLRunnable;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.awt.GLCanvas;
import com.jogamp.opengl.glu.GLU;
-
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2;
@@ -98,7 +98,7 @@ public class Bug735Inv0AppletAWT extends Applet implements Runnable {
}
public void start() {
- thread = new Thread(this, "Animation Thread");
+ thread = new InterruptSource.Thread(null, this, "Animation Thread");
thread.start();
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
index 5019391ad..b31a5f410 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv1AppletAWT.java
@@ -27,7 +27,7 @@ import com.jogamp.opengl.GLRunnable;
import com.jogamp.opengl.GLUniformData;
import com.jogamp.opengl.awt.GLCanvas;
import com.jogamp.opengl.glu.GLU;
-
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2;
@@ -100,7 +100,7 @@ public class Bug735Inv1AppletAWT extends Applet implements Runnable {
}
public void start() {
- thread = new Thread(this, "Animation Thread");
+ thread = new InterruptSource.Thread(null, this, "Animation Thread");
thread.start();
}
diff --git a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java
index 1228f1453..d0e4448cc 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Bug735Inv2AppletAWT.java
@@ -20,7 +20,8 @@ import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.awt.GLCanvas;
-
+import com.jogamp.common.util.InterruptSource;
+import com.jogamp.junit.util.JunitTracer;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2;
@@ -82,7 +83,7 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
public void start() {
initDraw();
- thread = new Thread(this, "Animation Thread");
+ thread = new InterruptSource.Thread(null, this, "Animation Thread");
thread.start();
}
@@ -219,7 +220,7 @@ public class Bug735Inv2AppletAWT extends Applet implements Runnable {
System.err.println("swapInterval "+SWAP_INTERVAL);
System.err.println("exclusiveContext "+USE_ECT);
if(waitForKey) {
- UITestCase.waitForKey("Start");
+ JunitTracer.waitForKey("Start");
}
final GraphicsEnvironment environment =
diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java b/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java
index 184a2ef0f..7532ca6db 100644
--- a/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java
+++ b/src/test/com/jogamp/opengl/test/bugs/Issue344Base.java
@@ -6,6 +6,7 @@ import java.awt.Frame;
import java.awt.event.*;
import java.awt.geom.*;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.GLAutoDrawable;
@@ -49,7 +50,7 @@ public abstract class Issue344Base implements GLEventListener
frame.setSize(512, 512);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(final WindowEvent e) {
- new Thread(new Runnable() {
+ new InterruptSource.Thread(null, new Runnable() {
public void run() {
System.exit(0);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java b/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java
index 0666ec4db..38eda9adf 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/FontSet01.java
@@ -14,22 +14,22 @@ public class FontSet01 {
fonts[i++] = FontFactory.get(FontFactory.UBUNTU).getDefault(); // FontSet.FAMILY_REGULAR, FontSet.STYLE_NONE
fonts[i++] = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_REGULAR, FontSet.STYLE_ITALIC);
fonts[i++] = FontFactory.get(FontFactory.UBUNTU).get(FontSet.FAMILY_REGULAR, FontSet.STYLE_BOLD);
- fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class,
- "fonts/freefont/FreeMono.ttf").getInputStream(), true);
- fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class,
- "fonts/freefont/FreeMonoBold.ttf").getInputStream(), true);
- fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class,
- "fonts/freefont/FreeSans.ttf").getInputStream(), true);
- fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class,
- "fonts/freefont/FreeSansBold.ttf").getInputStream(), true);
- fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class,
- "fonts/freefont/FreeSerif.ttf").getInputStream(), true);
- fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class,
- "fonts/freefont/FreeSerifBold.ttf").getInputStream(), true);
- fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class,
- "fonts/freefont/FreeSerifBoldItalic.ttf").getInputStream(), true);
- fonts[i++] = FontFactory.get(IOUtil.getResource(TestTextRendererNEWTBugXXXX.class,
- "fonts/freefont/FreeSerifItalic.ttf").getInputStream(), true);
+ fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeMono.ttf",
+ TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true);
+ fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeMonoBold.ttf",
+ TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true);
+ fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSans.ttf",
+ TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true);
+ fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSansBold.ttf",
+ TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true);
+ fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerif.ttf",
+ TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true);
+ fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerifBold.ttf",
+ TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true);
+ fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerifBoldItalic.ttf",
+ TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true);
+ fonts[i++] = FontFactory.get(IOUtil.getResource("fonts/freefont/FreeSerifItalic.ttf",
+ TestTextRendererNEWTBugXXXX.class.getClassLoader(), TestTextRendererNEWTBugXXXX.class).getInputStream(), true);
return fonts;
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java
index 86b129fe1..f37f6b7e0 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java
@@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.graph;
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.util.Locale;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2ES2;
@@ -54,6 +55,7 @@ import com.jogamp.graph.curve.opengl.RenderState;
import com.jogamp.graph.font.Font;
import com.jogamp.graph.font.FontFactory;
import com.jogamp.graph.geom.SVertex;
+import com.jogamp.junit.util.JunitTracer;
import com.jogamp.newt.Window;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.util.MiscUtils;
@@ -73,7 +75,7 @@ public class TestTextRendererNEWT00 extends UITestCase {
static int GraphVBAASamples = 0;
static int GraphMSAASamples = 0;
static boolean ManualTest = false;
- static int SwapInterval = 0;
+ static int SwapInterval = 1;
static String fontFileName = null;
static URL fontURL = null;
@@ -213,7 +215,7 @@ public class TestTextRendererNEWT00 extends UITestCase {
window.display();
System.err.println("Chosen: "+window.getChosenGLCapabilities());
if( WaitStartEnd ) {
- UITestCase.waitForKey("Start");
+ JunitTracer.waitForKey("Start");
}
final RenderState rs = RenderState.createRenderState(SVertex.factory());
@@ -252,7 +254,7 @@ public class TestTextRendererNEWT00 extends UITestCase {
});
anim.stop();
if( WaitStartEnd ) {
- UITestCase.waitForKey("Stop");
+ JunitTracer.waitForKey("Stop");
}
destroyWindow(window);
}
@@ -342,7 +344,7 @@ public class TestTextRendererNEWT00 extends UITestCase {
public void printScreen(final int renderModes, final GLAutoDrawable drawable, final String dir, final String objName, final boolean exportAlpha) throws GLException, IOException {
final String modeS = Region.getRenderModeString(renderModes);
- final String bname = String.format("%s-msaa%02d-fontsz%02.1f-%03dx%03d-%s%04d", objName,
+ final String bname = String.format((Locale)null, "%s-msaa%02d-fontsz%02.1f-%03dx%03d-%s%04d", objName,
drawable.getChosenGLCapabilities().getNumSamples(),
TestTextRendererNEWT00.fontSizeFixed, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), modeS, vbaaSampleCount[0]);
final String filename = dir + bname +".png";
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java
index 4e66f6920..b452e091d 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java
@@ -29,6 +29,7 @@ package com.jogamp.opengl.test.junit.graph;
import java.io.File;
import java.io.IOException;
+import java.util.Locale;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2ES2;
@@ -102,7 +103,7 @@ public class TestTextRendererNEWT10 extends UITestCase {
forceGL3 = true;
} else if(args[i].equals("-font")) {
i++;
- font = FontFactory.get(IOUtil.getResource(TestTextRendererNEWT10.class, args[i]).getInputStream(), true);
+ font = FontFactory.get(IOUtil.getResource(args[i], TestTextRendererNEWT10.class.getClassLoader(), TestTextRendererNEWT10.class).getInputStream(), true);
} else if(args[i].equals("-fontSize")) {
i++;
fontSize = MiscUtils.atof(args[i], fontSize);
@@ -242,7 +243,7 @@ public class TestTextRendererNEWT10 extends UITestCase {
final String objName = getSimpleTestName(".")+"-snap"+screenshot_num;
screenshot_num++;
final String modeS = Region.getRenderModeString(renderModes);
- final String bname = String.format("%s-msaa%02d-fontsz%02.1f-%03dx%03d-%s%04d", objName,
+ final String bname = String.format((Locale)null, "%s-msaa%02d-fontsz%02.1f-%03dx%03d-%s%04d", objName,
drawable.getChosenGLCapabilities().getNumSamples(),
TestTextRendererNEWT10.fontSize, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), modeS, sampleCount);
final String filename = dir + bname +".png";
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java
index 678361f24..e6ae83911 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWTBugXXXX.java
@@ -29,6 +29,7 @@ package com.jogamp.opengl.test.junit.graph;
import java.io.File;
import java.io.IOException;
+import java.util.Locale;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2ES2;
@@ -212,7 +213,7 @@ public class TestTextRendererNEWTBugXXXX extends UITestCase {
final String objName = getSimpleTestName(".")+"-snap"+screenshot_num;
screenshot_num++;
final String modeS = Region.getRenderModeString(renderModes);
- final String bname = String.format("%s-msaa%02d-fontsz%02.1f-%03dx%03d-%s%04d", objName,
+ final String bname = String.format((Locale)null, "%s-msaa%02d-fontsz%02.1f-%03dx%03d-%s%04d", objName,
drawable.getChosenGLCapabilities().getNumSamples(),
TestTextRendererNEWTBugXXXX.fontSize, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), modeS, sampleCount);
final String filename = dir + bname +".png";
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
index 73b76debb..2d3b0664e 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java
@@ -47,6 +47,7 @@ import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.RenderState;
+import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener;
import com.jogamp.newt.opengl.GLWindow;
@@ -121,6 +122,17 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
@Override
public void init(final GLAutoDrawable drawable) {
+ final Object upObj = drawable.getUpstreamWidget();
+ if( upObj instanceof Window ) {
+ final Window window = (Window) upObj;
+ final float[] sDPI = window.getPixelsPerMM(new float[2]);
+ sDPI[0] *= 25.4f;
+ sDPI[1] *= 25.4f;
+ System.err.println("DPI "+sDPI[0]+" x "+sDPI[1]);
+
+ final float[] hasSurfacePixelScale1 = window.getCurrentSurfaceScale(new float[2]);
+ System.err.println("HiDPI PixelScale: "+hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
+ }
autoDrawable = drawable;
GL2ES2 gl = drawable.getGL().getGL2ES2();
if(debug) {
@@ -302,9 +314,16 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
@Override
public boolean run(final GLAutoDrawable drawable) {
final GL gl = drawable.getGL();
- int i = gl.getSwapInterval();
- i = i==0 ? 1 : 0;
+ final int _i = gl.getSwapInterval();
+ final int i;
+ switch(_i) {
+ case 0: i = -1; break;
+ case -1: i = 1; break;
+ case 1: i = 0; break;
+ default: i = 1; break;
+ }
gl.setSwapInterval(i);
+
final GLAnimatorControl a = drawable.getAnimator();
if( null != a ) {
a.resetFPSCounter();
@@ -312,7 +331,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener {
if(drawable instanceof FPSCounter) {
((FPSCounter)drawable).resetFPSCounter();
}
- System.err.println("Swap Interval: "+i);
+ System.err.println("Swap Interval: "+_i+" -> "+i+" -> "+gl.getSwapInterval());
return true;
}
});
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java
index f7e779cd3..bf0a907b0 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextGLListener0A.java
@@ -34,7 +34,6 @@ import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.RenderState;
-import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.geom.SVertex;
import com.jogamp.newt.opengl.GLWindow;
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
index c648708d4..945204052 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java
@@ -165,9 +165,14 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB
super.init(drawable);
final Object upObj = drawable.getUpstreamWidget();
if( upObj instanceof Window ) {
- final float[] pixelsPerMM = new float[2];
- ((Window)upObj).getPixelsPerMM(pixelsPerMM);
- dpiH = pixelsPerMM[1]*25.4f;
+ final Window window = (Window) upObj;
+ final float[] sDPI = window.getPixelsPerMM(new float[2]);
+ sDPI[0] *= 25.4f;
+ sDPI[1] *= 25.4f;
+ dpiH = sDPI[1];
+ System.err.println("Using screen DPI of "+dpiH);
+ } else {
+ System.err.println("Using default DPI of "+dpiH);
}
fontNameBox = font.getMetricBounds(fontName, font.getPixelSize(fontSizeFName, dpiH));
switchHeadBox();
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
index 4bb72bbd2..a55ed26c0 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java
@@ -6,6 +6,7 @@ import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.Locale;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2ES2;
@@ -16,6 +17,7 @@ import com.jogamp.opengl.GLPipelineFactory;
import com.jogamp.opengl.GLRunnable;
import com.jogamp.common.net.Uri;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.curve.opengl.RenderState;
@@ -354,7 +356,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
button.addMouseListener(new UIShape.MouseGestureAdapter() {
@Override
public void mouseClicked(final MouseEvent e) {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
if( null != cDrawable ) {
final GLAnimatorControl actrl = cDrawable.getAnimator();
@@ -521,6 +523,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
mPlayer.setTextureUnit(texUnitMediaPlayer);
final MediaPlayerButton mPlayerButton = new MediaPlayerButton(renderer.getRenderState().getVertexFactory(), renderModes,
button2XSize, button2YSize, mPlayer);
+ mPlayerButton.setVerbose(true);
mPlayerButton.addDefaultEventListener();
mPlayerButton.translate(xStartRight, yStartTop - diffY*1, 0f);
mPlayerButton.setToggleable(true);
@@ -665,14 +668,17 @@ public class GPUUISceneGLListener0A implements GLEventListener {
if( upObj instanceof Window ) {
final Window upWin = (Window)upObj;
final MonitorDevice mm = upWin.getMainMonitor();
- final float[] monitorPixelsPerMM = mm.getPixelsPerMM(new float[2]);
- final float monitorDpiH = monitorPixelsPerMM[1]*25.4f;
- final float[] surfacePixelsPerMM = upWin.getPixelsPerMM(new float[2]);
- dpiH = surfacePixelsPerMM[1]*25.4f;
+ final float[] monitorDPI = mm.getPixelsPerMM(new float[2]);
+ monitorDPI[0] *= 25.4f;
+ monitorDPI[1] *= 25.4f;
+ final float[] sDPI = upWin.getPixelsPerMM(new float[2]);
+ sDPI[0] *= 25.4f;
+ sDPI[1] *= 25.4f;
+ dpiH = sDPI[1];
System.err.println("Monitor detected: "+mm);
- System.err.println("Monitor dpi: "+monitorDpiH);
+ System.err.println("Monitor dpi: "+monitorDPI[0]+" x "+monitorDPI[1]);
System.err.println("Surface scale: native "+Arrays.toString(upWin.getMaximumSurfaceScale(new float[2]))+", current "+Arrays.toString(upWin.getCurrentSurfaceScale(new float[2])));
- System.err.println("Surface dpi: "+dpiH);
+ System.err.println("Surface dpi "+sDPI[0]+" x "+sDPI[1]);
} else {
System.err.println("Using default DPI of "+dpiH);
}
@@ -785,7 +791,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
public void printScreen(final GL gl) {
final String modeS = Region.getRenderModeString(jogampLabel.getRenderModes());
- final String filename = String.format("GraphUIDemo-shot%03d-%03dx%03d-S_%s_%02d.png",
+ final String filename = String.format((Locale)null, "GraphUIDemo-shot%03d-%03dx%03d-S_%s_%02d.png",
shotCount++, renderer.getWidth(), renderer.getHeight(),
modeS, sceneUIController.getSampleCount());
gl.glFinish(); // just make sure rendering finished ..
@@ -943,7 +949,7 @@ public class GPUUISceneGLListener0A implements GLEventListener {
// final float dy = -(ny - dragLastY);
shapeEvent.shape.translate(dx, dy, 0f);
final float[] tx = shapeEvent.shape.getTranslate();
- actionText = String.format("Pos %6.2f / %6.2f / %6.2f", tx[0], tx[1], tx[2]);
+ actionText = String.format((Locale)null, "Pos %6.2f / %6.2f / %6.2f", tx[0], tx[1], tx[2]);
}
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java
index 8b5b70239..721fe9cb0 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtCanvasAWTDemo.java
@@ -180,10 +180,6 @@ public class GPUUISceneNewtCanvasAWTDemo {
frame.setVisible(true);
}
});
- final float[] hasSurfacePixelScale1 = window.getCurrentSurfaceScale(new float[2]);
- System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+
- valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+
- hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
animator.start();
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java
index aa6dd00cc..3053ed40a 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java
@@ -145,10 +145,6 @@ public class GPUUISceneNewtDemo {
});
window.setVisible(true);
- final float[] hasSurfacePixelScale1 = window.getCurrentSurfaceScale(new float[2]);
- System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+
- valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+
- hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
animator.start();
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java
index bdde61ad9..44e2c6034 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/MediaPlayerButton.java
@@ -28,7 +28,7 @@
package com.jogamp.opengl.test.junit.graph.demos.ui;
import com.jogamp.opengl.GL2ES2;
-
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.geom.Vertex;
import com.jogamp.graph.geom.Vertex.Factory;
@@ -41,7 +41,7 @@ import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame;
* GPU based resolution independent {@link GLMediaPlayer} Button impl
*/
public class MediaPlayerButton extends TextureSeqButton {
- public boolean verbose = false;
+ private boolean verbose = false;
/**
* @param factory
@@ -62,6 +62,8 @@ public class MediaPlayerButton extends TextureSeqButton {
setEnabled(false); // data and shader n/a yet
}
+ public void setVerbose(final boolean v) { verbose = v; }
+
/**
* Add the default {@link GLMediaEventListener} to {@link #getGLMediaPlayer() this class's GLMediaPlayer}.
*/
@@ -91,7 +93,7 @@ public class MediaPlayerButton extends TextureSeqButton {
// FIXME: mPlayer.resetGLState();
}
if( 0 != ( GLMediaEventListener.EVENT_CHANGE_EOS & event_mask ) ) {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
// loop for-ever ..
mPlayer.seek(0);
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java
index 2e3d2fac3..ab5bfb926 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java
@@ -32,6 +32,7 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
+import com.jogamp.opengl.FPSCounter;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2ES2;
import com.jogamp.opengl.GLAnimatorControl;
@@ -285,16 +286,27 @@ public abstract class UIListenerBase01 implements GLEventListener {
else if(arg0.getKeyCode() == KeyEvent.VK_V) {
if(null != autoDrawable) {
autoDrawable.invoke(false, new GLRunnable() {
+ @Override
public boolean run(final GLAutoDrawable drawable) {
final GL gl = drawable.getGL();
- int i = gl.getSwapInterval();
- i = i==0 ? 1 : 0;
+ final int _i = gl.getSwapInterval();
+ final int i;
+ switch(_i) {
+ case 0: i = 1; break;
+ case 1: i = -1; break;
+ case -1: i = 0; break;
+ default: i = 1; break;
+ }
gl.setSwapInterval(i);
+
final GLAnimatorControl a = drawable.getAnimator();
if( null != a ) {
a.resetFPSCounter();
}
- System.err.println("Swap Interval: "+i);
+ if(drawable instanceof FPSCounter) {
+ ((FPSCounter)drawable).resetFPSCounter();
+ }
+ System.err.println("Swap Interval: "+_i+" -> "+i+" -> "+gl.getSwapInterval());
return true;
}
});
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLProfile0XBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLProfile0XBase.java
index 7fd3488ba..add8113bc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLProfile0XBase.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLProfile0XBase.java
@@ -43,9 +43,10 @@ import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.PropertyAccess;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.JoglVersion;
-import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -871,8 +872,8 @@ public abstract class GLProfile0XBase extends UITestCase {
glWindow.setSize(128, 128);
glWindow.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glWindow, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glWindow, true, null));
glWindow.display();
Thread.sleep(100);
@@ -884,8 +885,8 @@ public abstract class GLProfile0XBase extends UITestCase {
glWindow.getContext().isCreatedWithARBMethod());
}
glWindow.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glWindow, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glWindow, false, null));
}
protected void validateOnlineOffscreen(final String requestedProfile, final GLCapabilitiesImmutable caps)
@@ -915,7 +916,7 @@ public abstract class GLProfile0XBase extends UITestCase {
Thread.sleep(100);
// Same definition as in GLProfile for 'disableOpenGLARBContext'
final boolean isOSX = Platform.OSType.MACOS == Platform.getOSType();
- final boolean disableOpenGLARBContext = null != System.getProperty("jogl.disable.openglarbcontext") && !isOSX;
+ final boolean disableOpenGLARBContext = PropertyAccess.isPropertyDefined("jogl.disable.openglarbcontext", true) && !isOSX;
if( disableOpenGLARBContext ) {
Assert.assertFalse("Property 'jogl.disable.openglarbcontext' set, but created w/ ARB",
glad.getContext().isCreatedWithARBMethod());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java
index 7b28c6896..cf0adab67 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00BaseAWT.java
@@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.acore;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
+import java.util.Locale;
import javax.imageio.ImageIO;
import com.jogamp.opengl.GL;
@@ -85,7 +86,7 @@ public abstract class GLReadBuffer00BaseAWT extends GLReadBuffer00Base {
}
public void snapshot(final int sn, final GL gl, final String fileSuffix, final String destPath) {
final GLDrawable drawable = gl.getContext().getGLReadDrawable();
- final String postSNDetail = String.format("awt-usr%03d", textRendererGLEL.userCounter);
+ final String postSNDetail = String.format((Locale)null, "awt-usr%03d", textRendererGLEL.userCounter);
final String filenameAWT = getSnapshotFilename(sn, postSNDetail,
drawable.getChosenGLCapabilities(), drawable.getSurfaceWidth(), drawable.getSurfaceHeight(),
glReadBufferUtil.hasAlpha(), fileSuffix, destPath);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java
index 3379129dd..7a5b49168 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/InitConcurrentBaseNEWT.java
@@ -28,6 +28,8 @@
package com.jogamp.opengl.test.junit.jogl.acore;
+import com.jogamp.common.util.InterruptSource;
+import com.jogamp.common.util.InterruptedRuntimeException;
import com.jogamp.nativewindow.Capabilities;
import com.jogamp.nativewindow.util.InsetsImmutable;
import com.jogamp.opengl.GLCapabilities;
@@ -194,11 +196,11 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase {
final String currentThreadName = Thread.currentThread().getName();
final Object syncDone = new Object();
final JOGLTask[] tasks = new JOGLTask[num];
- final Thread[] threads = new Thread[num];
+ final InterruptSource.Thread[] threads = new InterruptSource.Thread[num];
int i;
for(i=0; i<num; i++) {
tasks[i] = new JOGLTask(syncDone, i, reuse);
- threads[i] = new Thread(tasks[i], currentThreadName+"-jt"+i);
+ threads[i] = new InterruptSource.Thread(null, tasks[i], currentThreadName+"-jt"+i);
}
final long t0 = System.currentTimeMillis();
@@ -211,7 +213,7 @@ public abstract class InitConcurrentBaseNEWT extends UITestCase {
try {
syncDone.wait(500);
} catch (final InterruptedException e) {
- throw new RuntimeException(e);
+ throw new InterruptedRuntimeException(e);
}
System.err.println(i+": "+doneDump(tasks));
i++;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java
index 42646c07e..402358899 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestBug1146GLContextDialogToolTipAWT.java
@@ -52,6 +52,7 @@ import org.junit.Test;
import org.junit.runners.MethodSorters;
import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLCapabilitiesImmutable;
import com.jogamp.opengl.GLProfile;
@@ -127,13 +128,13 @@ public class TestBug1146GLContextDialogToolTipAWT extends UITestCase {
final String cancelButtonText = UIManager.getString("FileChooser.cancelButtonText",l);
// launch robot action ..
- new Thread()
+ new InterruptSource.Thread()
{
public void run()
{
try {
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(fileChooser, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(fileChooser, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas1, true, null));
final Point approveButtonPos;
final AbstractButton approveButton = findButton(0, fileChooser, approveButtonText);
@@ -161,7 +162,7 @@ public class TestBug1146GLContextDialogToolTipAWT extends UITestCase {
// hover to 'approve' -> tool tip
if( null != approveButtonPos ) {
AWTRobotUtil.mouseMove(robot, approveButtonPos, MOVE_ITER, MOVE_DELAY);
- Thread.sleep(TOOLTIP_WAIT);
+ java.lang.Thread.sleep(TOOLTIP_WAIT);
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
@@ -173,7 +174,7 @@ public class TestBug1146GLContextDialogToolTipAWT extends UITestCase {
} catch (final InvocationTargetException e) {
e.printStackTrace();
}
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas2, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas2, true, null));
}
if( null != cancelButtonPos ) {
AWTRobotUtil.mouseClick(robot, cancelButtonPos, MOVE_ITER, MOVE_DELAY, ACTION_DELAY);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java
index fd012e86f..a034f9c8a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableDeadlockAWT.java
@@ -44,6 +44,7 @@ import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.common.util.RunnableTask;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -83,7 +84,7 @@ public class TestFBOAutoDrawableDeadlockAWT extends UITestCase {
System.err.println("BB.0: "+rTask.getSyncObject());
synchronized (rTask.getSyncObject()) {
System.err.println("BB.1: "+rTask.getSyncObject());
- new Thread(rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
+ new InterruptSource.Thread(null, rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
try {
System.err.println("BB.2");
rTask.getSyncObject().wait();
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..05aea5ac7 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, null));
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, null));
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, null));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java
index f2e8b86af..3f5540501 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java
@@ -32,13 +32,14 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
@@ -114,7 +115,7 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
if( 3 == c ) {
demo.setMSAA(4);
} else if( 6 == c ) {
- new Thread() {
+ new InterruptSource.Thread() {
@Override
public void run() {
glWindow.setSize(dw+64, dh+64);
@@ -124,14 +125,14 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
} else if( 12 == c ) {
demo.setMSAA(0);
} else if( 15 == c ) {
- new Thread() {
+ new InterruptSource.Thread() {
@Override
public void run() {
glWindow.setSize(dw+128, dh+128);
} }.start();
} else if( 18 == c ) {
c=0;
- new Thread() {
+ new InterruptSource.Thread() {
@Override
public void run() {
glWindow.setSize(dw+256, dh+256);
@@ -167,7 +168,7 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
}
System.err.println("*** "+e);
if(e.getKeyChar()=='f') {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
glWindow.setFullscreen(!glWindow.isFullscreen());
@@ -205,7 +206,7 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase {
Assert.assertFalse(animator.isAnimating());
Assert.assertFalse(animator.isStarted());
glWindow.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null));
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
index 26d510a45..b0b9b53e4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
@@ -35,8 +35,8 @@ import java.io.InputStreamReader;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
@@ -48,7 +48,7 @@ import com.jogamp.opengl.test.junit.jogl.demos.GLFinishOnDisplay;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.jogl.demos.es2.Mix2TexturesES2;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
-
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.nativewindow.NativeSurface;
import com.jogamp.nativewindow.SurfaceUpdatedListener;
import com.jogamp.opengl.GL;
@@ -192,7 +192,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
}
if(9 == c) {
c=0;
- new Thread() {
+ new InterruptSource.Thread() {
@Override
public void run() {
glWindow.setSize(dw+256, dh+256);
@@ -258,7 +258,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
fbod2.destroy();
glWindow.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null));
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java
index 0586eef8e..2bc512fa0 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java
@@ -35,8 +35,8 @@ import java.io.InputStreamReader;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
@@ -46,7 +46,7 @@ import com.jogamp.opengl.util.texture.TextureIO;
import com.jogamp.opengl.test.junit.jogl.demos.GLFinishOnDisplay;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.jogl.demos.es2.Mix2TexturesES2;
-
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.nativewindow.NativeSurface;
import com.jogamp.nativewindow.SurfaceUpdatedListener;
import com.jogamp.opengl.GL;
@@ -178,7 +178,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
}
if(9 == c) {
c=0;
- new Thread() {
+ new InterruptSource.Thread() {
@Override
public void run() {
glWindow.setSize(dw+256, dh+256);
@@ -231,7 +231,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
fbod1.destroy();
glWindow.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null));
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java
index ff05b63a1..4432fad3e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java
@@ -50,8 +50,8 @@ import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowUpdateEvent;
import com.jogamp.opengl.GLAutoDrawableDelegate;
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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
@@ -83,8 +83,8 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase {
Assert.assertNotNull(window);
window.setSize(640, 400);
window.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(window, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, true, null));
System.out.println("Window: "+window.getClass().getName());
final GLDrawable drawable = factory.createGLDrawable(window);
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..4f666920a 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
@@ -55,7 +55,8 @@ import com.jogamp.opengl.GLAutoDrawableDelegate;
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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
/**
@@ -96,8 +97,8 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase {
Assert.assertNotNull(window);
window.setSize(widthStep*szStep, heightStep*szStep);
window.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(window, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, true, null));
System.out.println("Window: "+window.getClass().getName());
// Check caps of NativeWindow config w/o GL
@@ -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], null));
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], null));
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], null));
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..7cef9e448 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, null));
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, null));
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, null));
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..a23e81d69 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, null));
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, null));
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, null));
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
new file mode 100644
index 000000000..9934ae862
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLProfileDeviceNEWT.java
@@ -0,0 +1,247 @@
+/**
+ * Copyright 2010 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.jogl.acore;
+
+import java.io.IOException;
+
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLOffscreenAutoDrawable;
+import com.jogamp.opengl.GLProfile;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+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.GLEventListenerCounter;
+import com.jogamp.opengl.test.junit.util.GLTestUtil;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+/**
+ * Testing producing {@link GLContext} instances of different {@link GLProfile}s
+ * using different {@link AbstractGraphicsDevice}s.
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestGLAutoDrawableFactoryGLProfileDeviceNEWT extends UITestCase {
+ static final int widthStep = 800/4;
+ static final int heightStep = 600/4;
+ volatile int szStep = 2;
+
+ static GLProfile getProfile(final AbstractGraphicsDevice device, final String profile) {
+ if( !GLProfile.isAvailable(device, profile) ) {
+ System.err.println("Profile "+profile+" n/a");
+ return null;
+ } else {
+ return GLProfile.get(device, profile);
+ }
+ }
+
+ void doTest(final boolean isEGL, final GLDrawableFactory factory, final AbstractGraphicsDevice device,
+ final GLCapabilitiesImmutable reqGLCaps, final GLEventListener demo) throws InterruptedException {
+ System.err.println("Factory: "+factory.getClass().getName());
+ System.err.println("Requested GL Caps: "+reqGLCaps);
+
+ //
+ // Create native OpenGL resources .. XGL/WGL/CGL ..
+ // equivalent to GLAutoDrawable methods: setVisible(true)
+ //
+ final GLOffscreenAutoDrawable glad = factory.createOffscreenAutoDrawable(device, reqGLCaps, null, widthStep*szStep, heightStep*szStep);
+
+ Assert.assertNotNull(glad);
+ Assert.assertTrue(glad.isRealized());
+
+ // Check caps of NativeWindow config w/o GL
+ final CapabilitiesImmutable chosenCaps = glad.getChosenGLCapabilities();
+ Assert.assertNotNull(chosenCaps);
+
+ glad.display(); // force native context creation
+
+ // Check caps of GLDrawable after realization
+ final GLCapabilitiesImmutable chosenGLCaps = glad.getChosenGLCapabilities();
+ Assert.assertNotNull(chosenGLCaps);
+ System.err.println("Choosen GL Caps: "+chosenGLCaps);
+
+ glad.addGLEventListener(demo);
+ final GLEventListenerCounter glelc = new GLEventListenerCounter();
+ glad.addGLEventListener(glelc);
+
+ glad.display(); // initial resize/display
+
+ // 1 - szStep = 2
+ Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
+ GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep, null));
+ 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(),
+ GLTestUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep, null));
+ glad.display();
+
+ Thread.sleep(50);
+
+ final AbstractGraphicsDevice adevice = glad.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice();
+ glad.destroy();
+ System.err.println("Fin isEGL "+isEGL+", "+adevice);
+ System.err.println("Fin "+glelc);
+ Assert.assertTrue("init count: "+glelc, glelc.initCount > 0);
+ Assert.assertTrue("reshape count: "+glelc, glelc.reshapeCount > 0);
+ Assert.assertTrue("display count: "+glelc, glelc.displayCount > 0);
+ Assert.assertTrue("dispose count: "+glelc, glelc.disposeCount > 0);
+ Assert.assertEquals("EGL/Desktop not matching: isEGL "+isEGL+", "+adevice, isEGL, adevice instanceof EGLGraphicsDevice);
+ }
+
+ @Test
+ public void test00AvailableInfo() {
+ GLDrawableFactory f = GLDrawableFactory.getDesktopFactory();
+ if(null != f) {
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
+ }
+ f = GLDrawableFactory.getEGLFactory();
+ if(null != f) {
+ System.err.println(JoglVersion.getDefaultOpenGLInfo(f.getDefaultDevice(), null, true).toString());
+ }
+ }
+
+ @Test
+ public void test01ES2OnEGL() throws InterruptedException {
+ final GLDrawableFactory factory = GLDrawableFactory.getEGLFactory();
+ if( null == factory ) {
+ System.err.println("EGL Factory n/a");
+ return;
+ }
+ final AbstractGraphicsDevice prodDevice = factory.getDefaultDevice();
+ final GLProfile glp = getProfile(prodDevice, GLProfile.GLES2);
+ if(null != glp) {
+ Assert.assertTrue("Not a GLES2 profile but "+glp, glp.isGLES2());
+ Assert.assertTrue("Not a GL2ES2 profile but "+glp, glp.isGL2ES2());
+ }
+ if(null == glp) {
+ return;
+ }
+ final GLCapabilities reqGLCaps = new GLCapabilities(glp);
+ reqGLCaps.setOnscreen(false);
+ final GearsES2 demo = new GearsES2(1);
+ demo.setVerbose(false);
+ doTest(true /* isEGL */, factory, prodDevice, reqGLCaps, demo);
+ }
+
+ @Test
+ public void test02GLOnEGL() throws InterruptedException {
+ final GLDrawableFactory factory = GLDrawableFactory.getEGLFactory();
+ if( null == factory ) {
+ System.err.println("EGL Factory n/a");
+ return;
+ }
+ final AbstractGraphicsDevice prodDevice = factory.getDefaultDevice();
+ final GLProfile glp = getProfile(prodDevice, GLProfile.GL2GL3);
+ if(null != glp) {
+ Assert.assertTrue("Not a GL2GL3 profile but "+glp, glp.isGL2GL3());
+ }
+ if(null == glp || !glp.isGL2ES2()) {
+ if( null != glp ) {
+ System.err.println("Not a GL2ES2 profile but "+glp);
+ }
+ return;
+ }
+ final GLCapabilities reqGLCaps = new GLCapabilities(glp);
+ reqGLCaps.setOnscreen(false);
+ final GearsES2 demo = new GearsES2(1);
+ demo.setVerbose(false);
+ doTest(true /* isEGL */, factory, prodDevice, reqGLCaps, demo);
+ }
+
+ @Test
+ public void test11ES2OnDesktop() throws InterruptedException {
+ final GLDrawableFactory deskFactory = GLDrawableFactory.getDesktopFactory();
+ if( null == deskFactory ) {
+ System.err.println("Desktop Factory n/a");
+ return;
+ }
+ final AbstractGraphicsDevice prodDevice = deskFactory.getDefaultDevice();
+ final GLProfile glp = getProfile(prodDevice, GLProfile.GLES2);
+ if(null != glp) {
+ Assert.assertTrue("Not a GLES2 profile but "+glp, glp.isGLES2());
+ Assert.assertTrue("Not a GL2ES2 profile but "+glp, glp.isGL2ES2());
+ }
+ if(null == glp) {
+ return;
+ }
+ final GLDrawableFactory prodFactory = GLDrawableFactory.getFactory(glp);
+ if( null == prodFactory ) {
+ System.err.println("Production Factory n/a");
+ return;
+ }
+ final GLCapabilities reqGLCaps = new GLCapabilities(glp);
+ reqGLCaps.setOnscreen(false);
+ final GearsES2 demo = new GearsES2(1);
+ demo.setVerbose(false);
+ doTest(true /* isEGL */, prodFactory, prodDevice, reqGLCaps, demo);
+ }
+
+ @Test
+ public void test12GLOnDesktop() throws InterruptedException {
+ final GLDrawableFactory factory = GLDrawableFactory.getDesktopFactory();
+ if( null == factory ) {
+ System.err.println("Desktop Factory n/a");
+ return;
+ }
+ final AbstractGraphicsDevice prodDevice = factory.getDefaultDevice();
+ final GLProfile glp = getProfile(prodDevice, GLProfile.GL2GL3);
+ if(null != glp) {
+ Assert.assertTrue("Not a GL2GL3 profile but "+glp, glp.isGL2GL3());
+ }
+ if(null == glp || !glp.isGL2ES2()) {
+ if( null != glp ) {
+ System.err.println("Not a GL2ES2 profile but "+glp);
+ }
+ return;
+ }
+ final GLCapabilities reqGLCaps = new GLCapabilities(glp);
+ reqGLCaps.setOnscreen(false);
+ final GearsES2 demo = new GearsES2(1);
+ demo.setVerbose(false);
+ doTest(false /* isEGL */, factory, prodDevice, reqGLCaps, demo);
+ }
+
+ public static void main(final String args[]) throws IOException {
+ org.junit.runner.JUnitCore.main(TestGLAutoDrawableFactoryGLProfileDeviceNEWT.class.getName());
+ }
+
+}
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..6a7b09be1 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, null));
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, null));
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, null));
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..6138ce6ee 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
@@ -32,6 +32,7 @@ import java.awt.Dimension;
import java.awt.Frame;
import java.io.IOException;
+import com.jogamp.junit.util.JunitTracer;
import com.jogamp.nativewindow.CapabilitiesImmutable;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
@@ -55,6 +56,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;
/**
@@ -133,8 +135,8 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase {
Assume.assumeNoException( throwable );
}
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glad, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glad, true));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(glad, true, null));
+ Assert.assertTrue(GLTestUtil.waitForRealized(glad, true, null));
System.out.println("Window: "+glad.getClass().getName());
// Check caps of NativeWindow config w/o GL
@@ -198,7 +200,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], null));
snapshotGLEventListener.setMakeSnapshot();
glad.display();
@@ -209,7 +211,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], null));
glad.display();
snapshotGLEventListener.setMakeSnapshot();
glad.display();
@@ -221,7 +223,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], null));
glad.display();
snapshotGLEventListener.setMakeSnapshot();
glad.display();
@@ -345,7 +347,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase {
}
}
if(waitForKey) {
- UITestCase.waitForKey("Start");
+ JunitTracer.waitForKey("Start");
}
org.junit.runner.JUnitCore.main(TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.class.getName());
}
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..34148501d 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
@@ -51,7 +51,8 @@ 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.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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
/**
@@ -90,8 +91,8 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase {
Assert.assertNotNull(glad);
glad.setSize(widthStep*szStep, heightStep*szStep);
glad.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glad, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glad, true));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glad, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glad, true, null));
System.out.println("Window: "+glad.getClass().getName());
// Check caps of NativeWindow config w/o GL
@@ -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], null));
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], null));
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], null));
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..ce968751e 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
@@ -57,7 +57,8 @@ import com.jogamp.newt.awt.NewtCanvasAWT;
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.NewtTestUtil;
+import com.jogamp.opengl.test.junit.util.GLTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
/**
@@ -145,8 +146,8 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase
Assume.assumeNoException( throwable );
}
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glad, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glad, true));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glad, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glad, true, null));
System.out.println("Window: "+glad.getClass().getName());
// Check caps of NativeWindow config w/o GL
@@ -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], null));
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], null));
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], null));
glad.display();
snapshotGLEventListener.setMakeSnapshot();
glad.display();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java
index 1e78691c4..8d26ebb82 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java
@@ -31,6 +31,7 @@ package com.jogamp.opengl.test.junit.jogl.acore;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.nativewindow.NativeSurface;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
@@ -194,8 +195,8 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase {
final Object sync = new Object();
final MyRunnable[] animTasks = new MyRunnable[animThreadCount];
final MyRunnable[] resizeTasks = new MyRunnable[animThreadCount];
- final Thread[] animThreads = new Thread[reszThreadCount];
- final Thread[] resizeThreads = new Thread[reszThreadCount];
+ final InterruptSource.Thread[] animThreads = new InterruptSource.Thread[reszThreadCount];
+ final InterruptSource.Thread[] resizeThreads = new InterruptSource.Thread[reszThreadCount];
System.err.println("animThreadCount "+animThreadCount+", frameCount "+frameCount);
System.err.println("reszThreadCount "+reszThreadCount+", resizeCount "+resizeCount);
@@ -204,12 +205,12 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase {
for(int i=0; i<animThreadCount; i++) {
System.err.println("create anim task/thread "+i);
animTasks[i] = new RudeAnimator(glWindow, frameCount, sync, i);
- animThreads[i] = new Thread(animTasks[i], currentThreadName+"-anim"+i);
+ animThreads[i] = new InterruptSource.Thread(null, animTasks[i], currentThreadName+"-anim"+i);
}
for(int i=0; i<reszThreadCount; i++) {
System.err.println("create resz task/thread "+i);
resizeTasks[i] = new RudeResizer(glWindow, resizeCount, sync, i);
- resizeThreads[i] = new Thread(resizeTasks[i], currentThreadName+"-resz"+i);
+ resizeThreads[i] = new InterruptSource.Thread(null, resizeTasks[i], currentThreadName+"-resz"+i);
}
myEventCounter.reset();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java
index dcee114e5..8319a1c22 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug00NEWT.java
@@ -32,7 +32,6 @@ import java.io.IOException;
import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2ES2;
-import com.jogamp.opengl.GL2GL3;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLContext;
import com.jogamp.opengl.GLDebugListener;
@@ -58,6 +57,14 @@ public class TestGLDebug00NEWT extends UITestCase {
static String dbgTstMsg0 = "Hello World";
static int dbgTstId0 = 42;
+ static GLProfile getGLProfile(final String profile) {
+ if( !GLProfile.isAvailable(profile) ) {
+ System.err.println("Profile "+profile+" n/a");
+ return null;
+ }
+ return GLProfile.get(profile);
+ }
+
public static class WindowContext {
public final Window window;
public final GLContext context;
@@ -115,9 +122,7 @@ public class TestGLDebug00NEWT extends UITestCase {
}
- void test01GLDebug01EnableDisable(final boolean enable) throws InterruptedException {
- final GLProfile glp = GLProfile.getDefault();
-
+ void testX1GLDebugEnableDisable(final GLProfile glp, final boolean enable) throws InterruptedException {
final WindowContext winctx = createWindow(glp, enable);
final String glDebugExt = winctx.context.getGLDebugMessageExtension();
System.err.println("glDebug extension: "+glDebugExt);
@@ -131,19 +136,42 @@ public class TestGLDebug00NEWT extends UITestCase {
}
@Test
- public void test01GLDebugDisabled() throws InterruptedException {
- test01GLDebug01EnableDisable(false);
+ public void test01GL2GL3DebugDisabled() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GL2GL3);
+ if( null == glp ) {
+ return;
+ }
+ testX1GLDebugEnableDisable(glp, false);
}
@Test
- public void test01GLDebugEnabled() throws InterruptedException {
- test01GLDebug01EnableDisable(true);
+ public void test02GL2GL3DebugEnabled() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GL2GL3);
+ if( null == glp ) {
+ return;
+ }
+ testX1GLDebugEnableDisable(glp, true);
}
@Test
- public void test02GLDebugError() throws InterruptedException {
- final GLProfile glp = GLProfile.getDefault();
+ public void test11GLES2DebugDisabled() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GLES2);
+ if( null == glp ) {
+ return;
+ }
+ testX1GLDebugEnableDisable(glp, false);
+ }
+
+ @Test
+ public void test12GLES2DebugEnabled() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GLES2);
+ if( null == glp ) {
+ return;
+ }
+ testX1GLDebugEnableDisable(glp, true);
+ }
+ void testX2GLDebugError(final GLProfile glp) throws InterruptedException {
final WindowContext winctx = createWindow(glp, true);
final MyGLDebugListener myGLDebugListener = new MyGLDebugListener(
@@ -164,8 +192,24 @@ public class TestGLDebug00NEWT extends UITestCase {
}
@Test
- public void test03GLDebugInsert() throws InterruptedException {
- final GLProfile glp = GLProfile.getDefault();
+ public void test03GL2GL3DebugError() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GL2GL3);
+ if( null == glp ) {
+ return;
+ }
+ testX2GLDebugError(glp);
+ }
+
+ @Test
+ public void test13GLES2DebugError() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GLES2);
+ if( null == glp ) {
+ return;
+ }
+ testX2GLDebugError(glp);
+ }
+
+ void testX3GLDebugInsert(final GLProfile glp) throws InterruptedException {
final WindowContext winctx = createWindow(glp, true);
final MyGLDebugListener myGLDebugListener = new MyGLDebugListener(dbgTstMsg0, dbgTstId0);
winctx.context.addGLDebugListener(myGLDebugListener);
@@ -184,6 +228,23 @@ public class TestGLDebug00NEWT extends UITestCase {
destroyWindow(winctx);
}
+ @Test
+ public void test04GL2GL3DebugInsert() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GL2GL3);
+ if( null == glp ) {
+ return;
+ }
+ testX3GLDebugInsert(glp);
+ }
+
+ @Test
+ public void test14GLES2DebugInsert() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GLES2);
+ if( null == glp ) {
+ return;
+ }
+ testX3GLDebugInsert(glp);
+ }
public static void main(final String args[]) throws IOException {
final String tstname = TestGLDebug00NEWT.class.getName();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java
index 66733209c..43d207a0d 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLDebug01NEWT.java
@@ -31,7 +31,6 @@ package com.jogamp.opengl.test.junit.jogl.acore;
import java.io.IOException;
import com.jogamp.opengl.GL2ES2;
-import com.jogamp.opengl.GL2GL3;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLContext;
@@ -54,6 +53,14 @@ public class TestGLDebug01NEWT extends UITestCase {
static String dbgTstMsg0 = "Hello World";
static int dbgTstId0 = 42;
+ static GLProfile getGLProfile(final String profile) {
+ if( !GLProfile.isAvailable(profile) ) {
+ System.err.println("Profile "+profile+" n/a");
+ return null;
+ }
+ return GLProfile.get(profile);
+ }
+
GLWindow createWindow(final GLProfile glp, final boolean debugGL) {
final GLCapabilities caps = new GLCapabilities(glp);
//
@@ -76,9 +83,7 @@ public class TestGLDebug01NEWT extends UITestCase {
}
- void test01GLDebug01EnableDisable(final boolean enable, final String dbgTstMsg, final int dbgTstId) throws InterruptedException {
- final GLProfile glp = GLProfile.getDefault();
-
+ void testX1GLDebugEnableDisable(final GLProfile glp, final boolean enable, final String dbgTstMsg, final int dbgTstId) throws InterruptedException {
final GLWindow window = createWindow(glp, enable);
final GLContext ctx = window.getContext();
final MyGLDebugListener myGLDebugListener = new MyGLDebugListener(dbgTstMsg, dbgTstId);
@@ -109,19 +114,42 @@ public class TestGLDebug01NEWT extends UITestCase {
}
@Test
- public void test01GLDebug01Disabled() throws InterruptedException {
- test01GLDebug01EnableDisable(false, null, -1);
+ public void test01GL2GL3DebugDisabled() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GL2GL3);
+ if( null == glp ) {
+ return;
+ }
+ testX1GLDebugEnableDisable(glp, false, null, -1);
}
@Test
- public void test01GLDebug01Enabled() throws InterruptedException {
- test01GLDebug01EnableDisable(true, dbgTstMsg0, dbgTstId0);
+ public void test02GL2GL3DebugEnabled() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GL2GL3);
+ if( null == glp ) {
+ return;
+ }
+ testX1GLDebugEnableDisable(glp, true, dbgTstMsg0, dbgTstId0);
}
@Test
- public void test02GLDebug01Error() throws InterruptedException {
- final GLProfile glp = GLProfile.getDefault();
+ public void test11GLES2DebugDisabled() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GLES2);
+ if( null == glp ) {
+ return;
+ }
+ testX1GLDebugEnableDisable(glp, false, null, -1);
+ }
+ @Test
+ public void test12GLES2DebugEnabled() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GLES2);
+ if( null == glp ) {
+ return;
+ }
+ testX1GLDebugEnableDisable(glp, true, dbgTstMsg0, dbgTstId0);
+ }
+
+ void testX3GLDebugError(final GLProfile glp) throws InterruptedException {
final GLWindow window = createWindow(glp, true);
final MyGLDebugListener myGLDebugListener = new MyGLDebugListener(
@@ -144,6 +172,23 @@ public class TestGLDebug01NEWT extends UITestCase {
destroyWindow(window);
}
+ @Test
+ public void test03GL2GL3DebugError() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GL2GL3);
+ if( null == glp ) {
+ return;
+ }
+ testX3GLDebugError(glp);
+ }
+
+ @Test
+ public void test13GLES2DebugError() throws InterruptedException {
+ final GLProfile glp = getGLProfile(GLProfile.GLES2);
+ if( null == glp ) {
+ return;
+ }
+ testX3GLDebugError(glp);
+ }
public static void main(final String args[]) throws IOException {
final String tstname = TestGLDebug01NEWT.class.getName();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java
index 3add9685d..f558f698f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.test.junit.jogl.acore;
import java.io.File;
+import java.util.Locale;
import com.jogamp.nativewindow.util.Dimension;
import com.jogamp.nativewindow.util.DimensionImmutable;
@@ -184,7 +185,7 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base {
}
public void snapshot(final int sn, final GLAutoDrawable drawable, final String fileSuffix, final String destPath) {
final GL gl = drawable.getGL();
- final String postSNDetail = String.format("jgl-usr%03d", textRendererGLEL.userCounter);
+ final String postSNDetail = String.format((Locale)null, "jgl-usr%03d", textRendererGLEL.userCounter);
final String filenameJGL = getSnapshotFilename(sn, postSNDetail,
drawable.getChosenGLCapabilities(), drawable.getSurfaceWidth(), drawable.getSurfaceHeight(),
glReadBufferUtil.hasAlpha(), fileSuffix, destPath);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java
index b11b16812..8d16ee356 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer01GLCanvasAWT.java
@@ -171,8 +171,8 @@ public class TestOffscreenLayer01GLCanvasAWT extends UITestCase {
frame1.setSize(frameSize0);
setupFrameAndShow(frame1, glc);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glc, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glc, true, null));
Assert.assertEquals(true, glc.isOffscreenLayerSurfaceEnabled());
final GLAnimatorControl animator1 = new Animator(glc);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java
index 65925c6b5..a5abd9466 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestOffscreenLayer02NewtCanvasAWT.java
@@ -49,16 +49,27 @@ import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
+import com.jogamp.junit.util.JunitTracer;
import com.jogamp.newt.Window;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter;
-import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.newt.parenting.NewtReparentingKeyAdapter;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
+/**
+ * <p>
+ * The demo code uses {@link NewtReparentingKeyAdapter} including {@link NEWTDemoListener} functionality.
+ * </p>
+ * <p>
+ * Manual invocation via main allows setting each tests's duration in milliseconds, e.g.{@code -duration 10000}, and many more, see {@link #main(String[])}
+ * </p>
+ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
static boolean singleBuffer = false;
@@ -162,12 +173,12 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
}
setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
- glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null));
+ glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1));
frame1.setSize(frameSize0);
setupFrameAndShow(frame1, newtCanvasAWT1);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glWindow1, true));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow1, true, null));
+ Assert.assertEquals(true, NewtTestUtil.waitForVisible(glWindow1, true, null));
Assert.assertEquals(newtCanvasAWT1.getNativeWindow(),glWindow1.getParent());
Assert.assertEquals(true, newtCanvasAWT1.isOffscreenLayerSurfaceEnabled());
@@ -189,7 +200,7 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
end(animator1, frame1, glWindow1);
if( waitForKey ) {
- UITestCase.waitForKey("Continue");
+ JunitTracer.waitForKey("Continue");
}
}
@@ -234,7 +245,7 @@ public class TestOffscreenLayer02NewtCanvasAWT extends UITestCase {
}
}
if(waitForKey) {
- UITestCase.waitForKey("Start");
+ JunitTracer.waitForKey("Start");
}
final String tstname = TestOffscreenLayer02NewtCanvasAWT.class.getName();
/*
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java
index aef64e4e9..ae9dac003 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestPBufferDeadlockAWT.java
@@ -43,6 +43,7 @@ import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.common.util.RunnableTask;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -82,7 +83,7 @@ public class TestPBufferDeadlockAWT extends UITestCase {
System.err.println("BB.0: "+rTask.getSyncObject());
synchronized (rTask.getSyncObject()) {
System.err.println("BB.1: "+rTask.getSyncObject());
- new Thread(rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
+ new InterruptSource.Thread(null, rTask, Thread.currentThread().getName()+"-Pbuffer_Creation").start();
try {
System.err.println("BB.2");
rTask.getSyncObject().wait();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java
index 7e39b890c..fa4ff013a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListAWT.java
@@ -118,7 +118,7 @@ public class TestSharedContextListAWT extends UITestCase {
public void run() {
frame.setVisible(true);
} } );
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true, null));
return glCanvas;
}
@@ -161,11 +161,11 @@ public class TestSharedContextListAWT extends UITestCase {
public void run() {
try {
f1.dispose();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc1, false));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc1, false, null));
f2.dispose();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc2, false));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc2, false, null));
f3.dispose();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc3, false));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc3, false, null));
} catch (final Throwable t) {
throw new RuntimeException(t);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java
index 37aaa33b4..263e78def 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT.java
@@ -39,7 +39,7 @@ import com.jogamp.opengl.GLOffscreenAutoDrawable;
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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
@@ -106,8 +106,8 @@ public class TestSharedContextListNEWT extends UITestCase {
animator.add(glWindow);
glWindow.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glWindow, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glWindow, true, null));
glWindow.setPosition(x, y);
return glWindow;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java
index e84ae4997..095b03207 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedContextListNEWT2.java
@@ -38,7 +38,7 @@ import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.util.Animator;
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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import org.junit.Assert;
@@ -108,8 +108,8 @@ public class TestSharedContextListNEWT2 extends UITestCase {
animator.start();
glWindow.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glWindow, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glWindow, true, null));
glWindow.setPosition(x, y);
return glWindow;
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..7a1d48cf0 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));
@@ -751,7 +752,7 @@ public class TestSharedContextNewtAWTBug523 extends UITestCase {
while(animator.isAnimating() && animator.getTotalFPSDuration() < durationPerTest) {
Thread.sleep(100);
}
- AWTRobotUtil.closeWindow(frame, true, awtClosingListener);
+ AWTRobotUtil.closeWindow(frame, true, awtClosingListener, null);
final boolean windowClosed = closingSemaphore.tryAcquire(5000, TimeUnit.MILLISECONDS);
Assert.assertEquals(true, windowClosed);
} catch (final InterruptedException e) {
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..a6406d4a0 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
@@ -40,8 +40,9 @@ 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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
@@ -96,7 +97,8 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
dummyDrawable.setRealized(true);
sharedDrawable = new GLAutoDrawableDelegate(dummyDrawable, null, null, true /*ownDevice*/, null) { };
Assert.assertNotNull(sharedDrawable);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(sharedDrawable, true));
+ final GLAutoDrawable obj = sharedDrawable;
+ Assert.assertTrue(GLTestUtil.waitForRealized(obj, true, null));
sharedGears = new GearsES1();
Assert.assertNotNull(sharedGears);
@@ -104,7 +106,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, null));
Assert.assertTrue("Master Ctx is shared before shared creation", !ctxM.isShared());
Assert.assertTrue("Master Gears is shared", !sharedGears.usesSharedGears());
}
@@ -134,9 +136,9 @@ public class TestSharedContextVBOES1NEWT extends UITestCase {
animator.add(glWindow);
glWindow.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glWindow, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glWindow, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(glWindow, true, null));
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..16c53564c 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,7 +39,9 @@ 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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -135,19 +137,19 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase {
Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue(GLTestUtil.waitForRealized(c1, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true, null));
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.waitForRealized(c2, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true, null));
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.waitForRealized(c3, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = c1.getContext();
@@ -223,9 +225,9 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase {
}
}});
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ Assert.assertTrue(GLTestUtil.waitForRealized(c1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForRealized(c2, false, null));
+ Assert.assertTrue(GLTestUtil.waitForRealized(c3, false, null));
}
@Test
@@ -282,19 +284,19 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase {
Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue(GLTestUtil.waitForRealized(c1, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true, null));
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.waitForRealized(c2, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true, null));
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.waitForRealized(c3, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = c1.getContext();
@@ -374,9 +376,9 @@ public class TestSharedContextVBOES2AWT3 extends UITestCase {
}
}});
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ Assert.assertTrue(GLTestUtil.waitForRealized(c1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForRealized(c2, false, null));
+ Assert.assertTrue(GLTestUtil.waitForRealized(c3, false, null));
}
static long duration = 1000; // ms
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..f6eb479fa 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;
@@ -126,19 +127,19 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase {
Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true, null));
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(AWTRobotUtil.waitForRealized(c2, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true, null));
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(AWTRobotUtil.waitForRealized(c3, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = c1.getContext();
@@ -185,9 +186,9 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase {
}
}});
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false, null));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false, null));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false, null));
}
@Test
@@ -235,19 +236,19 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase {
Thread.sleep(1000/60*10); // wait ~10 frames giving a chance to create (blocking until master share is valid)
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true, null));
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(AWTRobotUtil.waitForRealized(c2, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true, null));
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(AWTRobotUtil.waitForRealized(c3, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = c1.getContext();
@@ -298,9 +299,9 @@ public class TestSharedContextVBOES2AWT3b extends UITestCase {
}
}});
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false, null));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false, null));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false, null));
}
static long duration = 1000; // ms
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..88099f578 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
@@ -39,7 +39,8 @@ import com.jogamp.opengl.GLContext;
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.NewtTestUtil;
+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;
@@ -91,10 +92,10 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase {
animator.add(glWindow);
glWindow.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glWindow, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glWindow, true, null));
glWindow.display();
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(glWindow, true, null));
Assert.assertTrue("Gears not initialized", gears.waitForInit(true));
return glWindow;
@@ -184,9 +185,9 @@ 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(NewtTestUtil.waitForVisible(f3, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false, null));
{
final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
@@ -205,9 +206,9 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase {
try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); }
f2.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false, null));
{
final List<GLContext> ctx1Shares = ctx1.getCreatedShares();
final List<GLContext> ctx2Shares = ctx2.getCreatedShares();
@@ -226,9 +227,9 @@ public class TestSharedContextVBOES2NEWT0 extends UITestCase {
try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); }
f1.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false, null));
{
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..7b06fcc5d 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
@@ -38,7 +38,8 @@ import com.jogamp.opengl.GLDrawableFactory;
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.NewtTestUtil;
+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;
@@ -108,7 +109,8 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase {
sharedDrawable = GLDrawableFactory.getFactory(glp).createDummyAutoDrawable(null, true /* createNewDevice */, caps, null);
}
Assert.assertNotNull(sharedDrawable);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(sharedDrawable, true));
+ final GLAutoDrawable obj = sharedDrawable;
+ Assert.assertTrue(GLTestUtil.waitForRealized(obj, true, null));
sharedGears = new GearsES2();
Assert.assertNotNull(sharedGears);
@@ -116,7 +118,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, null));
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);
@@ -149,9 +151,9 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase {
animator.add(glWindow);
animator.start();
glWindow.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(glWindow, true));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glWindow, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glWindow, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(glWindow, true, null));
final GLContext sharedMasterContext = sharedDrawable.getContext();
MiscUtils.dumpSharedGLContext("Master Context", sharedMasterContext);
@@ -191,15 +193,15 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase {
f1.destroy();
f2.destroy();
f3.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false, null));
releaseShared();
}
@@ -229,15 +231,15 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase {
f1.destroy();
f2.destroy();
f3.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false, null));
releaseShared();
}
@@ -262,15 +264,15 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase {
f1.destroy();
f2.destroy();
f3.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false, null));
releaseShared();
}
@@ -300,15 +302,15 @@ public class TestSharedContextVBOES2NEWT1 extends UITestCase {
f1.destroy();
f2.destroy();
f3.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false, null));
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..05ee9bab4 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
@@ -38,7 +38,8 @@ import com.jogamp.opengl.GLContext;
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.NewtTestUtil;
+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,33 +129,33 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase {
animator.add(f3);
f3.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false, null));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false, null));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false, null));
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(NewtTestUtil.waitForRealized(f1, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, true, null));
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(NewtTestUtil.waitForRealized(f2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, true, null));
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(NewtTestUtil.waitForRealized(f3, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = f1.getContext();
@@ -202,12 +203,12 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase {
f2.destroy();
f3.destroy();
}
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, false, null));
}
@Test
@@ -250,32 +251,32 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase {
a3.start();
f3.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false, null));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false, null));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false, null));
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(NewtTestUtil.waitForRealized(f1, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, true, null));
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(NewtTestUtil.waitForRealized(f2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, true, null));
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(NewtTestUtil.waitForRealized(f3, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = f1.getContext();
@@ -329,12 +330,12 @@ public class TestSharedContextVBOES2NEWT2 extends UITestCase {
f2.destroy();
f3.destroy();
}
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, false, null));
}
static long duration = 1000; // ms
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..bac5784ac 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
@@ -38,8 +38,9 @@ import com.jogamp.opengl.GLContext;
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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -129,24 +130,24 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
animator.add(f2);
f2.setVisible(true); // shall wait until f1 is ready
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false, null));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false, null));
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(NewtTestUtil.waitForRealized(f1, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, true, null));
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(NewtTestUtil.waitForRealized(f2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, true, null));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
final GearsES2 g3 = new GearsES2(0);
@@ -157,9 +158,9 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
animator.add(f3);
f3.setVisible(true); // shall wait until f1 is ready
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = f1.getContext();
@@ -217,12 +218,12 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
f3.destroy();
try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); }
}
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, false, null));
animator.stop();
}
@@ -267,24 +268,24 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
a2.start();
f2.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false, null));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false, null));
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(NewtTestUtil.waitForRealized(f1, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, true, null));
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(NewtTestUtil.waitForRealized(f2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, true, null));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
final Animator a3 = new Animator();
@@ -297,9 +298,9 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
a3.start();
f3.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, true));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = f1.getContext();
@@ -365,12 +366,12 @@ public class TestSharedContextVBOES2NEWT3 extends UITestCase {
f3.destroy();
try { Thread.sleep(durationPostDestroy); } catch(final Exception e) { e.printStackTrace(); }
}
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, false, null));
}
static long duration = 1000; // ms
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..19d20b978 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
@@ -41,7 +41,8 @@ import com.jogamp.opengl.GLContext;
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.NewtTestUtil;
+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;
@@ -132,33 +133,33 @@ public class TestSharedContextVBOES2NEWT4 extends UITestCase {
});
f3.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f1, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, false, null));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f2, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, false, null));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, false, null));
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(NewtTestUtil.waitForRealized(f1, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f1, true, null));
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(NewtTestUtil.waitForRealized(f2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f2, true, null));
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(NewtTestUtil.waitForRealized(f3, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(f3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
Assert.assertFalse("Unexpected exception (animator) caught", gotAnimException.get());
@@ -203,12 +204,12 @@ public class TestSharedContextVBOES2NEWT4 extends UITestCase {
f2.destroy();
f1.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f1, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f2, false));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(f3, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(f3, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(f3, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(f3, false, null));
}
static long duration = 1000; // ms
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..4e2457181 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,8 +37,9 @@ 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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -200,17 +201,27 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase {
shell2.open(); // shall wait until f1 is ready
shell3.open(); // shall wait until f1 is ready
} } );
+ final long t0 = System.currentTimeMillis();
animator.start(); // kicks off GLContext .. and hence gears of f2 + f3 completion
- 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));
+ final Runnable waitAction = new Runnable() {
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ try {
+ Thread.sleep(10);
+ } catch (final InterruptedException e) { }
+ }
+ } };
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(c1, true, waitAction));
+ Assert.assertEquals(true, GLTestUtil.waitForContextCreated(c1, true, waitAction));
Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(c2, true, waitAction));
+ Assert.assertEquals(true, GLTestUtil.waitForContextCreated(c2, true, waitAction));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(c3, true, waitAction));
+ Assert.assertEquals(true, GLTestUtil.waitForContextCreated(c3, true, waitAction));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
final GLContext ctx1 = c1.getContext();
@@ -236,11 +247,10 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase {
Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
- try {
- Thread.sleep(duration);
- } catch(final Exception e) {
- e.printStackTrace();
+ while(animator.isAnimating() && System.currentTimeMillis()-t0<duration) {
+ waitAction.run();
}
+
// Stopped animator allows native windowing system 'repaint' event
// to trigger GLAD 'display'
animator.stop();
@@ -266,10 +276,16 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase {
} } );
a1.start();
-
- 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));
+ final Runnable waitAction = new Runnable() {
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ try {
+ Thread.sleep(10);
+ } catch (final InterruptedException e) { }
+ }
+ } };
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(c1, true, waitAction));
+ Assert.assertEquals(true, GLTestUtil.waitForContextCreated(c1, true, waitAction));
Assert.assertTrue("Gears1 not initialized", g1.waitForInit(true));
final Animator a2 = new Animator();
@@ -284,8 +300,6 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase {
} } );
a2.start();
- Thread.sleep(200); // wait a while ..
-
final Animator a3 = new Animator();
final GearsES2 g3 = new GearsES2(0);
g3.setSharedGears(g1);
@@ -298,12 +312,16 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase {
} } );
a3.start();
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c2, true));
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(c2, true, waitAction));
+ Assert.assertEquals(true, GLTestUtil.waitForContextCreated(c2, true, waitAction));
Assert.assertTrue("Gears2 not initialized", g2.waitForInit(true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c3, true));
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(c3, true, waitAction));
+ Assert.assertEquals(true, GLTestUtil.waitForContextCreated(c3, true, waitAction));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
+ final long t0 = System.currentTimeMillis();
+
final GLContext ctx1 = c1.getContext();
final GLContext ctx2 = c2.getContext();
final GLContext ctx3 = c3.getContext();
@@ -327,10 +345,8 @@ public class TestSharedContextVBOES2SWT3 extends UITestCase {
Assert.assertTrue("Gears2 is not shared", g2.usesSharedGears());
Assert.assertTrue("Gears3 is not shared", g3.usesSharedGears());
- try {
- Thread.sleep(duration);
- } catch(final Exception e) {
- e.printStackTrace();
+ while(System.currentTimeMillis()-t0<duration) {
+ waitAction.run();
}
// Stopped animator allows native windowing system 'repaint' event
// to trigger GLAD 'display'
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedExternalContextAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedExternalContextAWT.java
index 81489df17..0987b2978 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedExternalContextAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestSharedExternalContextAWT.java
@@ -14,6 +14,7 @@ import javax.swing.Timer;
import org.junit.Test;
import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.common.util.locks.LockFactory;
import com.jogamp.common.util.locks.RecursiveLock;
import com.jogamp.opengl.*;
@@ -69,7 +70,7 @@ public class TestSharedExternalContextAWT {
// which is suppose to lie outside of the JVM.
// The thread is kept alive, since this detail
// may be required for the OpenGL driver implementation.
- final Thread thread = new Thread(runnable);
+ final Thread thread = new InterruptSource.Thread(null, runnable);
thread.setDaemon(true);
thread.start();
masterLatch.await(3, TimeUnit.SECONDS);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java
index bbbd92e5e..933e79731 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestVersionSemanticsNOUI.java
@@ -111,27 +111,17 @@ public class TestVersionSemanticsNOUI extends SingletonJunitCase {
}
@Test
- public void testVersionV230V23x_00std() throws IllegalArgumentException, IOException, URISyntaxException {
- final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.NON_BACKWARD_COMPATIBLE;
- // final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.BACKWARD_COMPATIBLE_USER;
-
- final VersionNumberString preVersionNumber = new VersionNumberString("2.3.0");
- final File previousJar = new File("lib/v"+preVersionNumber.getVersionString()+"/"+jarFile);
-
- final ClassLoader currentCL = TestVersionSemanticsNOUI.class.getClassLoader();
-
- VersionSemanticsUtil.testVersion(diffCriteria, expectedCompatibilityType,
- previousJar, preVersionNumber,
- curVersion.getClass(), currentCL, curVersionNumber,
- excludesDefault);
+ public void testVersionV230V232() throws IllegalArgumentException, IOException, URISyntaxException {
+ testVersions(diffCriteria, Delta.CompatibilityType.BACKWARD_COMPATIBLE_BINARY, "2.3.0", "2.3.2", excludesStereoPackageAndAppletUtils);
}
+
@Test
- public void testVersionV230V23x_01patch() throws IllegalArgumentException, IOException, URISyntaxException {
- // final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.NON_BACKWARD_COMPATIBLE;
+ public void testVersionV232V24x() throws IllegalArgumentException, IOException, URISyntaxException {
+ final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.NON_BACKWARD_COMPATIBLE;
// final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.BACKWARD_COMPATIBLE_USER;
- final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.BACKWARD_COMPATIBLE_BINARY;
+ // final Delta.CompatibilityType expectedCompatibilityType = Delta.CompatibilityType.BACKWARD_COMPATIBLE_BINARY;
- final VersionNumberString preVersionNumber = new VersionNumberString("2.3.0");
+ final VersionNumberString preVersionNumber = new VersionNumberString("2.3.2");
final File previousJar = new File("lib/v"+preVersionNumber.getVersionString()+"/"+jarFile);
final ClassLoader currentCL = TestVersionSemanticsNOUI.class.getClassLoader();
@@ -139,7 +129,7 @@ public class TestVersionSemanticsNOUI extends SingletonJunitCase {
VersionSemanticsUtil.testVersion(diffCriteria, expectedCompatibilityType,
previousJar, preVersionNumber,
curVersion.getClass(), currentCL, curVersionNumber,
- excludesStereoPackageAndAppletUtils);
+ excludesDefault);
}
public static void main(final String args[]) throws IOException {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java
index b30bb1192..4cdcbd10a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java
@@ -30,6 +30,7 @@ package com.jogamp.opengl.test.junit.jogl.acore.anim;
import java.awt.BorderLayout;
import java.awt.Dimension;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLEventListener;
@@ -85,10 +86,10 @@ public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame {
lastTime = time;
animator.pause();
System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.pause(): paused "+animator);
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
try {
- Thread.sleep(1000);
+ java.lang.Thread.sleep(1000);
} catch (final InterruptedException e) {
e.printStackTrace();
}
@@ -98,9 +99,9 @@ public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame {
final long td = System.currentTimeMillis() - lastTime;
if (animator.isPaused()) {
animator.resume(); //Doesn't work on v2.0.2 or higher
- System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): animating "+animator);
+ System.out.println(java.lang.Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): animating "+animator);
} else {
- System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): Ooops - not paused! - animating "+animator);
+ System.out.println(java.lang.Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): Ooops - not paused! - animating "+animator);
}
} } );
}
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..bec3fe2ef 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;
@@ -116,19 +117,19 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase {
f3.setVisible(true);
} } );
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true, null));
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(AWTRobotUtil.waitForRealized(c2, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true, null));
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(AWTRobotUtil.waitForRealized(c3, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
try {
@@ -168,9 +169,9 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase {
}
}});
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false, null));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false, null));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false, null));
}
@Test
@@ -218,19 +219,19 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase {
f3.setVisible(true);
} } );
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true, null));
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(AWTRobotUtil.waitForRealized(c2, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true, null));
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(AWTRobotUtil.waitForRealized(c3, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(c3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
try {
@@ -276,9 +277,9 @@ public class TestAnimatorGLJPanel01AWT extends UITestCase {
}
}});
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false, null));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false, null));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false, null));
}
static long duration = 3*500; // ms
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..3eeea1690 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
@@ -34,7 +34,8 @@ 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.NewtTestUtil;
+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;
@@ -108,19 +109,19 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase {
c2.setVisible(true);
c3.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(c1, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(c1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true, null));
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(NewtTestUtil.waitForRealized(c2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(c2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true, null));
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(NewtTestUtil.waitForRealized(c3, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(c3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
try {
@@ -153,9 +154,9 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase {
c2.destroy();
c3.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(c1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(c2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(c3, false, null));
}
@Test
@@ -191,19 +192,19 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase {
Assert.assertEquals(true, a3.isAnimating());
c3.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(c1, true));
- Assert.assertTrue(AWTRobotUtil.waitForContextCreated(c1, true));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(c1, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(c1, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c1, true, null));
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(NewtTestUtil.waitForRealized(c2, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(c2, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c2, true, null));
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(NewtTestUtil.waitForRealized(c3, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(c3, true, null));
+ Assert.assertTrue(GLTestUtil.waitForContextCreated(c3, true, null));
Assert.assertTrue("Gears3 not initialized", g3.waitForInit(true));
try {
@@ -242,9 +243,9 @@ public class TestAnimatorGLWindow01NEWT extends UITestCase {
c2.destroy();
c3.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c1, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(c3, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(c1, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(c2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(c3, false, null));
}
static long duration = 3*500; // ms
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java
index b2608303a..1598a90fb 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase00.java
@@ -30,10 +30,9 @@ package com.jogamp.opengl.test.junit.jogl.acore.ect;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.Window;
-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.util.Animator;
import com.jogamp.opengl.util.AnimatorBase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -361,7 +360,7 @@ public abstract class ExclusiveContextBase00 extends UITestCase {
// Destroy GLWindows
for(int i=0; i<drawableCount; i++) {
destroyGLAutoDrawableVisible(drawables[i]);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(drawables[i], false));
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(drawables[i], false, null));
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java
index 1908d1ec2..50f04ed17 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/ect/ExclusiveContextBase10.java
@@ -30,10 +30,9 @@ package com.jogamp.opengl.test.junit.jogl.acore.ect;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.Window;
-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.util.Animator;
import com.jogamp.opengl.util.AnimatorBase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@@ -183,7 +182,7 @@ public abstract class ExclusiveContextBase10 extends UITestCase {
// Destroy GLWindows
for(int i=0; i<drawableCount; i++) {
destroyGLAutoDrawableVisible(drawables[i]);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(drawables[i], false));
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(drawables[i], false, null));
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase1.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase1.java
index 712679982..632fd9e3d 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/GLContextDrawableSwitchBase1.java
@@ -49,6 +49,8 @@ import com.jogamp.opengl.GLEventListenerState;
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.TestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import org.junit.Assert;
@@ -208,11 +210,11 @@ public abstract class GLContextDrawableSwitchBase1 extends UITestCase {
if( GLADType.GLCanvasOnscreen == gladType || GLADType.GLCanvasOffscreen == gladType ) {
setFrameVisible(frame);
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
} else if( GLADType.GLWindow == gladType ) {
((GLWindow)glad).setVisible(true);
}
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glad, true));
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(glad, true, null));
Assert.assertNotNull(glad.getContext());
Assert.assertTrue(glad.isRealized());
@@ -235,10 +237,10 @@ public abstract class GLContextDrawableSwitchBase1 extends UITestCase {
Assert.assertEquals(false, glelsIn.isOwner());
}
- for (int wait=0; wait<AWTRobotUtil.POLL_DIVIDER &&
+ for (int wait=0; wait<TestUtil.POLL_DIVIDER &&
( 1 > glelTracker.initCount || 1 > glelTracker.reshapeCount || 1 > glelTracker.displayCount );
wait++) {
- Thread.sleep(AWTRobotUtil.TIME_SLICE);
+ Thread.sleep(TestUtil.TIME_SLICE);
}
final long t0 = System.currentTimeMillis();
@@ -270,13 +272,13 @@ public abstract class GLContextDrawableSwitchBase1 extends UITestCase {
}
if( GLADType.GLCanvasOnscreen == gladType || GLADType.GLCanvasOffscreen == gladType ) {
destroyFrame(frame);
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false, null));
} else if( GLADType.GLWindow == gladType ) {
glad.destroy();
} else if( GLADType.GLOffscreen == gladType ) {
glad.destroy();
}
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glad, false));
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(glad, false, null));
Assert.assertEquals(1, glelTracker.initCount);
Assert.assertTrue(1 <= glelTracker.reshapeCount);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java
index a872d692d..393bff746 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java
@@ -51,7 +51,7 @@ import com.jogamp.opengl.util.GLDrawableUtil;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
-import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -89,8 +89,8 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase {
window.setPosition(x, y);
window.setSize(width, height);
window.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(window, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, true, null));
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
final GLDrawable drawable = factory.createGLDrawable(window);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java
index 2fe56dbfe..cd9defd83 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java
@@ -50,8 +50,8 @@ import com.jogamp.opengl.GLEventListenerState;
import com.jogamp.opengl.util.Animator;
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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.test.junit.util.UITestCase;
@@ -104,8 +104,8 @@ public class TestGLContextDrawableSwitch10NEWT extends UITestCase {
window.setPosition(x, y);
window.setSize(width, height);
window.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(window, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, true, null));
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
final GLDrawable drawable = factory.createGLDrawable(window);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug1225EventQueueInterruptedAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug1225EventQueueInterruptedAWT.java
new file mode 100644
index 000000000..6469a26d8
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug1225EventQueueInterruptedAWT.java
@@ -0,0 +1,378 @@
+/**
+ * Copyright 2015 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.jogl.awt;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Label;
+import java.lang.Thread.UncaughtExceptionHandler;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+import org.junit.Assert;
+
+import com.jogamp.common.ExceptionUtils;
+import com.jogamp.common.util.InterruptedRuntimeException;
+import com.jogamp.common.util.SourcedInterruptedException;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.awt.GLCanvas;
+
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+/**
+ * Test to check if interrupt on AWT-EventQueue causes a malfunction in JOGL.
+ * <p>
+ * After tests are displaying an ever color rotating rectangle in an AWT component alone
+ * and with an additional GearsES2 within a GLCanvas.
+ * </p>
+ * <p>
+ * The AWT component is issuing an interrupt during paint on the AWT-EDT.
+ * </p>
+ * <p>
+ * The reporter claims that an interrupt on the AWT-EDT shall not disturb neither AWT nor JOGL's GLCanvas
+ * and rendering shall continue.
+ * <ul>
+ * <li>This seems to be true for JRE 1.8.0_60</li>
+ * <li>This seems to be false for JRE 1.7.0_45. This JRE's AWT-EDT even dies occasionally when interrupted.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * The test passes on GNU/Linux and Windows using JRE 1.8.0_60.
+ * </p>
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug1225EventQueueInterruptedAWT extends UITestCase {
+ static long durationPerTest = 1000; // ms
+
+ private void setVisible(final JFrame frame, final boolean v) throws InterruptedException, InvocationTargetException {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.pack();
+ // frame.setSize(new Dimension(800, 600));
+ frame.setVisible(v);
+ }});
+ }
+ private void dispose(final JFrame jFrame) throws InterruptedException, InvocationTargetException {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ jFrame.dispose();
+ } } ) ;
+ }
+
+
+ @Test(timeout=180000) // TO 3 min
+ public void test01_NoGL() throws InterruptedException, InvocationTargetException {
+ testImpl(false);
+ }
+
+ @Test(timeout=180000) // TO 3 min
+ public void test02_WithGL() throws InterruptedException, InvocationTargetException {
+ testImpl(true);
+ }
+
+ class OurUncaughtExceptionHandler implements UncaughtExceptionHandler {
+ public volatile Thread thread = null;
+ public volatile Throwable exception = null;
+
+ @Override
+ public void uncaughtException(final Thread t, final Throwable e) {
+ thread = t;
+ exception = e;
+ System.err.println("*** UncaughtException (this Thread "+Thread.currentThread().getName()+") : Thread <"+t.getName()+">, "+e.getClass().getName()+": "+e.getMessage());
+ ExceptionUtils.dumpThrowable("", e);
+ }
+ }
+ void testImpl(final boolean useGL) throws InterruptedException, InvocationTargetException {
+ if( !AWTRobotUtil.isAWTEDTAlive() ) {
+ System.err.println("Test aborted: AWT not alive");
+ return;
+ }
+ // Assume.assumeTrue("AWT not alive", AWTRobotUtil.isAWTEDTAlive());
+ // Assert.assertTrue("AWT not alive", AWTRobotUtil.isAWTEDTAlive());
+ final OurUncaughtExceptionHandler uncaughtHandler = new OurUncaughtExceptionHandler();
+ Thread.setDefaultUncaughtExceptionHandler( uncaughtHandler );
+
+ final Dimension csize = new Dimension(800, 400);
+ final JPanel panel = new JPanel(new GridLayout(2, 1));
+ final GLCanvas glc;
+ final InterruptableGLEL iglel;
+ if( useGL ) {
+ glc = new GLCanvas();
+ {
+ final GearsES2 gears = new GearsES2();
+ gears.setVerbose(false);
+ glc.addGLEventListener(gears);
+ }
+ iglel = new InterruptableGLEL();
+ glc.addGLEventListener(iglel);
+ glc.setSize(csize);
+ glc.setPreferredSize(csize);
+ panel.add(glc);
+ } else {
+ NativeWindowFactory.initSingleton();
+ glc = null;
+ iglel = null;
+ final Label l = new Label("No GL Object");
+ l.setSize(csize);
+ l.setPreferredSize(csize);
+ panel.add(l);
+ }
+ final InterruptingComponent icomp = new InterruptingComponent();
+ panel.add(icomp);
+ icomp.setSize(csize);
+ icomp.setPreferredSize(csize);
+
+ final JFrame frame = new JFrame();
+ frame.setResizable(true);
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ frame.getContentPane().add(panel, BorderLayout.CENTER);
+ setVisible(frame, true);
+ if( useGL ) {
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(glc, true, null));
+ }
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(icomp, true, null));
+
+ final InterruptableLoop loop = new InterruptableLoop(icomp, glc);
+ final Thread thread = new Thread(loop);
+
+ synchronized(loop) {
+ thread.start();
+ try {
+ loop.notifyAll(); // wake-up startup-block
+ while( !loop.isRunning && !loop.shallStop ) {
+ loop.wait(); // wait until started
+ }
+ loop.ack = true;
+ loop.notifyAll(); // wake-up startup-block
+ } catch (final InterruptedException e) {
+ Assert.assertNull("while starting loop", new InterruptedRuntimeException(e));
+ }
+ }
+
+ for(int i=0; thread.isAlive() && null == loop.exception && null == uncaughtHandler.exception && i<100; i++) {
+ icomp.interruptAWTEventQueue();
+ Thread.sleep(durationPerTest/100);
+ }
+
+ loop.shallStop = true;
+ synchronized(loop) {
+ try {
+ loop.notifyAll(); // wake-up pause-block (opt)
+ while( loop.isRunning ) {
+ loop.wait(); // wait until stopped
+ }
+ } catch (final InterruptedException e) {
+ Assert.assertNull("while stopping loop", new InterruptedRuntimeException(e));
+ }
+ }
+
+ //
+ // Notifications only!
+ //
+ // Note:
+ // On JRE 1.8.0_60: Interrupt is cleared on AWT-EDT
+ // On JRE 1.7.0_45: Interrupt is *NOT* cleared on AWT-EDT
+ //
+ if( null != iglel && null != iglel.exception ) {
+ ExceptionUtils.dumpThrowable("GLEventListener", iglel.exception);
+ }
+ if( null != icomp.exception ) {
+ ExceptionUtils.dumpThrowable("InterruptingComponent", icomp.exception);
+ }
+ if( null != loop.exception ) {
+ ExceptionUtils.dumpThrowable("loop", loop.exception);
+ }
+ if( null != uncaughtHandler.exception ) {
+ ExceptionUtils.dumpThrowable("uncaughtHandler", uncaughtHandler.exception);
+ }
+ if( !AWTRobotUtil.isAWTEDTAlive() ) {
+ System.err.println("AWT is not alive anymore!!! Ooops");
+ // cannot do anything anymore on AWT-EDT .. frame.dispose();
+ } else {
+ dispose(frame);
+ }
+
+ //
+ // Fail if interrupt was propagated to loop or uncaught handler
+ //
+ Assert.assertNull("Caught Exception in loop", loop.exception);
+ Assert.assertNull("Caught Exception via uncaughtHandler", uncaughtHandler.exception);
+ }
+
+ static class InterruptableLoop implements Runnable {
+ public volatile Exception exception = null;
+ public volatile boolean shallStop = false;
+ public volatile boolean isRunning = false;
+ public volatile boolean ack = false;
+ final InterruptingComponent icomp;
+ final GLCanvas glc;
+ boolean alt = false;;
+
+ InterruptableLoop(final InterruptingComponent icomp, final GLCanvas glc) {
+ this.icomp = icomp;
+ this.glc = glc;
+ }
+
+ public void stop() {
+ shallStop = true;
+ }
+
+ @Override
+ public void run()
+ {
+ synchronized ( this ) {
+ isRunning = true;
+ this.notifyAll();
+ try {
+ while( !ack ) {
+ this.wait(); // wait until ack
+ }
+ this.notifyAll();
+ } catch (final InterruptedException e) {
+ throw new InterruptedRuntimeException(e);
+ }
+ ack = false;
+ }
+ synchronized ( this ) {
+ try {
+ while( !shallStop ) {
+ if( alt ) {
+ icomp.repaint(); // issues paint of GLCanvas on AWT-EDT
+ } else if( null != glc ) {
+ // Avoid invokeAndWait(..) in GLCanvas.display() if AWT-EDT dies!
+ glc.repaint(); // issues paint of GLCanvas on AWT-EDT, which then issues display()!
+ }
+ alt = !alt;
+ Thread.sleep(16);
+ if( Thread.interrupted() ) {
+ final InterruptedRuntimeException e = new InterruptedRuntimeException(new InterruptedException("Interrupt detected in loop, thread: "+Thread.currentThread().getName()));
+ throw e;
+ }
+ }
+ } catch (final InterruptedException e) {
+ exception = SourcedInterruptedException.wrap(e);
+ ExceptionUtils.dumpThrowable("", exception);
+ } catch (final Exception e) {
+ exception = e;
+ ExceptionUtils.dumpThrowable("", exception);
+ } finally {
+ isRunning = false;
+ this.notifyAll();
+ }
+ }
+ }
+ }
+
+ static class InterruptableGLEL implements GLEventListener {
+ public volatile InterruptedException exception = null;
+ @Override
+ public void init(final GLAutoDrawable drawable) {
+ }
+ @Override
+ public void dispose(final GLAutoDrawable drawable) {
+ }
+ @Override
+ public void display(final GLAutoDrawable drawable) {
+ final Thread c = Thread.currentThread();
+ if( c.isInterrupted() && null == exception ) {
+ exception = new InterruptedException("Interrupt detected in GLEventListener, thread: "+c.getName());
+ drawable.removeGLEventListener(this);
+ }
+ }
+ @Override
+ public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {
+ }
+ }
+
+ static class InterruptingComponent extends Component {
+ private static final long serialVersionUID = 1L;
+ public volatile InterruptedException exception = null;
+
+ private volatile boolean doInterrupt = false;
+
+ private final Color[] colors =
+ new Color[] { Color.BLACK, Color.BLUE, Color.DARK_GRAY, Color.GRAY, Color.LIGHT_GRAY };
+ private int colorIdx = 0;
+
+ public InterruptingComponent() {
+ }
+
+ public void interruptAWTEventQueue() {
+ doInterrupt = true;
+ }
+
+ @Override
+ public void paint(final Graphics g)
+ {
+ final Thread c = Thread.currentThread();
+ if( c.isInterrupted() && null == exception ) {
+ exception = new InterruptedException("Interrupt detected in AWT Component, thread: "+c.getName());
+ }
+
+ g.setColor(colors[colorIdx++]);
+ if( colorIdx >= colors.length ) {
+ colorIdx = 0;
+ }
+ g.fillRect(0, 0, getWidth(), getHeight());
+
+ if(doInterrupt) {
+ System.err.println("Thread "+c.getName()+": *Interrupting*");
+ doInterrupt = false;
+ c.interrupt();
+ }
+ }
+ }
+
+ public static void main(final String[] args) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ durationPerTest = MiscUtils.atol(args[++i], durationPerTest);
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestBug1225EventQueueInterruptedAWT.class.getName());
+ }
+}
+
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug1245JTabbedPanelCrashAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug1245JTabbedPanelCrashAWT.java
new file mode 100644
index 000000000..f041d5d01
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug1245JTabbedPanelCrashAWT.java
@@ -0,0 +1,228 @@
+/**
+ * Copyright 2013 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.jogl.awt;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.GridLayout;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.awt.GLCanvas;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.GLEventListenerCounter;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Bug 1245
+ * <p>
+ * https://jogamp.org/bugzilla/show_bug.cgi?id=1245
+ * </p>
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug1245JTabbedPanelCrashAWT extends UITestCase {
+
+ static long durationPerTest = 500*4; // ms
+ static boolean manual = false;
+
+ @SuppressWarnings("serial")
+ static class View3D extends JPanel {
+ final GLCanvas canvas;
+ final Animator animator;
+ final int num;
+
+ public View3D(final int num) {
+ this.num = num;
+ this.setLayout(new BorderLayout());
+ canvas = new GLCanvas();
+ canvas.setSize(new Dimension(100, 100));
+ canvas.setMinimumSize(new Dimension(100, 100));
+ add(canvas, BorderLayout.CENTER);
+ animator = new Animator();
+ animator.add(canvas);
+ // could do animator.start() here as well,
+ // just to be nice - we start/stop at add/remove Notify
+ }
+ @Override
+ public void addNotify() {
+ System.err.println("View3D["+num+"].addNotify()");
+ super.addNotify();
+ if( null != animator ) {
+ animator.start();
+ }
+ }
+ @Override
+ public void removeNotify() {
+ System.err.println("View3D["+num+"].removeNotify()");
+ if( null != animator ) {
+ animator.stop();
+ }
+ super.removeNotify();
+ }
+
+ public String getGLCanvasStats() {
+ return "GLCanvas: comp "+canvas.getBounds()+", visible "+canvas.isVisible()+", showing "+canvas.isShowing()+
+ ", displayable "+canvas.isDisplayable()+", "+canvas.getSurfaceWidth()+"x"+canvas.getSurfaceHeight()+
+ ", "+canvas.getChosenGLCapabilities()+", drawable 0x"+Long.toHexString(canvas.getHandle());
+ }
+ }
+
+ final GLEventListenerCounter glelCounter = new GLEventListenerCounter();
+
+ private JTabbedPane createAndShowGUI(final JFrame frame, final View3D[] views) {
+ final JPanel panel = new JPanel(new GridLayout(1, 1));
+ final JTabbedPane tabbedPanel = new JTabbedPane();
+ for(int i=0; i<views.length; i++) {
+ final GLEventListener demo;
+ if( i%2 == 0 ) {
+ final GearsES2 gears = new GearsES2(1);
+ gears.setVerbose(false);
+ demo = gears;
+ } else {
+ final RedSquareES2 red = new RedSquareES2(1);
+ red.setVerbose(false);
+ demo = red;
+ }
+ views[i] = new View3D(i);
+ views[i].canvas.addGLEventListener(glelCounter);
+ views[i].canvas.addGLEventListener(demo);
+ tabbedPanel.addTab("Tab "+i, null, views[i], "Does nothing");
+ }
+ tabbedPanel.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
+ tabbedPanel.addChangeListener(new javax.swing.event.ChangeListener() {
+ @Override
+ public void stateChanged(final javax.swing.event.ChangeEvent evt) {
+ final int idx = tabbedPanel.getSelectedIndex();
+ if( 0 <= idx && idx < views.length ) {
+ System.err.println("Pane["+idx+"]: State Changed: "+evt);
+ System.err.println("Pane["+idx+"]: "+views[idx].getGLCanvasStats());
+ }
+ }
+ });
+
+ panel.add(tabbedPanel);
+ frame.add(panel, BorderLayout.CENTER);
+ frame.setSize(640,480);
+
+ return tabbedPanel;
+ }
+
+ private static String id(final Object obj) { return "0x"+Integer.toHexString(obj.hashCode()); }
+
+ @BeforeClass
+ public static void startup() {
+ GLProfile.initSingleton();
+ }
+
+ @Test
+ public void test01() throws InterruptedException, InvocationTargetException {
+ final JFrame frame = new JFrame("Java3DApplication");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ final View3D[] views = new View3D[4];
+ final JTabbedPane[] tabbedPane = { null };
+ SwingUtilities.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ //Turn off metal's use of bold fonts
+ UIManager.put("swing.boldMetal", Boolean.FALSE);
+ tabbedPane[0] = createAndShowGUI(frame, views);
+ System.err.println("XXX SetVisible ON XXX");
+ frame.setVisible(true);
+ } } );
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ for(int i=0; i<views.length; i++) {
+ System.err.printf("View "+i+": "+views[i]+",%n "+views[i].getGLCanvasStats()+"%n%n");
+ }
+
+ System.err.println("XXX POST.VISIBLE: "+glelCounter);
+ if(manual) {
+ Thread.sleep(durationPerTest);
+ System.err.println("XXX POST.ACTION: "+glelCounter);
+ } else {
+ final JTabbedPane tabbedPanel = tabbedPane[0];
+
+ for(int i=0; i<views.length; i++) {
+ Thread.sleep(durationPerTest/views.length);
+ switchTab(tabbedPanel, views, i, (i+1)%views.length);
+ }
+ Thread.sleep(durationPerTest/views.length);
+ switchTab(tabbedPanel, views, 0, 1);
+
+ Thread.sleep(durationPerTest/views.length);
+ switchTab(tabbedPanel, views, 1, 0);
+
+ System.err.println("XXX POST.ACTION: "+glelCounter);
+ Assert.assertTrue(glelCounter.initCount >= views.length);
+ }
+
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ System.err.println("XXX SetVisible OFF XXX");
+ frame.dispose();
+ } });
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false, null));
+ System.err.println("XXX POST.DISPOSE: "+glelCounter);
+ }
+
+ void switchTab(final JTabbedPane tabbedPanel, final View3D[] views, final int thisId, final int nextId) throws InvocationTargetException, InterruptedException {
+ javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ System.err.println("XXXX Panel("+id(views[thisId])+" -> Panel("+id(views[nextId])+") START");
+ tabbedPanel.setSelectedIndex(nextId);
+ }});
+ }
+
+ public static void main(final String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ durationPerTest = MiscUtils.atoi(args[++i], (int)durationPerTest);
+ } else if(args[i].equals("-manual")) {
+ manual = true;
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestBug1245JTabbedPanelCrashAWT.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java
index 1250ab6f2..5d8713c86 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug572AWT.java
@@ -110,8 +110,8 @@ public class TestBug572AWT extends UITestCase {
realizeAction.run();
// Wait until it's displayable after issuing initial setVisible(true) on current thread (non AWT-EDT)!
- Assert.assertTrue("GLCanvas didn't become visible", AWTRobotUtil.waitForVisible(glCanvas, true));
- Assert.assertTrue("GLCanvas didn't become realized", AWTRobotUtil.waitForRealized(glCanvas, true)); // implies displayable
+ Assert.assertTrue("GLCanvas didn't become visible", AWTRobotUtil.waitForVisible(glCanvas, true, null));
+ Assert.assertTrue("GLCanvas didn't become realized", AWTRobotUtil.waitForRealized(glCanvas, true, null)); // implies displayable
}
System.err.println("XXXX-0 "+glCanvas.getDelegatedDrawable().isRealized()+", "+glCanvas);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java
index 2b6d8233f..16e61246a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug664GLCanvasSetVisibleSwingAWT.java
@@ -187,8 +187,8 @@ public class TestBug664GLCanvasSetVisibleSwingAWT extends UITestCase {
System.err.println("XXXX Visible Part 1/3");
frameCount = 0;
setFrameVisible(top[0], true);
- Assert.assertTrue("Component didn't become visible", AWTRobotUtil.waitForVisible(glc, true));
- Assert.assertTrue("Component didn't become realized", AWTRobotUtil.waitForRealized(glc, true));
+ Assert.assertTrue("Component didn't become visible", AWTRobotUtil.waitForVisible(glc, true, null));
+ Assert.assertTrue("Component didn't become realized", AWTRobotUtil.waitForRealized(glc, true, null));
anim.setUpdateFPSFrames(60, System.err);
anim.start();
@@ -200,7 +200,7 @@ public class TestBug664GLCanvasSetVisibleSwingAWT extends UITestCase {
System.err.println("XXXXX Invisible Part 2/3");
setComponentVisible(glc, false);
- Assert.assertTrue("Component didn't become invisible", AWTRobotUtil.waitForVisible(glc, false));
+ Assert.assertTrue("Component didn't become invisible", AWTRobotUtil.waitForVisible(glc, false, null));
final int frameCountT0 = frameCount;
anim.resetFPSCounter();
@@ -215,7 +215,7 @@ public class TestBug664GLCanvasSetVisibleSwingAWT extends UITestCase {
System.err.println("XXXX Visible Part 3/3");
setComponentVisible(glc, true);
- Assert.assertTrue("Component didn't become visible", AWTRobotUtil.waitForVisible(glc, true));
+ Assert.assertTrue("Component didn't become visible", AWTRobotUtil.waitForVisible(glc, true, null));
anim.resetFPSCounter();
while( anim.getTotalFPSDuration() < durationPerTest ) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java
index 7758a525e..7f0233915 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java
@@ -155,8 +155,8 @@ public class TestBug816GLCanvasFrameHoppingB849B889AWT extends UITestCase {
frame2.setVisible(true);
}
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true, null));
dumpGLCanvasStats(glCanvas);
if(manual) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java
index 1aeaccb81..541cceac0 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java
@@ -118,8 +118,8 @@ public class TestBug816JTabbedPanelVisibilityB849B878AWT extends UITestCase {
System.err.println("XXX SetVisible ON XXX GLCanvas on Panel1("+id(panel1)+")");
frame.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true, null));
dumpGLCanvasStats(glCanvas);
if(manual) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java
index c33b2e5ba..383bb3760 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java
@@ -248,10 +248,10 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase {
}
frame.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true, null));
if( twoCanvas ) {
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas2, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas2, true, null));
}
animator.start();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java
index 5e20bb3f7..15b4c6126 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos02AWT.java
@@ -101,8 +101,8 @@ public class TestBug816OSXCALayerPos02AWT extends UITestCase {
frame.setSize(width, height);
frame.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true, null));
animator.start();
Assert.assertTrue(animator.isStarted());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java
index ac3903ec6..d24cccdc6 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03aB729AWT.java
@@ -115,8 +115,8 @@ public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase {
frame.setSize(width, height);
frame.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true, null));
animator.start();
Assert.assertTrue(animator.isStarted());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java
index 62526420f..1ec6dae2c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03bB849AWT.java
@@ -121,8 +121,8 @@ public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase {
frame.setSize(width, height);
frame.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true, null));
animator.start();
Assert.assertTrue(animator.isStarted());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java
index 3d46b5315..03bff669e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos03cB849AWT.java
@@ -123,8 +123,8 @@ public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase {
frame.setSize(width, height);
frame.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true, null));
animator.start();
Assert.assertTrue(animator.isStarted());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java
index 74046e8a1..4d1e8157e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04aAWT.java
@@ -88,7 +88,7 @@ public class TestBug816OSXCALayerPos04aAWT extends UITestCase {
frame.setSize(width, height);
frame.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
final Dialog dialog = new Dialog(frame, "Bug 816 AWT Top-Level Dialog");
dialog.setLayout(new BorderLayout());
@@ -100,8 +100,8 @@ public class TestBug816OSXCALayerPos04aAWT extends UITestCase {
dialog.setSize(width/2, height/2);
dialog.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(dialog, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(dialog, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true, null));
animator.start();
Assert.assertTrue(animator.isStarted());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java
index 704b589f3..dddfcabf8 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos04bAWT.java
@@ -88,7 +88,7 @@ public class TestBug816OSXCALayerPos04bAWT extends UITestCase {
frame.setSize(width, height);
frame.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
final JDialog dialog = new JDialog(frame, "Bug 816 AWT Top-Level JDialog");
dialog.setLayout(new BorderLayout());
@@ -100,8 +100,8 @@ public class TestBug816OSXCALayerPos04bAWT extends UITestCase {
dialog.setSize(width/2, height/2);
dialog.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(dialog, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(dialog, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true, null));
animator.start();
Assert.assertTrue(animator.isStarted());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java
index 46ae20765..e37a29b4f 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestGLJPanelTextureStateAWT.java
@@ -263,8 +263,8 @@ public class TestGLJPanelTextureStateAWT extends UITestCase {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
}
- Assert.assertTrue("Component didn't become visible", AWTRobotUtil.waitForVisible(glc, true));
- Assert.assertTrue("Component didn't become realized", AWTRobotUtil.waitForRealized(glc, true));
+ Assert.assertTrue("Component didn't become visible", AWTRobotUtil.waitForVisible(glc, true, null));
+ Assert.assertTrue("Component didn't become realized", AWTRobotUtil.waitForRealized(glc, true, null));
Thread.sleep(100);
setFrameSize(frame, true, glc_sz2);
System.err.println("window resize pos/siz: "+glc.getX()+"/"+glc.getY()+" "+glc.getSurfaceWidth()+"x"+glc.getSurfaceHeight());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java
index f3c2734b5..dfd2489e2 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestTranslucencyNEWT.java
@@ -28,6 +28,8 @@
package com.jogamp.opengl.test.junit.jogl.caps;
+import com.jogamp.common.util.InterruptSource;
+import com.jogamp.junit.util.JunitTracer;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.opengl.GLWindow;
@@ -92,12 +94,12 @@ public class TestTranslucencyNEWT extends UITestCase {
return;
}
if(e.getKeyChar()=='f') {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
f_glWindow.setFullscreen(!f_glWindow.isFullscreen());
} }.start();
} else if(e.getKeyChar()=='d') {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
f_glWindow.setUndecorated(!f_glWindow.isUndecorated());
} }.start();
@@ -157,7 +159,7 @@ public class TestTranslucencyNEWT extends UITestCase {
}
}
if( waitForKey ) {
- UITestCase.waitForKey("main");
+ JunitTracer.waitForKey("main");
}
org.junit.runner.JUnitCore.main(TestTranslucencyNEWT.class.getName());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/GLClearOnInitReshape.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GLClearOnInitReshape.java
new file mode 100644
index 000000000..46be7ef0a
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/GLClearOnInitReshape.java
@@ -0,0 +1,64 @@
+/**
+ * Copyright 2015 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.jogl.demos;
+
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLEventListener;
+
+public class GLClearOnInitReshape implements GLEventListener {
+ int lastWidth, lastHeight;
+ boolean doClear;
+
+ @Override
+ public void init(final GLAutoDrawable drawable) {
+ lastWidth = drawable.getSurfaceWidth();
+ lastHeight = drawable.getSurfaceHeight();
+ doClear = true;
+ }
+
+ @Override
+ public void dispose(final GLAutoDrawable drawable) { }
+
+ @Override
+ public void display(final GLAutoDrawable drawable) {
+ if( doClear ) {
+ drawable.getGL().glClear(GL.GL_COLOR_BUFFER_BIT);
+ doClear = false;
+ }
+ }
+
+ @Override
+ public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {
+ if( lastHeight != height || lastWidth != width ) {
+ doClear = true;
+ lastWidth = width;
+ lastHeight = height;
+ }
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java
index 7189db1f3..e8acb0baf 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/PointsDemoES1.java
@@ -181,9 +181,7 @@ public class PointsDemoES1 extends PointsDemo {
// Thread.dumpStack();
final GL2ES1 gl = glad.getGL().getGL2ES1();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
- }
+ gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
// Set location in front of camera
gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
index 60ac6b233..7eebf4489 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/RedSquareES1.java
@@ -141,9 +141,7 @@ public class RedSquareES1 implements GLEventListener, TileRendererBase.TileRende
@Override
public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) {
final GL2ES1 gl = glad.getGL().getGL2ES1();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval);
- }
+ gl.setSwapInterval(swapInterval);
reshapeImpl(gl, x, y, width, height, width, height);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java
index 771748a33..432652701 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestGearsES1NEWT.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.test.junit.jogl.demos.es1.newt;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.opengl.GLWindow;
@@ -92,12 +93,12 @@ public class TestGearsES1NEWT extends UITestCase {
return;
}
if(e.getKeyChar()=='f') {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
f_glWindow.setFullscreen(!f_glWindow.isFullscreen());
} }.start();
} else if(e.getKeyChar()=='d') {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
f_glWindow.setUndecorated(!f_glWindow.isUndecorated());
} }.start();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java
index 9bf04a75f..769183e82 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/newt/TestRedSquareES1NEWT.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.test.junit.jogl.demos.es1.newt;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.opengl.GLWindow;
@@ -90,12 +91,12 @@ public class TestRedSquareES1NEWT extends UITestCase {
return;
}
if(e.getKeyChar()=='f') {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
f_glWindow.setFullscreen(!f_glWindow.isFullscreen());
} }.start();
} else if(e.getKeyChar()=='d') {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
f_glWindow.setUndecorated(!f_glWindow.isUndecorated());
} }.start();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java
index ff88af50a..de2d3458a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java
@@ -267,9 +267,7 @@ public class FBOMix2DemosES2 implements GLEventListener {
public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
- }
+ gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
System.err.println("**** Reshape: "+width+"x"+height);
resetFBOs(gl, drawable);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
index e1abcc752..c0a4756e7 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
@@ -319,9 +319,7 @@ public class GearsES2 implements StereoGLEventListener, TileRendererBase.TileRen
public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) {
if( !isInit ) { return; }
final GL2ES2 gl = glad.getGL().getGL2ES2();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval);
- }
+ gl.setSwapInterval(swapInterval);
reshapeImpl(gl, x, y, width, height, width, height);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java
index a504ec1ed..18c0ffd68 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java
@@ -128,9 +128,7 @@ public class LandscapeES2 implements GLEventListener {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
- }
+ gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
shaderState.useProgram(gl, true);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LineSquareXDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LineSquareXDemoES2.java
new file mode 100644
index 000000000..2169b93d0
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LineSquareXDemoES2.java
@@ -0,0 +1,189 @@
+/**
+ * Copyright (C) 2015 JogAmp Community. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package com.jogamp.opengl.test.junit.jogl.demos.es2;
+
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL2ES2;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLUniformData;
+import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
+
+import com.jogamp.opengl.util.ImmModeSink;
+import com.jogamp.opengl.util.PMVMatrix;
+import com.jogamp.opengl.util.glsl.ShaderCode;
+import com.jogamp.opengl.util.glsl.ShaderProgram;
+import com.jogamp.opengl.util.glsl.ShaderState;
+
+public class LineSquareXDemoES2 implements GLEventListener {
+
+ private boolean multisample, clearBuffers;
+ private final ShaderState st;
+ private final PMVMatrix pmvMatrix;
+ private ShaderProgram sp0;
+ private GLUniformData pmvMatrixUniform;
+ private ImmModeSink immModeSink;
+
+ public LineSquareXDemoES2(final boolean multisample) {
+ this.multisample = multisample;
+ this.clearBuffers = true;
+ st = new ShaderState();
+ st.setVerbose(true);
+ pmvMatrix = new PMVMatrix();
+ }
+
+ public void setClearBuffers(final boolean v) { clearBuffers = v; }
+
+ public void init(final GLAutoDrawable glad) {
+ final GL2ES2 gl = glad.getGL().getGL2ES2();
+
+ System.err.println();
+ System.err.println("req. msaa: "+multisample);
+ System.err.println("Requested: " + glad.getNativeSurface().getGraphicsConfiguration().getRequestedCapabilities());
+ multisample = multisample && glad.getChosenGLCapabilities().getNumSamples() > 0 ;
+ System.err.println("Chosen : " + glad.getChosenGLCapabilities());
+ System.err.println("has msaa: "+multisample);
+ System.err.println();
+
+ final ShaderCode vp0 = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, LineSquareXDemoES2.class, "shader",
+ "shader/bin", "mgl_default_xxx", true);
+ final ShaderCode fp0 = ShaderCode.create(gl, GL2ES2.GL_FRAGMENT_SHADER, LineSquareXDemoES2.class, "shader",
+ "shader/bin", "mgl_default_xxx", true);
+ vp0.defaultShaderCustomization(gl, true, true);
+ fp0.defaultShaderCustomization(gl, true, true);
+
+ sp0 = new ShaderProgram();
+ sp0.add(gl, vp0, System.err);
+ sp0.add(gl, fp0, System.err);
+ st.attachShaderProgram(gl, sp0, true);
+
+ pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf());
+ st.ownUniform(pmvMatrixUniform);
+ st.uniform(gl, pmvMatrixUniform);
+
+ final float c = 0f;
+ final float eX = 0.5f;
+ final float eH = 0.98f;
+ final float e2 = 1f;
+
+ // Using predef array names, see
+ // GLPointerFuncUtil.getPredefinedArrayIndexName(glArrayIndex);
+ immModeSink = ImmModeSink.createGLSL(20*2,
+ 3, GL.GL_FLOAT, // vertex
+ 4, GL.GL_FLOAT, // color
+ 0, GL.GL_FLOAT, // normal
+ 0, GL.GL_FLOAT, // texCoords
+ GL.GL_STATIC_DRAW, st);
+ immModeSink.glBegin(GL.GL_LINES);
+
+ // Rectangle
+ immModeSink.glVertex3f(-eX, -eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f(-eX, eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f(-eX, eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f( eX, eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f( eX, eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f( eX, -eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f( eX, -eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f(-eX, -eH, 0f); immModeSink.glColor4f( c, c, c, c );
+
+ // Square
+ immModeSink.glVertex3f(-eH, -eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f(-eH, eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f(-eH, eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f( eH, eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f( eH, eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f( eH, -eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f( eH, -eH, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f(-eH, -eH, 0f); immModeSink.glColor4f( c, c, c, c );
+
+ // X
+ immModeSink.glVertex3f(-e2, -e2, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f( e2, e2, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f(-e2, e2, 0f); immModeSink.glColor4f( c, c, c, c );
+ immModeSink.glVertex3f( e2, -e2, 0f); immModeSink.glColor4f( c, c, c, c );
+
+ immModeSink.glEnd(gl, false);
+
+ st.useProgram(gl, false);
+ }
+
+ public void dispose(final GLAutoDrawable glad) {
+ final GL2ES2 gl = glad.getGL().getGL2ES2();
+ immModeSink.destroy(gl);
+ immModeSink = null;
+ st.destroy(gl);
+ }
+
+ public void display(final GLAutoDrawable glad) {
+ final GL2ES2 gl = glad.getGL().getGL2ES2();
+ if (multisample) {
+ gl.glEnable(GL.GL_MULTISAMPLE);
+ }
+ if( clearBuffers ) {
+ final float c = 0.9f;
+ gl.glClearColor(c, c, c, 0);
+ // gl.glEnable(GL.GL_DEPTH_TEST);
+ // gl.glDepthFunc(GL.GL_LESS);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
+ }
+
+ st.useProgram(gl, true);
+
+ immModeSink.draw(gl, true);
+
+ st.useProgram(gl, false);
+ }
+
+ // Unused routines
+ public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) {
+ System.err.println("reshape ..");
+ final GL2ES2 gl = glad.getGL().getGL2ES2();
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
+ pmvMatrix.glLoadIdentity();
+ final float left, right, bottom, top;
+ if( height > width ) {
+ final float a = (float)height / (float)width;
+ left = -1.0f;
+ right = 1.0f;
+ bottom = -a;
+ top = a;
+ } else {
+ final float a = (float)width / (float)height;
+ left = -a;
+ right = a;
+ bottom = -1.0f;
+ top = 1.0f;
+ }
+ // pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f);
+ // pmvMatrix.glOrthof(-1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 10.0f);
+ pmvMatrix.glOrthof(left, right, top, bottom, 0.0f, 10.0f);
+ pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
+ pmvMatrix.glLoadIdentity();
+
+ st.useProgram(gl, true);
+ st.uniform(gl, pmvMatrixUniform);
+ st.useProgram(gl, false);
+ }
+
+ public void displayChanged(final GLAutoDrawable drawable, final boolean modeChanged, final boolean deviceChanged) {
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java
index 6d202707e..3ec383ad8 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/Mix2TexturesES2.java
@@ -181,9 +181,7 @@ public class Mix2TexturesES2 implements GLEventListener {
public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
- }
+ gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION);
pmvMatrix.glLoadIdentity();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
index 673552c5f..d59c1bb84 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/PointsDemoES2.java
@@ -186,9 +186,7 @@ public class PointsDemoES2 extends PointsDemo {
// Thread.dumpStack();
final GL2ES2 gl = glad.getGL().getGL2ES2();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
- }
+ gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
st.useProgram(gl, true);
// Set location in front of camera
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
index a0afef87a..eb96d1593 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareES2.java
@@ -52,6 +52,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
private int swapInterval = 0;
private float aspect = 1.0f;
private boolean doRotate = true;
+ private boolean verbose = true;
private boolean clearBuffers = true;
private TileRendererBase tileRendererInUse = null;
private boolean doRotateBeforePrinting;
@@ -87,16 +88,21 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
public void setAspect(final float aspect) { this.aspect = aspect; }
public void setDoRotation(final boolean rotate) { this.doRotate = rotate; }
public void setClearBuffers(final boolean v) { clearBuffers = v; }
+ public void setVerbose(final boolean v) { verbose = v; }
@Override
public void init(final GLAutoDrawable glad) {
- System.err.println(Thread.currentThread()+" RedSquareES2.init: tileRendererInUse "+tileRendererInUse);
+ if(verbose) {
+ System.err.println(Thread.currentThread()+" RedSquareES2.init: tileRendererInUse "+tileRendererInUse);
+ }
final GL2ES2 gl = glad.getGL().getGL2ES2();
- System.err.println("RedSquareES2 init on "+Thread.currentThread());
- System.err.println("Chosen GLCapabilities: " + glad.getChosenGLCapabilities());
- System.err.println("INIT GL IS: " + gl.getClass().getName());
- System.err.println(JoglVersion.getGLStrings(gl, null, false).toString());
+ if(verbose) {
+ System.err.println("RedSquareES2 init on "+Thread.currentThread());
+ System.err.println("Chosen GLCapabilities: " + glad.getChosenGLCapabilities());
+ System.err.println("INIT GL IS: " + gl.getClass().getName());
+ System.err.println(JoglVersion.getGLStrings(gl, null, false).toString());
+ }
if( !gl.hasGLSL() ) {
System.err.println("No GLSL available, no rendering.");
return;
@@ -149,7 +155,9 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
st.useProgram(gl, false);
t0 = System.currentTimeMillis();
- System.err.println(Thread.currentThread()+" RedSquareES2.init FIN");
+ if(verbose) {
+ System.err.println(Thread.currentThread()+" RedSquareES2.init FIN");
+ }
}
@Override
@@ -192,9 +200,7 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
@Override
public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) {
final GL2ES2 gl = glad.getGL().getGL2ES2();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval);
- }
+ gl.setSwapInterval(swapInterval);
reshapeImpl(gl, x, y, width, height, width, height);
}
@@ -208,7 +214,9 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
}
void reshapeImpl(final GL2ES2 gl, final int tileX, final int tileY, final int tileWidth, final int tileHeight, final int imageWidth, final int imageHeight) {
- System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse);
+ if(verbose) {
+ System.err.println(Thread.currentThread()+" RedSquareES2.reshape "+tileX+"/"+tileY+" "+tileWidth+"x"+tileHeight+" of "+imageWidth+"x"+imageHeight+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(gl.getContext().getGLDrawable().getHandle())+", tileRendererInUse "+tileRendererInUse);
+ }
// Thread.dumpStack();
if( !gl.hasGLSL() ) {
return;
@@ -249,7 +257,9 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
@Override
public void dispose(final GLAutoDrawable glad) {
- System.err.println(Thread.currentThread()+" RedSquareES2.dispose: tileRendererInUse "+tileRendererInUse);
+ if(verbose) {
+ System.err.println(Thread.currentThread()+" RedSquareES2.dispose: tileRendererInUse "+tileRendererInUse);
+ }
final GL2ES2 gl = glad.getGL().getGL2ES2();
if( !gl.hasGLSL() ) {
return;
@@ -257,6 +267,8 @@ public class RedSquareES2 implements GLEventListener, TileRendererBase.TileRende
st.destroy(gl);
st = null;
pmvMatrix = null;
- System.err.println(Thread.currentThread()+" RedSquareES2.dispose FIN");
+ if(verbose) {
+ System.err.println(Thread.currentThread()+" RedSquareES2.dispose FIN");
+ }
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java
index 9dab97d16..3b526401d 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/RedSquareMappedES2.java
@@ -211,9 +211,7 @@ public class RedSquareMappedES2 implements GLEventListener, TileRendererBase.Til
@Override
public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) {
final GL2ES2 gl = glad.getGL().getGL2ES2();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval);
- }
+ gl.setSwapInterval(swapInterval);
reshapeImpl(gl, x, y, width, height, width, height);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java
index 2d6745594..e360b5987 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java
@@ -230,9 +230,7 @@ public class TextureDraw02ES2ListenerFBO implements GLEventListener {
public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
- }
+ gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
System.err.println("**** Reshape.Reset: "+width+"x"+height);
if( keepTextureBound ) {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/CrossFadePlayer.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/CrossFadePlayer.java
index b2ebc7068..cc4096672 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/CrossFadePlayer.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/CrossFadePlayer.java
@@ -29,6 +29,7 @@
package com.jogamp.opengl.test.junit.jogl.demos.es2.av;
import com.jogamp.common.net.Uri;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.opengl.util.av.AudioSink;
import com.jogamp.opengl.util.av.GLMediaPlayer;
import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
@@ -73,7 +74,7 @@ public class CrossFadePlayer
System.out.println("Duration: " + mp.getDuration() + "ms");
System.out.println("Volume: " + mp.getAudioVolume());
System.out.println("player.initGL()...");
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
try {
mp.initGL(null);
@@ -98,7 +99,7 @@ public class CrossFadePlayer
stop = true;
} else {
System.err.println("Player State: EOS");
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
System.out.println("mp.setPlaySpeed(1f) returned: " + mp.setPlaySpeed(1f));
mp.seek(0);
@@ -112,7 +113,7 @@ public class CrossFadePlayer
if( null != se ) {
se.printStackTrace();
}
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
System.out.println("terminating...");
stop = true;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
index b938adb53..a8dede526 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
@@ -42,10 +42,12 @@ import com.jogamp.opengl.GLException;
import com.jogamp.opengl.GLProfile;
import com.jogamp.common.net.Uri;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.font.Font;
+import com.jogamp.junit.util.JunitTracer;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
@@ -57,7 +59,6 @@ import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.graph.TextRendererGLELBase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.TextureSequenceCubeES2;
import com.jogamp.opengl.test.junit.util.MiscUtils;
-import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.av.GLMediaPlayer;
import com.jogamp.opengl.util.av.GLMediaPlayer.GLMediaEventListener;
@@ -75,7 +76,7 @@ public class MovieCube implements GLEventListener {
private TextureSequenceCubeES2 cube=null;
private GLMediaPlayer mPlayer=null;
private int swapInterval = 1;
- private int swapIntervalSet = -1;
+ private boolean swapIntervalSet = true;
private long lastPerfPos = 0;
private volatile boolean resetGLState = false;
@@ -116,7 +117,7 @@ public class MovieCube implements GLEventListener {
resetGLState();
}
if( 0 != ( GLMediaEventListener.EVENT_CHANGE_EOS & event_mask ) ) {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
// loop for-ever ..
mPlayer.seek(0);
@@ -246,7 +247,7 @@ public class MovieCube implements GLEventListener {
final String text1 = String.format("%0"+ptsPrec+"f/%0"+ptsPrec+"f s, %s (%01.2fx, vol %01.2f), a %01.2f, fps %02.1f -> %02.1f / %02.1f, v-sync %d",
pts, mPlayer.getDuration() / 1000f,
mPlayer.getState().toString().toLowerCase(), mPlayer.getPlaySpeed(), mPlayer.getAudioVolume(),
- aspect, mPlayer.getFramerate(), lfps, tfps, swapIntervalSet);
+ aspect, mPlayer.getFramerate(), lfps, tfps, swapInterval);
final String text2 = String.format("audio: id %d, kbps %d, codec %s",
mPlayer.getAID(), mPlayer.getAudioBitrate()/1000, mPlayer.getAudioCodec());
final String text3 = String.format("video: id %d, kbps %d, codec %s",
@@ -278,10 +279,13 @@ public class MovieCube implements GLEventListener {
int pts1 = 0;
switch(e.getKeySymbol()) {
case KeyEvent.VK_V: {
- switch(swapIntervalSet) {
- case 0: swapInterval = 1; break;
- default: swapInterval = 0; break;
+ switch(swapInterval) {
+ case 0: swapInterval = -1; break;
+ case -1: swapInterval = 1; break;
+ case 1: swapInterval = 0; break;
+ default: swapInterval = 1; break;
}
+ swapIntervalSet = true;
break;
}
case KeyEvent.VK_O: displayOSD = !displayOSD; break;
@@ -362,7 +366,7 @@ public class MovieCube implements GLEventListener {
cube = new TextureSequenceCubeES2(mPlayer, false, zoom0, rotx, roty);
if(waitForKey) {
- UITestCase.waitForKey("Init>");
+ JunitTracer.waitForKey("Init>");
}
if( GLMediaPlayer.State.Initialized == mPlayer.getState() ) {
@@ -433,12 +437,14 @@ public class MovieCube implements GLEventListener {
@Override
public void display(final GLAutoDrawable drawable) {
- if(-1 != swapInterval) {
+ if( swapIntervalSet ) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
- gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
+ final int _swapInterval = swapInterval;
+ gl.setSwapInterval(_swapInterval); // in case switching the drawable (impl. may bound attribute there)
drawable.getAnimator().resetFPSCounter();
- swapIntervalSet = swapInterval;
- swapInterval = -1;
+ swapInterval = gl.getSwapInterval();
+ System.err.println("Swap Interval: "+_swapInterval+" -> "+swapInterval);
+ swapIntervalSet = false;
}
if(null == mPlayer) { return; }
@@ -594,7 +600,7 @@ public class MovieCube implements GLEventListener {
if( null != se ) {
se.printStackTrace();
}
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
window.destroy();
} }.start();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java
index e936bf991..9b9073721 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSBSStereo.java
@@ -42,6 +42,7 @@ import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.common.net.Uri;
import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
@@ -800,7 +801,7 @@ public class MovieSBSStereo implements StereoGLEventListener {
static class StereoGLMediaEventListener implements GLMediaEventListener {
void destroyWindow(final Window window) {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
window.destroy();
} }.start();
@@ -846,7 +847,7 @@ public class MovieSBSStereo implements StereoGLEventListener {
destroy = true;
} else {
System.err.println("MovieSimple State: EOS");
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
mp.setPlaySpeed(1f);
mp.seek(0);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
index 22dfa923e..25ce93597 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
@@ -47,10 +47,12 @@ import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.common.net.Uri;
import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.graph.curve.Region;
import com.jogamp.graph.curve.opengl.GLRegion;
import com.jogamp.graph.curve.opengl.RegionRenderer;
import com.jogamp.graph.font.Font;
+import com.jogamp.junit.util.JunitTracer;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
@@ -65,7 +67,6 @@ import com.jogamp.opengl.GLExtensions;
import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.test.junit.graph.TextRendererGLELBase;
import com.jogamp.opengl.test.junit.util.MiscUtils;
-import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.GLArrayDataServer;
import com.jogamp.opengl.util.PMVMatrix;
@@ -105,7 +106,7 @@ public class MovieSimple implements GLEventListener {
private int effects = EFFECT_NORMAL;
private float alpha = 1.0f;
private int swapInterval = 1;
- private int swapIntervalSet = -1;
+ private boolean swapIntervalSet = true;
private GLMediaPlayer mPlayer;
private final boolean mPlayerShared;
@@ -185,7 +186,7 @@ public class MovieSimple implements GLEventListener {
final float aspect = (float)mPlayer.getWidth() / (float)mPlayer.getHeight();
final String ptsPrec = null != regionFPS ? "3.1" : "3.0";
- final String text1 = String.format("%0"+ptsPrec+"f/%0"+ptsPrec+"f s, %s (%01.2fx, vol %01.2f), a %01.2f, fps %02.1f -> %02.1f / %02.1f, v-sync %d",
+ final String text1 = String.format("%0"+ptsPrec+"f/%0"+ptsPrec+"f s, %s (%01.2fx, vol %01.2f), a %01.2f, fps %02.1f -> %02.1f / %02.1f, v-sync %b",
pts, mPlayer.getDuration() / 1000f,
mPlayer.getState().toString().toLowerCase(), mPlayer.getPlaySpeed(), mPlayer.getAudioVolume(),
aspect, mPlayer.getFramerate(), lfps, tfps, swapIntervalSet);
@@ -265,10 +266,13 @@ public class MovieSimple implements GLEventListener {
int pts1 = 0;
switch(e.getKeySymbol()) {
case KeyEvent.VK_V: {
- switch(swapIntervalSet) {
- case 0: swapInterval = 1; break;
- default: swapInterval = 0; break;
+ switch(swapInterval) {
+ case 0: swapInterval = -1; break;
+ case -1: swapInterval = 1; break;
+ case 1: swapInterval = 0; break;
+ default: swapInterval = 1; break;
}
+ swapIntervalSet = true;
break;
}
case KeyEvent.VK_O: displayOSD = !displayOSD; break;
@@ -352,7 +356,7 @@ public class MovieSimple implements GLEventListener {
resetGLState();
}
if( 0 != ( GLMediaEventListener.EVENT_CHANGE_EOS & event_mask ) ) {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
// loop for-ever ..
mPlayer.seek(0);
@@ -483,7 +487,7 @@ public class MovieSimple implements GLEventListener {
", "+drawable.getClass().getName()+", "+drawable);
if(waitForKey) {
- UITestCase.waitForKey("Init>");
+ JunitTracer.waitForKey("Init>");
}
final Texture tex;
try {
@@ -736,11 +740,13 @@ public class MovieSimple implements GLEventListener {
@Override
public void display(final GLAutoDrawable drawable) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval); // in case switching the drawable (impl. may bound attribute there)
+ if( swapIntervalSet ) {
+ final int _swapInterval = swapInterval;
+ gl.setSwapInterval(_swapInterval); // in case switching the drawable (impl. may bound attribute there)
drawable.getAnimator().resetFPSCounter();
- swapIntervalSet = swapInterval;
- swapInterval = -1;
+ swapInterval = gl.getSwapInterval();
+ System.err.println("Swap Interval: "+_swapInterval+" -> "+swapInterval);
+ swapIntervalSet = false;
}
if(null == mPlayer) { return; }
@@ -802,7 +808,7 @@ public class MovieSimple implements GLEventListener {
static class MyGLMediaEventListener implements GLMediaEventListener {
void destroyWindow(final Window window) {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
window.destroy();
} }.start();
@@ -836,7 +842,7 @@ public class MovieSimple implements GLEventListener {
/**
* Kick off player w/o GLEventListener, i.e. for audio only.
*
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
try {
mp.initGL(null);
@@ -868,7 +874,7 @@ public class MovieSimple implements GLEventListener {
} else {
System.err.println("MovieSimple State: EOS");
if( loopEOS ) {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
mp.setPlaySpeed(1f);
mp.seek(0);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
index 2e805d8fd..83826bacc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java
@@ -158,7 +158,15 @@ public class TestGearsES2AWT extends UITestCase {
private void setTitle(final Frame frame, final GLCanvas glc, final GLCapabilitiesImmutable caps) {
final String capsA = caps.isBackgroundOpaque() ? "opaque" : "transl";
final java.awt.Rectangle b = glc.getBounds();
- frame.setTitle("GLCanvas["+capsA+"], swapI "+swapInterval+", win: ["+b.x+"/"+b.y+" "+b.width+"x"+b.height+"], pix: "+glc.getSurfaceWidth()+"x"+glc.getSurfaceHeight());
+ final float[] minSurfacePixelScale = glc.getMinimumSurfaceScale(new float[2]);
+ final float[] maxSurfacePixelScale = glc.getMaximumSurfaceScale(new float[2]);
+ final float[] reqSurfacePixelScale = glc.getRequestedSurfaceScale(new float[2]);
+ final float[] hasSurfacePixelScale = glc.getCurrentSurfaceScale(new float[2]);
+ frame.setTitle("GLCanvas["+capsA+"], swapI "+swapInterval+", win: ["+b.x+"/"+b.y+" "+b.width+"x"+b.height+"], pix: "+glc.getSurfaceWidth()+"x"+glc.getSurfaceHeight()+
+ ", scale[min "+minSurfacePixelScale[0]+"x"+minSurfacePixelScale[1]+", max "+
+ maxSurfacePixelScale[0]+"x"+maxSurfacePixelScale[1]+", req "+
+ reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" -> has "+
+ hasSurfacePixelScale[0]+"x"+hasSurfacePixelScale[1]+"]");
}
protected void runTestGL(final GLCapabilities caps, final ResizeBy resizeBy, final FrameLayout frameLayout) throws InterruptedException, InvocationTargetException {
@@ -275,8 +283,8 @@ public class TestGearsES2AWT extends UITestCase {
}
frame.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true, null));
final float[] hasSurfacePixelScale1 = glCanvas.getCurrentSurfaceScale(new float[2]);
System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
index dfc2d1165..bbcb936f3 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java
@@ -31,6 +31,8 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2.awt;
import java.awt.AWTException;
import java.awt.BorderLayout;
import java.awt.Dimension;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
import java.lang.reflect.InvocationTargetException;
import com.jogamp.nativewindow.ScalableSurface;
@@ -63,6 +65,7 @@ import com.jogamp.newt.event.TraceKeyAdapter;
import com.jogamp.newt.event.TraceWindowAdapter;
import com.jogamp.newt.event.awt.AWTKeyAdapter;
import com.jogamp.newt.event.awt.AWTWindowAdapter;
+import com.jogamp.opengl.test.junit.jogl.demos.GLClearOnInitReshape;
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;
@@ -78,6 +81,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
static boolean forceES3 = false;
static boolean forceGL3 = false;
static boolean forceGLFFP = false;
+ static int demoType = 1;
static boolean shallUsePBuffer = false;
static boolean shallUseBitmap = false;
static boolean useMSAA = false;
@@ -118,17 +122,41 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
private void setTitle(final JFrame frame, final GLJPanel glc, final GLCapabilitiesImmutable caps) {
final String capsA = caps.isBackgroundOpaque() ? "opaque" : "transl";
final java.awt.Rectangle b = glc.getBounds();
- frame.setTitle("GLJPanel["+capsA+"], swapI "+swapInterval+", win: ["+b.x+"/"+b.y+" "+b.width+"x"+b.height+"], pix: "+glc.getSurfaceWidth()+"x"+glc.getSurfaceHeight());
+
+ final float[] minSurfacePixelScale = glc.getMinimumSurfaceScale(new float[2]);
+ final float[] maxSurfacePixelScale = glc.getMaximumSurfaceScale(new float[2]);
+ final float[] reqSurfacePixelScale = glc.getRequestedSurfaceScale(new float[2]);
+ final float[] hasSurfacePixelScale = glc.getCurrentSurfaceScale(new float[2]);
+ frame.setTitle("GLJPanel["+capsA+"], swapI "+swapInterval+", win: ["+b.x+"/"+b.y+" "+b.width+"x"+b.height+"], pix: "+glc.getSurfaceWidth()+"x"+glc.getSurfaceHeight()+
+ ", scale[min "+minSurfacePixelScale[0]+"x"+minSurfacePixelScale[1]+", max "+
+ maxSurfacePixelScale[0]+"x"+maxSurfacePixelScale[1]+", req "+
+ reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" -> has "+
+ hasSurfacePixelScale[0]+"x"+hasSurfacePixelScale[1]+"]");
}
- protected void runTestGL(final GLCapabilities caps)
+ protected GLEventListener createDemo(final GLCapabilities caps) {
+ final GLEventListener demo;
+ if( 1 == demoType ) {
+ if( caps.isBitmap() || caps.getGLProfile().isGL2() ) {
+ final Gears gears = new Gears(swapInterval);
+ gears.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
+ demo = gears;
+ } else {
+ final GearsES2 gears = new GearsES2(swapInterval);
+ gears.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
+ demo = gears;
+ }
+ } else if( 0 == demoType ) {
+ demo = new GLClearOnInitReshape();
+ } else {
+ demo = null;
+ }
+ return demo;
+ }
+
+ protected GLJPanel newGLJPanel(final JFrame frame, final GLCapabilities caps, final FPSAnimator animator, final SnapshotGLEventListener snap)
throws AWTException, InterruptedException, InvocationTargetException
{
- System.err.println("Requesting: "+caps);
-
- final JFrame frame = new JFrame("Swing GLJPanel");
- Assert.assertNotNull(frame);
-
final GLJPanel glJPanel = new GLJPanel(caps);
Assert.assertNotNull(glJPanel);
glJPanel.setSkipGLOrientationVerticalFlip(skipGLOrientationVerticalFlip);
@@ -136,18 +164,15 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
glJPanel.setPreferredSize(wsize);
glJPanel.setSize(wsize);
glJPanel.setSurfaceScale(reqSurfacePixelScale);
- final float[] valReqSurfacePixelScale = glJPanel.getRequestedSurfaceScale(new float[2]);
- if( caps.isBitmap() || caps.getGLProfile().isGL2() ) {
- final Gears gears = new Gears(swapInterval);
- gears.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
- glJPanel.addGLEventListener(gears);
- } else {
- final GearsES2 gears = new GearsES2(swapInterval);
- gears.setFlipVerticalInGLOrientation(skipGLOrientationVerticalFlip);
- glJPanel.addGLEventListener(gears);
+ {
+ final GLEventListener demo = createDemo(caps);
+ if( null != demo ) {
+ glJPanel.addGLEventListener(demo);
+ }
+ }
+ if( null != snap ) {
+ glJPanel.addGLEventListener(snap);
}
- final SnapshotGLEventListener snap = new SnapshotGLEventListener();
- glJPanel.addGLEventListener(snap);
glJPanel.addGLEventListener(new GLEventListener() {
@Override
public void init(final GLAutoDrawable drawable) { }
@@ -159,42 +184,128 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {
setTitle(frame, glJPanel, caps);
}
+
});
setTitle(frame, glJPanel, caps);
- frame.setLocation(xpos, ypos);
- final FPSAnimator animator = useAnimator ? new FPSAnimator(glJPanel, 60) : null;
+ frame.addComponentListener(new ComponentListener() {
+ @Override
+ public void componentResized(final ComponentEvent e) {
+ setTitle(frame, glJPanel, caps);
+ }
+
+ @Override
+ public void componentMoved(final ComponentEvent e) {
+ setTitle(frame, glJPanel, caps);
+ }
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame.getContentPane().add(glJPanel, BorderLayout.CENTER);
- frame.getContentPane().validate();
- frame.pack();
- frame.setVisible(true);
- } } ) ;
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel, true));
+ @Override
+ public void componentShown(final ComponentEvent e) { }
- final Screen screen = NewtFactoryAWT.createScreen(glJPanel, true);
- screen.addReference(); // initial native creation - keep alive!
- System.err.println("GetPixelScale: AWT -> Screen: "+screen);
+ @Override
+ public void componentHidden(final ComponentEvent e) { }
+ });
- final float[] hasSurfacePixelScale1 = glJPanel.getCurrentSurfaceScale(new float[2]);
- System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+
- valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+
- hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
- setTitle(frame, glJPanel, caps);
+ if( SwingUtilities.isEventDispatchThread() ) {
+ frame.getContentPane().add(glJPanel, BorderLayout.CENTER);
+ frame.getContentPane().validate();
+ frame.pack();
+ frame.setVisible(true);
+ } else {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ frame.getContentPane().add(glJPanel, BorderLayout.CENTER);
+ frame.getContentPane().validate();
+ frame.pack();
+ frame.setVisible(true);
+ } } ) ;
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel, true, null));
+
+ final float[] minSurfacePixelScale = glJPanel.getMinimumSurfaceScale(new float[2]);
+ final float[] maxSurfacePixelScale = glJPanel.getMaximumSurfaceScale(new float[2]);
+ final float[] valReqSurfacePixelScale = glJPanel.getRequestedSurfaceScale(new float[2]);
+ final float[] hasSurfacePixelScale = glJPanel.getCurrentSurfaceScale(new float[2]);
+ System.err.println("HiDPI PixelScale: min "+
+ minSurfacePixelScale[0]+"x"+minSurfacePixelScale[1]+", max "+
+ maxSurfacePixelScale[0]+"x"+maxSurfacePixelScale[1]+", req "+
+ reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" -> val "+
+ valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" -> has "+
+ hasSurfacePixelScale[0]+"x"+hasSurfacePixelScale[1]);
+ setTitle(frame, glJPanel, caps);
+ }
- if( useAnimator ) {
+ if( null != animator ) {
+ animator.add(glJPanel);
animator.setUpdateFPSFrames(60, System.err);
+ }
+ return glJPanel;
+ }
+
+ protected void destroy(final JFrame frame, final GLJPanel glJPanel) {
+ try {
+ if( SwingUtilities.isEventDispatchThread() ) {
+ if( null != frame ) {
+ frame.setVisible(false);
+ if( null != glJPanel ) {
+ frame.getContentPane().remove(glJPanel);
+ }
+ frame.remove(glJPanel);
+ }
+ if( null != glJPanel ) {
+ glJPanel.destroy();
+ }
+ if( null != frame ) {
+ frame.dispose();
+ }
+ } else {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ if( null != frame ) {
+ frame.setVisible(false);
+ if( null != glJPanel ) {
+ frame.getContentPane().remove(glJPanel);
+ }
+ frame.remove(glJPanel);
+ }
+ if( null != glJPanel ) {
+ glJPanel.destroy();
+ }
+ if( null != frame ) {
+ frame.dispose();
+ }
+ } } );
+ }
+ } catch (final Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected void runTestGL(final GLCapabilities caps)
+ throws AWTException, InterruptedException, InvocationTargetException
+ {
+ final JFrame frame = new JFrame("Swing GLJPanel");
+ frame.setLocation(xpos, ypos);
+ Assert.assertNotNull(frame);
+
+ final FPSAnimator animator = useAnimator ? new FPSAnimator(60) : null;
+ final SnapshotGLEventListener snap = new SnapshotGLEventListener();
+ final GLJPanel glJPanel = newGLJPanel(frame, caps, animator, snap);
+ if( null != animator ) {
animator.start();
Assert.assertEquals(true, animator.isAnimating());
}
+ final Screen screen = NewtFactoryAWT.createScreen(glJPanel, true);
+ screen.addReference(); // initial native creation - keep alive!
+ System.err.println("GetPixelScale: AWT -> Screen: "+screen);
final QuitAdapter quitAdapter = new QuitAdapter();
new AWTKeyAdapter(new TraceKeyAdapter(quitAdapter), glJPanel).addTo(glJPanel);
new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter), glJPanel).addTo(frame);
+ final JFrame[] frame2 = { null };
+ final GLJPanel[] glJPanel2 = { null };
+
final com.jogamp.newt.event.KeyListener kl = new com.jogamp.newt.event.KeyAdapter() {
@Override
public void keyPressed(final KeyEvent e) {
@@ -262,6 +373,33 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
glJPanel.setRequestedGLCapabilities(capsNew);
System.err.println("XXX-A2: "+animator.toString());
System.err.println("XXX: "+glJPanel.toString());
+ } else if(e.getKeyChar()=='n') {
+ System.err.println("XXX: frame2: "+frame2[0]);
+ if( null != frame2[0] ) {
+ System.err.println("XXX: frame2.isShowing: "+frame2[0].isShowing());
+ }
+ System.err.println("XXX: glJPanel2: "+glJPanel2[0]);
+ if( null != frame2[0] && frame2[0].isShowing() ) {
+ destroy(frame2[0], glJPanel2[0]);
+ frame2[0] = null;
+ glJPanel2[0] = null;
+ } else {
+ frame2[0] = new JFrame("GLJPanel2");
+ frame2[0].setLocation(frame.getX()+frame.getWidth()+64, frame.getY());
+ final FPSAnimator animator2 = useAnimator ? new FPSAnimator(60) : null;
+ if( null != animator2 ) {
+ animator2.start();
+ }
+ final SnapshotGLEventListener snap2 = new SnapshotGLEventListener();
+ try {
+ glJPanel2[0] = newGLJPanel(frame2[0], caps, animator2, snap2);
+ } catch (final Exception e2) {
+ e2.printStackTrace();
+ destroy(frame2[0], glJPanel2[0]);
+ frame2[0] = null;
+ glJPanel2[0] = null;
+ }
+ }
}
} };
new AWTKeyAdapter(kl, glJPanel).addTo(glJPanel);
@@ -300,15 +438,12 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
} else {
Assert.assertNull(animator);
}
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
- frame.setVisible(false);
- frame.getContentPane().remove(glJPanel);
- frame.remove(glJPanel);
- glJPanel.destroy();
- frame.dispose();
- } } );
+
screen.removeReference(); // final native destroy
+ destroy(frame, glJPanel);
+ if( null != frame2[0] ) {
+ destroy(frame2[0], glJPanel2[0]);
+ }
}
@Test
@@ -528,6 +663,9 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
shallUseBitmap = true;
} else if(args[i].equals("-manual")) {
manualTest = true;
+ } else if(args[i].equals("-demo")) {
+ i++;
+ demoType = MiscUtils.atoi(args[i], 0);
}
}
wsize = new Dimension(w, h);
@@ -547,6 +685,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase {
System.err.println("shallUsePBuffer "+shallUsePBuffer);
System.err.println("shallUseBitmap "+shallUseBitmap);
System.err.println("manualTest "+manualTest);
+ System.err.println("demoType "+demoType);
org.junit.runner.JUnitCore.main(TestGearsES2GLJPanelAWT.class.getName());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
index 5ecda9e20..b389c9ac9 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestElektronenMultipliziererNEWT.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.test.junit.jogl.demos.es2.newt;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.TraceWindowAdapter;
@@ -109,12 +110,12 @@ public class TestElektronenMultipliziererNEWT extends UITestCase {
return;
}
if(e.getKeyChar()=='f') {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
f_glWindow.setFullscreen(!f_glWindow.isFullscreen());
} }.start();
} else if(e.getKeyChar()=='d') {
- new Thread() {
+ new InterruptSource.Thread() {
public void run() {
f_glWindow.setUndecorated(!f_glWindow.isUndecorated());
} }.start();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
index d5afdcfda..6733d7e57 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java
@@ -33,34 +33,38 @@ import java.lang.reflect.InvocationTargetException;
import com.jogamp.junit.util.JunitTracer;
import com.jogamp.newt.Display;
-import com.jogamp.newt.Display.PointerIcon;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.Screen;
import com.jogamp.newt.Window;
import com.jogamp.newt.event.WindowEvent;
+import com.jogamp.newt.event.KeyAdapter;
+import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.event.TraceMouseAdapter;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
import com.jogamp.newt.util.EDTUtil;
-import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
-import com.jogamp.opengl.test.junit.util.NEWTDemoListener;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.AnimatorBase;
+import com.jogamp.opengl.test.junit.jogl.demos.GLClearOnInitReshape;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
-
+import com.jogamp.opengl.test.junit.jogl.demos.es2.LineSquareXDemoES2;
import com.jogamp.nativewindow.NativeWindowFactory;
import com.jogamp.nativewindow.ScalableSurface;
import com.jogamp.nativewindow.util.Dimension;
import com.jogamp.nativewindow.util.Point;
import com.jogamp.nativewindow.util.PointImmutable;
import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.opengl.GL;
import com.jogamp.opengl.GLAnimatorControl;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLCapabilitiesImmutable;
import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLPipelineFactory;
import com.jogamp.opengl.GLProfile;
import jogamp.newt.DefaultEDTUtil;
@@ -72,6 +76,14 @@ import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
+/**
+ * <p>
+ * The demo code uses {@link NEWTDemoListener} functionality.
+ * </p>
+ * <p>
+ * Manual invocation via main allows setting each tests's duration in milliseconds, e.g.{@code -duration 10000} and many more, see {@link #main(String[])}
+ * </p>
+ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsES2NEWT extends UITestCase {
static int screenIdx = 0;
@@ -102,6 +114,10 @@ public class TestGearsES2NEWT extends UITestCase {
static boolean forceES3 = false;
static boolean forceGL3 = false;
static boolean forceGL2 = false;
+ static boolean forceDebug = false;
+ static boolean forceTrace = false;
+ static int demoType = 1;
+ static boolean traceMouse = false;
static boolean manualTest = false;
static boolean exclusiveContext = false;
static boolean useAnimator = true;
@@ -142,10 +158,50 @@ public class TestGearsES2NEWT extends UITestCase {
glWindow.setPointerVisible(mouseVisible);
glWindow.confinePointer(mouseConfined);
- final GearsES2 demo = new GearsES2(swapInterval);
- demo.setUseMappedBuffers(useMappedBuffers);
- demo.setValidateBuffers(true);
- glWindow.addGLEventListener(demo);
+ final GLEventListener demo;
+ if( 2 == demoType ) {
+ final LineSquareXDemoES2 demo2 = new LineSquareXDemoES2(false);
+ demo = demo2;
+ } else if( 1 == demoType ) {
+ final GearsES2 gearsES2 = new GearsES2(swapInterval);
+ gearsES2.setUseMappedBuffers(useMappedBuffers);
+ gearsES2.setValidateBuffers(true);
+ demo = gearsES2;
+ } else if( 0 == demoType ) {
+ demo = new GLClearOnInitReshape();
+ } else {
+ demo = null;
+ }
+ if( forceDebug || forceTrace ) {
+ glWindow.addGLEventListener(new GLEventListener() {
+ @Override
+ public void init(final GLAutoDrawable drawable) {
+ GL _gl = drawable.getGL();
+ if(forceDebug) {
+ try {
+ _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, _gl, null) );
+ } catch (final Exception e) {e.printStackTrace();}
+ }
+
+ if(forceTrace) {
+ try {
+ // Trace ..
+ _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, _gl, new Object[] { System.err } ) );
+ } catch (final Exception e) {e.printStackTrace();}
+ }
+ }
+ @Override
+ public void dispose(final GLAutoDrawable drawable) {}
+ @Override
+ public void display(final GLAutoDrawable drawable) {}
+ @Override
+ public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {}
+ });
+ }
+
+ if( null != demo ) {
+ glWindow.addGLEventListener(demo);
+ }
final SnapshotGLEventListener snap = new SnapshotGLEventListener();
glWindow.addGLEventListener(snap);
@@ -172,32 +228,51 @@ public class TestGearsES2NEWT extends UITestCase {
animator.setExclusiveContext(exclusiveContext);
}
- final QuitAdapter quitAdapter = new QuitAdapter();
- //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
- //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
- glWindow.addKeyListener(quitAdapter);
- glWindow.addWindowListener(quitAdapter);
-
glWindow.addWindowListener(new WindowAdapter() {
public void windowResized(final WindowEvent e) {
- System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
+ System.err.println("window resized: "+glWindow.getBounds()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
NEWTDemoListener.setTitle(glWindow);
}
public void windowMoved(final WindowEvent e) {
- System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
+ System.err.println("window moved: "+glWindow.getBounds()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
NEWTDemoListener.setTitle(glWindow);
}
});
- final PointerIcon[] pointerIcons = NEWTDemoListener.createPointerIcons(glWindow);
- if( setPointerIcon ) {
- glWindow.setPointerIcon(pointerIcons[0]);
- System.err.println("Set PointerIcon: "+glWindow.getPointerIcon());
- }
+ final GLWindow[] glWindow2 = { null };
- final NEWTDemoListener newtDemoListener = new NEWTDemoListener(glWindow, pointerIcons);
+ final NEWTDemoListener newtDemoListener = new NEWTDemoListener(glWindow);
+ newtDemoListener.quitAdapterEnable(true);
glWindow.addKeyListener(newtDemoListener);
+ if( traceMouse ) {
+ glWindow.addMouseListener(new TraceMouseAdapter());
+ }
glWindow.addMouseListener(newtDemoListener);
+ glWindow.addWindowListener(newtDemoListener);
+ glWindow.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(final KeyEvent e) {
+ if( e.isAutoRepeat() ) {
+ return;
+ }
+ if(e.getKeyChar()=='n') {
+ if( null != glWindow2[0] && glWindow2[0].isNativeValid() ) {
+ glWindow2[0].destroy();
+ glWindow2[0] = null;
+ } else {
+ glWindow2[0] = GLWindow.create(screen, caps);
+ glWindow2[0].setTitle("GLWindow2");
+ glWindow2[0].setPosition(glWindow.getX()+glWindow.getWidth()+64, glWindow.getY());
+ glWindow2[0].setSize(glWindow.getWidth(), glWindow.getHeight());
+ glWindow2[0].addGLEventListener(new LineSquareXDemoES2(false));
+ final Animator animator2 = useAnimator ? new Animator(glWindow2[0]) : null;
+ if( null != animator2 ) {
+ animator2.start();
+ }
+ glWindow2[0].setVisible(true);
+ }
+ }
+ } } );
if( useAnimator ) {
animator.add(glWindow);
@@ -231,7 +306,7 @@ public class TestGearsES2NEWT extends UITestCase {
final EDTUtil edt = ((Window)upstream).getScreen().getDisplay().getEDTUtil();
System.err.println("EDT invokeAndWaitError: edt type "+edt.getClass().getName());
if( edt instanceof DefaultEDTUtil ) {
- quitAdapter.doQuit();
+ newtDemoListener.doQuit();
((DefaultEDTUtil)edt).invokeAndWaitError(new Runnable() {
public void run() {
throw new RuntimeException("XXX Should never ever be seen! - "+Thread.currentThread());
@@ -255,6 +330,8 @@ public class TestGearsES2NEWT extends UITestCase {
animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
}
+ System.err.println("Window Current State : "+glWindow.getStateMaskString());
+ System.err.println("Window Supported States: "+glWindow.getSupportedStateMaskString());
System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets());
@@ -277,7 +354,7 @@ public class TestGearsES2NEWT extends UITestCase {
final long t0 = System.currentTimeMillis();
long t1 = t0;
- while(!quitAdapter.shouldQuit() && t1-t0<duration) {
+ while(!newtDemoListener.shouldQuit() && t1-t0<duration) {
Thread.sleep(100);
t1 = System.currentTimeMillis();
if( SysExit.testError == sysExit || SysExit.testExit == sysExit || SysExit.testEDTError == sysExit) {
@@ -292,7 +369,7 @@ public class TestGearsES2NEWT extends UITestCase {
final EDTUtil edt = glWindow.getScreen().getDisplay().getEDTUtil();
System.err.println("EDT invokeAndWaitError: edt type "+edt.getClass().getName());
if( edt instanceof DefaultEDTUtil ) {
- quitAdapter.doQuit();
+ newtDemoListener.doQuit();
((DefaultEDTUtil)edt).invokeAndWaitError(new Runnable() {
public void run() {
throw new RuntimeException("XXX Should never ever be seen!");
@@ -312,8 +389,12 @@ public class TestGearsES2NEWT extends UITestCase {
}
Assert.assertEquals(null, glWindow.getExclusiveContextThread());
glWindow.destroy();
+ if( null != glWindow2[0] && glWindow2[0].isNativeValid() ) {
+ glWindow2[0].destroy();
+ glWindow2[0] = null;
+ }
if( NativeWindowFactory.isAWTAvailable() ) {
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null));
}
}
@@ -426,6 +507,10 @@ public class TestGearsES2NEWT extends UITestCase {
forceGL3 = true;
} else if(args[i].equals("-gl2")) {
forceGL2 = true;
+ } else if(args[i].equals("-debug")) {
+ forceDebug = true;
+ } else if(args[i].equals("-trace")) {
+ forceTrace = true;
} else if(args[i].equals("-mappedBuffers")) {
useMappedBuffers = true;
} else if(args[i].equals("-wait")) {
@@ -476,6 +561,11 @@ public class TestGearsES2NEWT extends UITestCase {
sysExit = SysExit.valueOf(args[i]);
} else if(args[i].equals("-manual")) {
manualTest = true;
+ } else if(args[i].equals("-demo")) {
+ i++;
+ demoType = MiscUtils.atoi(args[i], 0);
+ } else if(args[i].equals("-traceMouse")) {
+ traceMouse = true;
}
}
wsize = new Dimension(w, h);
@@ -509,11 +599,15 @@ public class TestGearsES2NEWT extends UITestCase {
System.err.println("forceES3 "+forceES3);
System.err.println("forceGL3 "+forceGL3);
System.err.println("forceGL2 "+forceGL2);
+ System.err.println("forceDebug "+forceDebug);
+ System.err.println("forceTrace "+forceTrace);
System.err.println("swapInterval "+swapInterval);
System.err.println("exclusiveContext "+exclusiveContext);
System.err.println("useAnimator "+useAnimator);
System.err.println("sysExitWithin "+sysExit);
System.err.println("mappedBuffers "+useMappedBuffers);
+ System.err.println("demoType "+demoType);
+ System.err.println("traceMouse "+traceMouse);
if(waitForKey) {
JunitTracer.waitForKey("Start");
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java
index 39d13f6a3..fb3d82f9a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java
@@ -47,14 +47,16 @@ import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.AnimatorBase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter;
+import com.jogamp.opengl.test.junit.newt.parenting.NewtReparentingKeyAdapter;
import com.jogamp.nativewindow.ScalableSurface;
import com.jogamp.nativewindow.util.Dimension;
@@ -74,6 +76,14 @@ import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
+/**
+ * <p>
+ * The demo code uses {@link NewtReparentingKeyAdapter} including {@link NEWTDemoListener} functionality.
+ * </p>
+ * <p>
+ * Manual invocation via main allows setting each tests's duration in milliseconds, e.g.{@code -duration 10000}, and many more, see {@link #main(String[])}
+ * </p>
+ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsES2NewtCanvasAWT extends UITestCase {
public enum FrameLayout { None, TextOnBottom, BorderBottom, BorderBottom2, BorderCenter, BorderCenterSurrounded, DoubleBorderCenterSurrounded };
@@ -82,7 +92,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
static int screenIdx = 0;
static PointImmutable wpos;
static DimensionImmutable wsize, rwsize = null;
- static FrameLayout frameLayout = FrameLayout.None;
+ static FrameLayout frameLayout = FrameLayout.BorderCenterSurrounded;
static ResizeBy resizeBy = ResizeBy.Component;
static float[] reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
@@ -248,17 +258,21 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
final GearsES2 demo = new GearsES2(swapInterval);
glWindow.addGLEventListener(demo);
+ final NewtAWTReparentingKeyAdapter newtDemoListener = new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow);
+ newtDemoListener.quitAdapterEnable(true);
+ glWindow.addKeyListener(newtDemoListener);
+ glWindow.addMouseListener(newtDemoListener);
+ glWindow.addWindowListener(newtDemoListener);
+
frame.addComponentListener(new ComponentListener() {
@Override
public void componentResized(final ComponentEvent e) {
- NewtAWTReparentingKeyAdapter.setTitle(frame, newtCanvasAWT, glWindow);
+ newtDemoListener.setTitle();
}
-
@Override
public void componentMoved(final ComponentEvent e) {
- NewtAWTReparentingKeyAdapter.setTitle(frame, newtCanvasAWT, glWindow);
+ newtDemoListener.setTitle();
}
-
@Override
public void componentShown(final ComponentEvent e) { }
@@ -272,12 +286,6 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
animator.setExclusiveContext(exclusiveContext);
}
- final QuitAdapter quitAdapter = new QuitAdapter();
- //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
- //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
- glWindow.addKeyListener(quitAdapter);
- glWindow.addWindowListener(quitAdapter);
-
glWindow.addWindowListener(new WindowAdapter() {
public void windowResized(final WindowEvent e) {
System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
@@ -287,10 +295,6 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
}
});
- final NewtAWTReparentingKeyAdapter newtDemoListener = new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow, quitAdapter);
- glWindow.addKeyListener(newtDemoListener);
- glWindow.addMouseListener(newtDemoListener);
-
if( useAnimator ) {
animator.add(glWindow);
animator.start();
@@ -309,8 +313,8 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
frame.setVisible(true);
}
});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, true, null));
if( useAnimator ) {
animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
@@ -324,7 +328,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+
valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+
hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
- NewtAWTReparentingKeyAdapter.setTitle(frame, newtCanvasAWT, glWindow);
+ newtDemoListener.setTitle();
if( null != rwsize ) {
Thread.sleep(500); // 500ms delay
@@ -334,7 +338,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
final long t0 = System.currentTimeMillis();
long t1 = t0;
- while(!quitAdapter.shouldQuit() && t1-t0<duration) {
+ while(!newtDemoListener.shouldQuit() && t1-t0<duration) {
Thread.sleep(100);
t1 = System.currentTimeMillis();
}
@@ -352,7 +356,7 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase {
}
});
glWindow.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null));
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java
index 8dcffc662..00091e486 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java
@@ -39,8 +39,9 @@ import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.swt.NewtCanvasSWT;
-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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
@@ -184,14 +185,12 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
return;
}
if(e.getKeyChar()=='f') {
- new Thread() {
+ glWindow.invokeOnNewThread(null, false, new Runnable() {
public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
glWindow.setFullscreen(!glWindow.isFullscreen());
System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
- glWindow.setExclusiveContextThread(t);
- } }.start();
+ } } );
}
}
});
@@ -218,16 +217,24 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
+ final Runnable waitAction = new Runnable() {
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ try {
+ Thread.sleep(10);
+ } catch (final InterruptedException e) { }
+ }
+ } };
+ Assert.assertEquals(true, NewtTestUtil.waitForVisible(glWindow, true, waitAction));
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(glWindow, true, waitAction));
+
System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
System.err.println("GL chosen: "+glWindow.getChosenCapabilities());
System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets());
if( null != rwsize ) {
for(int i=0; i<50; i++) { // 500 ms dispatched delay
- if( !display.readAndDispatch() ) {
- // blocks on linux .. display.sleep();
- Thread.sleep(10);
- }
+ waitAction.run();
}
display.syncExec( new Runnable() {
public void run() {
@@ -238,10 +245,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
}
while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
- if( !display.readAndDispatch() ) {
- // blocks on linux .. display.sleep();
- Thread.sleep(10);
- }
+ waitAction.run();
}
Assert.assertEquals(exclusiveContext ? animator.getThread() : null, glWindow.getExclusiveContextThread());
@@ -252,7 +256,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase {
canvas1.dispose();
glWindow.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null));
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java
index d109c56cf..6aebeb91b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2SimpleNEWT.java
@@ -40,14 +40,14 @@ import com.jogamp.newt.Window;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.MiscUtils;
-import com.jogamp.opengl.test.junit.util.NEWTDemoListener;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.PNGPixelRect;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
-
+import com.jogamp.opengl.test.junit.newt.parenting.NewtReparentingKeyAdapter;
import com.jogamp.nativewindow.ScalableSurface;
import com.jogamp.nativewindow.util.Dimension;
import com.jogamp.nativewindow.util.DimensionImmutable;
@@ -61,6 +61,14 @@ import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
+/**
+ * <p>
+ * The demo code uses {@link NEWTDemoListener} functionality.
+ * </p>
+ * <p>
+ * Manual invocation via main allows setting each tests's duration in milliseconds, e.g.{@code -duration 10000} and using a translucent window {@code -translucent}.
+ * </p>
+ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsES2SimpleNEWT extends UITestCase {
static final DimensionImmutable wsize = new Dimension(800, 600);
@@ -118,7 +126,7 @@ public class TestGearsES2SimpleNEWT extends UITestCase {
int idx = 0;
{
PointerIcon _pointerIcon = null;
- final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "newt/data/cross-grey-alpha-16x16.png" } );
+ final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "newt/data/cross-grey-alpha-16x16.png" }, glWindow.getClass().getClassLoader(), null);
try {
_pointerIcon = disp.createPointerIcon(res, 8, 8);
System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
@@ -130,7 +138,7 @@ public class TestGearsES2SimpleNEWT extends UITestCase {
idx++;
{
PointerIcon _pointerIcon = null;
- final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "newt/data/pointer-grey-alpha-16x24.png" } );
+ final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "newt/data/pointer-grey-alpha-16x24.png" }, glWindow.getClass().getClassLoader(), null);
try {
_pointerIcon = disp.createPointerIcon(res, 0, 0);
System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
@@ -142,7 +150,7 @@ public class TestGearsES2SimpleNEWT extends UITestCase {
idx++;
{
PointerIcon _pointerIcon = null;
- final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "arrow-red-alpha-64x64.png" } );
+ final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "arrow-red-alpha-64x64.png" }, glWindow.getClass().getClassLoader(), null);
try {
_pointerIcon = disp.createPointerIcon(res, 0, 0);
System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
@@ -154,7 +162,7 @@ public class TestGearsES2SimpleNEWT extends UITestCase {
idx++;
{
PointerIcon _pointerIcon = null;
- final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "arrow-blue-alpha-64x64.png" } );
+ final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "arrow-blue-alpha-64x64.png" }, glWindow.getClass().getClassLoader(), null);
try {
_pointerIcon = disp.createPointerIcon(res, 0, 0);
System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
@@ -166,7 +174,7 @@ public class TestGearsES2SimpleNEWT extends UITestCase {
idx++;
if( PNGIcon.isAvailable() ) {
PointerIcon _pointerIcon = null;
- final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "jogamp-pointer-64x64.png" } );
+ final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "jogamp-pointer-64x64.png" }, glWindow.getClass().getClassLoader(), null);
try {
final URLConnection urlConn = res.resolve(0);
final PNGPixelRect image = PNGPixelRect.read(urlConn.getInputStream(), null, false /* directBuffer */, 0 /* destMinStrideInBytes */, false /* destIsGLOriented */);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java
index 79c8cb39a..2c5b6028c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java
@@ -87,15 +87,15 @@ public class TestLandscapeES2NEWT extends UITestCase {
return;
}
if(e.getKeyChar()=='f') {
- new Thread() {
+ glWindow.invokeOnNewThread(null, false, new Runnable() {
public void run() {
glWindow.setFullscreen(!glWindow.isFullscreen());
- } }.start();
+ } } );
} else if(e.getKeyChar()=='d') {
- new Thread() {
+ glWindow.invokeOnNewThread(null, false, new Runnable() {
public void run() {
glWindow.setUndecorated(!glWindow.isUndecorated());
- } }.start();
+ } } );
}
}
});
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java
index 12ea6dbb3..c5bbecbc7 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java
@@ -39,13 +39,14 @@ import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.WindowEvent;
import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
import com.jogamp.opengl.test.junit.util.MiscUtils;
import com.jogamp.opengl.test.junit.util.UITestCase;
-import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.AnimatorBase;
import com.jogamp.opengl.test.junit.jogl.demos.es2.LandscapeES2;
import com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter;
+import com.jogamp.opengl.test.junit.newt.parenting.NewtReparentingKeyAdapter;
import com.jogamp.nativewindow.util.Dimension;
import com.jogamp.nativewindow.util.DimensionImmutable;
@@ -58,6 +59,14 @@ import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
+/**
+ * <p>
+ * The demo code uses {@link NewtReparentingKeyAdapter} including {@link NEWTDemoListener} functionality.
+ * </p>
+ * <p>
+ * Manual invocation via main allows setting each tests's duration in milliseconds, e.g.{@code -duration 10000}, and many more, see {@link #main(String[])}
+ * </p>
+ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestLandscapeES2NewtCanvasAWT extends UITestCase {
static DimensionImmutable wsize = new Dimension(500, 290);
@@ -104,12 +113,6 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase {
animator.setExclusiveContext(exclusiveContext);
}
- final QuitAdapter quitAdapter = new QuitAdapter();
- //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
- //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
- glWindow.addKeyListener(quitAdapter);
- glWindow.addWindowListener(quitAdapter);
-
glWindow.addWindowListener(new WindowAdapter() {
public void windowResized(final WindowEvent e) {
System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight());
@@ -119,7 +122,11 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase {
}
});
- glWindow.addKeyListener(new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow, quitAdapter));
+ final NewtReparentingKeyAdapter newtDemoListener = new NewtAWTReparentingKeyAdapter(frame, newtCanvasAWT, glWindow);
+ newtDemoListener.quitAdapterEnable(true);
+ glWindow.addKeyListener(newtDemoListener);
+ glWindow.addMouseListener(newtDemoListener);
+ glWindow.addWindowListener(newtDemoListener);
if( useAnimator ) {
animator.add(glWindow);
@@ -143,7 +150,7 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase {
final long t0 = System.currentTimeMillis();
long t1 = t0;
- while(!quitAdapter.shouldQuit() && t1-t0<duration) {
+ while(!newtDemoListener.shouldQuit() && t1-t0<duration) {
Thread.sleep(100);
t1 = System.currentTimeMillis();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
index e8e3741aa..786549fdc 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java
@@ -31,8 +31,8 @@ package com.jogamp.opengl.test.junit.jogl.demos.es2.newt;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
@@ -110,15 +110,15 @@ public class TestRedSquareES2NEWT extends UITestCase {
return;
}
if(e.getKeyChar()=='f') {
- new Thread() {
+ glWindow.invokeOnNewThread(null, false, new Runnable() {
public void run() {
glWindow.setFullscreen(!glWindow.isFullscreen());
- } }.start();
+ } } );
} else if(e.getKeyChar()=='d') {
- new Thread() {
+ glWindow.invokeOnNewThread(null, false, new Runnable() {
public void run() {
glWindow.setUndecorated(!glWindow.isUndecorated());
- } }.start();
+ } } );
}
}
});
@@ -143,7 +143,7 @@ public class TestRedSquareES2NEWT extends UITestCase {
Assert.assertFalse(animator.isStarted());
glWindow.destroy();
if( NativeWindowFactory.isAWTAvailable() ) {
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null));
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java
index c05444b02..f76081754 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java
@@ -33,7 +33,9 @@ import java.lang.reflect.InvocationTargetException;
import com.jogamp.nativewindow.swt.SWTAccessor;
import com.jogamp.opengl.swt.GLCanvas;
+import com.jogamp.opengl.test.junit.util.GLTestUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.AnimatorBase;
@@ -171,11 +173,18 @@ public class TestGearsES2SWT extends UITestCase {
animator.setUpdateFPSFrames(60, showFPS ? System.err : null);
+ final Runnable waitAction = new Runnable() {
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ try {
+ Thread.sleep(10);
+ } catch (final InterruptedException e) { }
+ }
+ } };
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(canvas, true, waitAction));
+
while(animator.isAnimating() && !canvas.isRealized() && animator.getTotalFPSDuration()<duration) {
- if( !display.readAndDispatch() ) {
- // blocks on linux .. display.sleep();
- Thread.sleep(10);
- }
+ waitAction.run();
}
System.err.println("NW chosen: "+canvas.getDelegatedDrawable().getChosenGLCapabilities());
System.err.println("GL chosen: "+canvas.getChosenGLCapabilities());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
index c2761f694..a144ff1ff 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
@@ -230,9 +230,7 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
public void reshape(final GLAutoDrawable glad, final int x, final int y, final int width, final int height) {
if( !isInit ) { return; }
final GL2 gl = glad.getGL().getGL2();
- if(-1 != swapInterval) {
- gl.setSwapInterval(swapInterval);
- }
+ gl.setSwapInterval(swapInterval);
reshape(gl, x, y, width, height, width, height);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java
index 22d24b67b..159fad9da 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Teapot.java
@@ -72,7 +72,7 @@ public class Teapot implements GLEventListener {
gl.glClearColor(0.5f, 0.5f, 0.5f, 0.0f);
try {
- final URLConnection urlConn = IOUtil.getResource(PNGTstFiles.class, "test-ntscP_3-01-160x90.png");
+ final URLConnection urlConn = IOUtil.getResource("test-ntscP_3-01-160x90.png", PNGTstFiles.class.getClassLoader(), PNGTstFiles.class);
tex = TextureIO.newTexture(gl, TextureIO.newTextureData(gl.getGLProfile(), urlConn.getInputStream(), false, TextureIO.PNG));
} catch (final Exception e) {
e.printStackTrace();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java
index 0f3011c3d..0ab9308c2 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNEWT.java
@@ -28,16 +28,15 @@
package com.jogamp.opengl.test.junit.jogl.demos.gl2.newt;
-import com.jogamp.newt.event.KeyAdapter;
-import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.test.junit.jogl.demos.gl2.Gears;
-
+import com.jogamp.opengl.test.junit.newt.parenting.NewtReparentingKeyAdapter;
import com.jogamp.opengl.GLCapabilities;
import com.jogamp.opengl.GLProfile;
@@ -48,6 +47,14 @@ import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
+/**
+ * <p>
+ * The demo code uses {@link NEWTDemoListener} functionality.
+ * </p>
+ * <p>
+ * Manual invocation via main allows setting each tests's duration in milliseconds, e.g.{@code -duration 10000}.
+ * </p>
+ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestGearsNEWT extends UITestCase {
static GLProfile glp;
@@ -84,25 +91,9 @@ public class TestGearsNEWT extends UITestCase {
glWindow.addKeyListener(quitAdapter);
glWindow.addWindowListener(quitAdapter);
- final GLWindow f_glWindow = glWindow;
- glWindow.addKeyListener(new KeyAdapter() {
- public void keyReleased(final KeyEvent e) {
- if( !e.isPrintableKey() || e.isAutoRepeat() ) {
- return;
- }
- if(e.getKeyChar()=='f') {
- new Thread() {
- public void run() {
- f_glWindow.setFullscreen(!f_glWindow.isFullscreen());
- } }.start();
- } else if(e.getKeyChar()=='d') {
- new Thread() {
- public void run() {
- f_glWindow.setUndecorated(!f_glWindow.isUndecorated());
- } }.start();
- }
- }
- });
+ final NEWTDemoListener newtDemoListener = new NEWTDemoListener(glWindow);
+ glWindow.addKeyListener(newtDemoListener);
+ glWindow.addMouseListener(newtDemoListener);
glWindow.setSize(width, height);
glWindow.setVisible(true);
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..6b789a152 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], null));
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], null));
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], null));
Thread.sleep(600);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java
index a4a665e5b..668d8877c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl3/GeomShader01TextureGL3.java
@@ -193,7 +193,7 @@ public class GeomShader01TextureGL3 implements GLEventListener {
}
private Texture createTestTexture(final GL3 gl) throws IOException {
- final URLConnection urlConn = IOUtil.getResource(this.getClass(), "../../util/texture/test-ntscN_3-01-160x90.png");
+ final URLConnection urlConn = IOUtil.getResource("../../util/texture/test-ntscN_3-01-160x90.png", this.getClass().getClassLoader(), this.getClass());
if(null == urlConn) { return null; }
final InputStream istream = urlConn.getInputStream();
if(null == istream) { return null; }
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/javafx/PureJFXApp01.java b/src/test/com/jogamp/opengl/test/junit/jogl/javafx/PureJFXApp01.java
new file mode 100644
index 000000000..d2a3b8073
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/javafx/PureJFXApp01.java
@@ -0,0 +1,54 @@
+/**
+ * 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.jogl.javafx;
+
+import javafx.application.Application;
+import javafx.scene.Group;
+import javafx.scene.Scene;
+import javafx.scene.text.Font;
+import javafx.scene.text.Text;
+import javafx.stage.Stage;
+
+public class PureJFXApp01 extends Application {
+
+ @Override public void start(Stage stage) {
+ Text text = new Text(10, 40, "Pure JFX App 01");
+ text.setFont(new Font(40));
+ Scene scene = new Scene(new Group(text));
+
+ stage.setTitle("JavaFX Stage");
+ stage.setScene(scene);
+ stage.sizeToScene();
+ stage.show();
+ }
+
+ public static void main(String[] args) {
+ Application.launch(args);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/javafx/TestNewtCanvasJFXGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/javafx/TestNewtCanvasJFXGLn.java
new file mode 100644
index 000000000..179cd49f0
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/javafx/TestNewtCanvasJFXGLn.java
@@ -0,0 +1,517 @@
+/**
+ * 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.jogl.javafx;
+
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLProfile;
+
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.util.RunnableTask;
+import com.jogamp.nativewindow.javafx.JFXAccessor;
+import com.jogamp.newt.NewtFactory;
+import com.jogamp.newt.Screen;
+import com.jogamp.newt.event.WindowAdapter;
+import com.jogamp.newt.event.WindowEvent;
+import com.jogamp.newt.javafx.NewtCanvasJFX;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
+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.newt.parenting.NewtJFXReparentingKeyAdapter;
+import com.jogamp.opengl.test.junit.newt.parenting.NewtReparentingKeyAdapter;
+import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.GLReadBufferUtil;
+import com.jogamp.opengl.util.texture.TextureIO;
+
+import javafx.application.Application;
+import javafx.application.Platform;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.scene.Group;
+import javafx.scene.Scene;
+import javafx.scene.canvas.Canvas;
+import javafx.scene.canvas.GraphicsContext;
+import javafx.scene.paint.Color;
+import javafx.scene.text.Font;
+import javafx.scene.text.Text;
+import javafx.stage.Stage;
+
+/**
+ * {@link NewtCanvasJFX} basic functional integration test
+ * of its native parented NEWT child {@link GLWindow} attached to JavaFX's {@link Canvas}.
+ * <p>
+ * {@link NewtCanvasJFX} allows utilizing custom {@link GLCapabilities} settings independent from the JavaFX's window
+ * as well as independent rendering from JavaFX's thread.
+ * </p>
+ * <p>
+ * This unit tests also tests {@link NewtCanvasJFX} native parenting operations before and after
+ * it's belonging Group's Scene has been attached to the JavaFX {@link javafx.stage.Window Window}'s actual native window,
+ * i.e. becoming fully realized and visible.
+ * </p>
+ * <p>
+ * Note that {@link JFXAccessor#runOnJFXThread(boolean, Runnable)} is still used to for certain
+ * mandatory JavaFX lifecycle operation on the JavaFX thread.
+ * </p>
+ * <p>
+ * The demo code uses {@link NewtReparentingKeyAdapter} including {@link NEWTDemoListener} functionality.
+ * </p>
+ * <p>
+ * Manual invocation via main allows running a single test, e.g. {@code -test 21}, and setting each tests's duration in milliseconds, e.g.{@code -time 10000}.
+ * </p>
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestNewtCanvasJFXGLn extends UITestCase {
+
+ static int duration = 5000; // 250;
+ static int manualTestID = -1;
+
+ com.jogamp.newt.Display jfxNewtDisplay = null;
+
+ public static class JFXApp extends Application {
+ static Stage stage;
+
+ final static Object sync = new Object();
+ static volatile boolean isLaunched = false;
+
+ public JFXApp() {
+ }
+
+ @Override public void init() throws Exception {
+ // pre JFX thread
+ System.err.println("JFX init ...: "+Thread.currentThread());
+ }
+
+ @Override public void start(final Stage stage) {
+ System.err.println("JFX start.0 ...: "+Thread.currentThread());
+ synchronized(sync) {
+ try {
+ // on JFX thread
+ final Scene scene = new Scene(new Group(), defWidth, defHeight);
+ stage.setTitle(TestNewtCanvasJFXGLn.class.getSimpleName());
+ stage.setScene(scene);
+ stage.sizeToScene();
+ {
+ final long h = JFXAccessor.getWindowHandle(stage);
+ System.err.println("t1 - Native window: 0x"+Long.toHexString(h));
+ }
+ stage.show();
+ {
+ final long h = JFXAccessor.getWindowHandle(stage);
+ System.err.println("t2 - Native window: 0x"+Long.toHexString(h));
+ }
+ JFXApp.stage = stage;
+ } finally {
+ isLaunched = true;
+ sync.notifyAll();
+ }
+ }
+ System.err.println("JFX start.X ...: "+Thread.currentThread());
+ }
+ @Override public void stop() throws Exception {
+ System.err.println("JFX stop ...: "+Thread.currentThread());
+ }
+ public static void startup() throws InterruptedException {
+ System.out.println( "GLProfile " + GLProfile.glAvailabilityToString() );
+ System.err.println("JFX Available: "+JFXAccessor.isJFXAvailable());
+ if( JFXAccessor.isJFXAvailable() ) {
+ Platform.setImplicitExit(false); // FIXME: Default for all NEWT cases?
+ synchronized(sync) {
+ final Thread ct = Thread.currentThread();
+ RunnableTask.invokeOnNewThread(ct.getThreadGroup(), ct.getName()+"JFXLauncher", false,
+ new Runnable() {
+ public void run() {
+ Application.launch(JFXApp.class);
+ }
+ });
+ while(!isLaunched) {
+ sync.wait();
+ }
+ }
+ System.err.println("JFX launched ...");
+ }
+ }
+ public static void shutdown() {
+ JFXAccessor.runOnJFXThread(true, new Runnable() {
+ public void run() {
+ if( null != stage ) {
+ stage.close();
+ }
+ } });
+ }
+ }
+
+ @BeforeClass
+ public static void startup() throws InterruptedException {
+ JFXApp.startup();
+ }
+
+ @AfterClass
+ public static void shutdown() {
+ JFXApp.shutdown();
+ Platform.exit();
+ }
+
+ @Before
+ public void init() {
+ jfxNewtDisplay = NewtFactory.createDisplay(null, false); // no-reuse
+ }
+
+ @After
+ public void release() {
+ jfxNewtDisplay = null;
+ }
+
+ class WaitAction implements Runnable {
+ private final long sleepMS;
+
+ WaitAction(final long sleepMS) {
+ this.sleepMS = sleepMS;
+ }
+ public void run() {
+ // blocks on linux .. display.sleep();
+ try {
+ Thread.sleep(sleepMS);
+ } catch (final InterruptedException e) { }
+ }
+ }
+ final WaitAction awtRobotWaitAction = new WaitAction(AWTRobotUtil.TIME_SLICE);
+ final WaitAction generalWaitAction = new WaitAction(10);
+
+ static final int defWidth = 800, defHeight = 600;
+
+ static void populateScene(final Scene scene, final boolean postAttach,
+ final GLWindow glWindow,
+ final int width, final int height, final boolean useBorder,
+ final NewtCanvasJFX[] res) {
+ final javafx.stage.Window w = scene.getWindow();
+ final boolean isShowing = null != w && w.isShowing();
+ final Group g = new Group();
+
+ final int cx, cy, cw, ch, bw, bh;
+ if( useBorder ) {
+ bw = width/5; bh = height/5;
+ cx = bw; cy = bh; cw = width-bw-bw; ch = height-bh-bh;
+ } else {
+ bw = 0; bh = 0;
+ cx = 0; cy = 0; cw = width; ch = height;
+ }
+ System.err.println("Scene "+width+"x"+height+", isShowing "+isShowing+", postAttach "+postAttach);
+ System.err.println("Scene.canvas "+cx+"/"+cy+" "+cw+"x"+ch);
+ System.err.println("Scene.border "+bw+"x"+bh);
+
+ if( !postAttach ) {
+ if(isShowing) {
+ JFXAccessor.runOnJFXThread(true, new Runnable() {
+ @Override
+ public void run() {
+ scene.setRoot(g);
+ }});
+ } else {
+ scene.setRoot(g);
+ }
+ }
+
+ final Canvas canvas0;
+ if( null == res ) {
+ canvas0 = new Canvas();
+ } else {
+ res[0] = new NewtCanvasJFX( glWindow );
+ canvas0 = res[0];
+ }
+ canvas0.setWidth(cw);
+ canvas0.setHeight(ch);
+ if( null == res ) {
+ final GraphicsContext gc = canvas0.getGraphicsContext2D();
+ gc.setFill(Color.BLUE);
+ gc.fillRect(0, 0, cw, ch);
+ }
+ canvas0.relocate(cx, cy);
+
+ final Text text0 = new Text(0, 0, "left");
+ {
+ text0.setFont(new Font(40));
+ text0.relocate(0, height/2);
+ }
+ final Text text1 = new Text(0, 0, "above");
+ {
+ text1.setFont(new Font(40));
+ text1.relocate(width/2, bh-40);
+ }
+ final Text text2 = new Text(0, 0, "right");
+ {
+ text2.setFont(new Font(40));
+ text2.relocate(width-bw, height/2);
+ }
+ final Text text3 = new Text(0, 0, "below");
+ {
+ text3.setFont(new Font(40));
+ text3.relocate(width/2, height-bh);
+ }
+ final Runnable attach2Group = new Runnable() {
+ @Override
+ public void run() {
+ g.getChildren().add(text0);
+ g.getChildren().add(text1);
+ g.getChildren().add(canvas0);
+ g.getChildren().add(text2);
+ g.getChildren().add(text3);
+ } };
+ if( !postAttach && isShowing ) {
+ JFXAccessor.runOnJFXThread(true, attach2Group);
+ } else {
+ attach2Group.run();
+ }
+ if( postAttach ) {
+ if(isShowing) {
+ JFXAccessor.runOnJFXThread(true, new Runnable() {
+ @Override
+ public void run() {
+ scene.setRoot(g);
+ }});
+ } else {
+ scene.setRoot(g);
+ }
+ }
+ }
+
+ protected void runTestAGL( final GLCapabilitiesImmutable caps, final GLEventListener demo,
+ final boolean postAttachNewtCanvas, final boolean postAttachGLWindow,
+ final boolean useAnimator ) throws InterruptedException {
+ if( !JFXAccessor.isJFXAvailable() ) {
+ System.err.println("JFX not available");
+ return;
+ }
+ final GLReadBufferUtil screenshot = new GLReadBufferUtil(false, false);
+ final GLWindow glWindow1;
+ if( null == demo ) {
+ glWindow1 = null;
+ } else {
+ final Screen screen = NewtFactory.createScreen(jfxNewtDisplay, 0);
+ glWindow1 = GLWindow.create(screen, caps);
+ Assert.assertNotNull(glWindow1);
+ Assert.assertEquals(false, glWindow1.isVisible());
+ Assert.assertEquals(false, glWindow1.isNativeValid());
+ Assert.assertNull(glWindow1.getParent());
+ glWindow1.addGLEventListener(demo);
+ glWindow1.addGLEventListener(new GLEventListener() {
+ int displayCount = 0;
+ public void init(final GLAutoDrawable drawable) { }
+ public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { }
+ public void display(final GLAutoDrawable drawable) {
+ if(displayCount < 3) {
+ snapshot(displayCount++, null, drawable.getGL(), screenshot, TextureIO.PNG, null);
+ }
+ }
+ public void dispose(final GLAutoDrawable drawable) { }
+ });
+ }
+
+ final NewtCanvasJFX[] glCanvas = null==demo? null : new NewtCanvasJFX[]{null};
+
+ final Scene scene = new Scene(new Group(), defWidth, defHeight);
+ if(!postAttachNewtCanvas) {
+ System.err.println("Stage set.A0");
+ JFXAccessor.runOnJFXThread(true, new Runnable() {
+ public void run() {
+ System.err.println("Stage set.A1");
+ JFXApp.stage.setScene(scene);
+ JFXApp.stage.sizeToScene();
+ System.err.println("Stage set.AX");
+ } });
+ }
+ populateScene( scene, postAttachNewtCanvas, postAttachGLWindow?null:glWindow1, defWidth, defHeight, true, glCanvas);
+ if(postAttachNewtCanvas) {
+ System.err.println("Stage set.B0");
+ JFXAccessor.runOnJFXThread(true, new Runnable() {
+ public void run() {
+ System.err.println("Stage set.B1");
+ JFXApp.stage.setScene(scene);
+ JFXApp.stage.sizeToScene();
+ System.err.println("Stage set.BX");
+ } });
+ }
+
+ if(postAttachGLWindow && null != demo) {
+ glCanvas[0].setNEWTChild(glWindow1);
+ }
+
+ if( null != glWindow1 ) {
+ Assert.assertTrue("GLWindow didn't become visible natively!", NewtTestUtil.waitForRealized(glWindow1, true, awtRobotWaitAction));
+ System.err.println("GLWindow LOS.0: "+glWindow1.getLocationOnScreen(null));
+ glWindow1.addWindowListener(new WindowAdapter() {
+ public void windowResized(final WindowEvent e) {
+ System.err.println("window resized: "+glWindow1.getX()+"/"+glWindow1.getY()+" "+glWindow1.getSurfaceWidth()+"x"+glWindow1.getSurfaceHeight());
+ }
+ public void windowMoved(final WindowEvent e) {
+ System.err.println("window moved: "+glWindow1.getX()+"/"+glWindow1.getY()+" "+glWindow1.getSurfaceWidth()+"x"+glWindow1.getSurfaceHeight());
+ }
+ });
+ final NewtReparentingKeyAdapter newtDemoListener = new NewtJFXReparentingKeyAdapter(JFXApp.stage, glCanvas[0], glWindow1);
+ newtDemoListener.quitAdapterEnable(true);
+ glWindow1.addKeyListener(newtDemoListener);
+ glWindow1.addMouseListener(newtDemoListener);
+ glWindow1.addWindowListener(newtDemoListener);
+
+ final ChangeListener<Number> sizeListener = new ChangeListener<Number>() {
+ @Override public void changed(final ObservableValue<? extends Number> observable, final Number oldValue, final Number newValue) {
+ newtDemoListener.setTitle();
+ } };
+ JFXApp.stage.widthProperty().addListener(sizeListener);
+ JFXApp.stage.heightProperty().addListener(sizeListener);
+
+ }
+ if( null != demo ) {
+ System.err.println("NewtCanvasJFX LOS.0: "+glCanvas[0].getNativeWindow().getLocationOnScreen(null));
+ }
+
+ Animator anim;
+ if(useAnimator && null != demo) {
+ anim = new Animator(glWindow1);
+ anim.start();
+ } else {
+ anim = null;
+ }
+
+ final long lStartTime = System.currentTimeMillis();
+ final long lEndTime = lStartTime + duration;
+ try {
+ while( (System.currentTimeMillis() < lEndTime) ) {
+ generalWaitAction.run();
+ }
+ } catch( final Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ if(null != anim) {
+ anim.stop();
+ }
+
+ JFXAccessor.runOnJFXThread(true, new Runnable() {
+ public void run() {
+ populateScene( JFXApp.stage.getScene(), false, null, defWidth, defHeight, true, null);
+ JFXApp.stage.sizeToScene();
+ } });
+ }
+
+ @Test
+ public void test00() throws InterruptedException {
+ if( 0 > manualTestID || 0 == manualTestID ) {
+ runTestAGL( null, null,
+ false /* postAttachNewtCanvas */, false /* postAttach */, false /* animator */);
+ }
+ }
+
+ @Test
+ public void test11_preAttachNewtGL_NoAnim() throws InterruptedException {
+ if( 0 > manualTestID || 11 == manualTestID ) {
+ runTestAGL( new GLCapabilities(GLProfile.getGL2ES2()), new GearsES2(),
+ false /* postAttachNewtCanvas */, false /* postAttachGLWindow */, false /* animator */);
+ }
+ }
+
+ @Test
+ public void test12_postAttachNewt_NoAnim() throws InterruptedException {
+ if( 0 > manualTestID || 12 == manualTestID ) {
+ runTestAGL( new GLCapabilities(GLProfile.getGL2ES2()), new GearsES2(),
+ true /* postAttachNewtCanvas */, false /* postAttachGLWindow */, false /* animator */);
+ }
+ }
+
+ @Test
+ public void test13_postAttachGL_NoAnim() throws InterruptedException {
+ if( 0 > manualTestID || 13 == manualTestID ) {
+ runTestAGL( new GLCapabilities(GLProfile.getGL2ES2()), new GearsES2(),
+ false /* postAttachNewtCanvas */, true /* postAttachGLWindow */, false /* animator */);
+ }
+ }
+
+ @Test
+ public void test14_postAttachNewtGL_NoAnim() throws InterruptedException {
+ if( 0 > manualTestID || 14 == manualTestID ) {
+ runTestAGL( new GLCapabilities(GLProfile.getGL2ES2()), new GearsES2(),
+ true /* postAttachNewtCanvas */, true /* postAttachGLWindow */, false /* animator */);
+ }
+ }
+
+ @Test
+ public void test21_preAttachNewtGL_DoAnim() throws InterruptedException {
+ if( 0 > manualTestID || 21 == manualTestID ) {
+ runTestAGL( new GLCapabilities(GLProfile.getGL2ES2()), new GearsES2(),
+ false /* postAttachNewtCanvas */, false /* postAttachGLWindow */, true /* animator */);
+ }
+ }
+
+ @Test
+ public void test22_postAttachNewt_DoAnim() throws InterruptedException {
+ if( 0 > manualTestID || 22 == manualTestID ) {
+ runTestAGL( new GLCapabilities(GLProfile.getGL2ES2()), new GearsES2(),
+ true /* postAttachNewtCanvas */, false /* postAttachGLWindow */, true /* animator */);
+ }
+ }
+
+ @Test
+ public void test30_MultisampleAndAlpha() throws InterruptedException {
+ if( 0 > manualTestID || 30 == manualTestID ) {
+ final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
+ caps.setSampleBuffers(true);
+ caps.setNumSamples(2);
+ runTestAGL( caps, new MultisampleDemoES2(true),
+ false /* postAttachNewtCanvas */, false /* postAttachGLWindow */, false /* animator */);
+ }
+ }
+
+ public static void main(final String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ duration = MiscUtils.atoi(args[++i], duration);
+ }
+ if(args[i].equals("-test")) {
+ manualTestID = MiscUtils.atoi(args[++i], -1);
+ }
+ }
+ System.out.println("durationPerTest: "+duration+", test "+manualTestID);
+ org.junit.runner.JUnitCore.main(TestNewtCanvasJFXGLn.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java
index 1e65b15bc..04413315a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/math/TestPMVMatrix01NEWT.java
@@ -47,7 +47,6 @@ import org.junit.Test;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
-import com.jogamp.common.os.Platform;
import com.jogamp.opengl.math.FloatUtil;
import com.jogamp.opengl.math.geom.Frustum;
import com.jogamp.opengl.test.junit.util.MiscUtils;
@@ -102,6 +101,7 @@ public class TestPMVMatrix01NEWT extends UITestCase {
0.0f, 0.0f, 0.0f, 1.0f } );
@Test
+ @SuppressWarnings("deprecation")
public void test00MatrixToString() {
final String s4x4Cpmv = PMVMatrix.matrixToString(null, "%10.5f", translated123C).toString();
final String s4x4Cflu = FloatUtil.matrixToString(null, null, "%10.5f", translated123C, 0, 4, 4, false).toString();
@@ -328,7 +328,6 @@ public class TestPMVMatrix01NEWT extends UITestCase {
// System.err.println("P2: "+pmv.toString());
}
- @SuppressWarnings("unused")
@Test
public void test03MvTranslate() {
final FloatBuffer pmvMv;
@@ -367,7 +366,6 @@ public class TestPMVMatrix01NEWT extends UITestCase {
// System.err.println("pmvMvit: "+Platform.NEWLINE+PMVMatrix.matrixToString(null, "%10.5f", pmvMvit));
}
- @SuppressWarnings("unused")
@Test
public void test04MvTranslateRotate() {
final FloatBuffer pmvMv;
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
index b899c426c..2840e4026 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java
@@ -164,8 +164,8 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
robot.setAutoWaitForIdle(true);
// NativeWindow/JOGL is not initialized yet ..
- for (int wait=0; wait<AWTRobotUtil.POLL_DIVIDER && !frame.isVisible(); wait++) {
- Thread.sleep(AWTRobotUtil.TIME_SLICE);
+ for (int wait=0; wait<TestUtil.POLL_DIVIDER && !frame.isVisible(); wait++) {
+ Thread.sleep(TestUtil.TIME_SLICE);
}
Assert.assertEquals(true, frame.isVisible());
@@ -214,7 +214,7 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
AWTRobotUtil.toFrontAndRequestFocus(robot, frame);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(drawable, true));
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(drawable, true, null));
drawable.addGLEventListener(new GearsES2());
@@ -268,7 +268,7 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
final GLWindow win0 = GLWindow.create(caps);
win0.setSize(100,100);
win0.setVisible(true);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(win0, true));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(win0, true, null));
final Screen screen = win0.getScreen();
final RectangleImmutable screenBoundsInWinU = screen.getViewportInWindowUnits();
@@ -283,7 +283,7 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase {
runTestGL(newtCanvasAWT, win1);
win0.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(win0, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(win0, false, null));
Assert.assertEquals(false, win0.isNativeValid());
Assert.assertEquals(true, anim.isAnimating()); // due to newtCanvasAWT/win1
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java
index aec728cad..89df0b1fa 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java
@@ -40,7 +40,9 @@ import com.jogamp.newt.event.WindowAdapter;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.swt.NewtCanvasSWT;
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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
@@ -198,14 +200,14 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase {
return;
}
if(e.getKeyChar()=='f') {
- new Thread() {
+ glWindow.invokeOnNewThread(null, false, new Runnable() {
public void run() {
final Thread t = glWindow.setExclusiveContextThread(null);
System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
glWindow.setFullscreen(!glWindow.isFullscreen());
System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
glWindow.setExclusiveContextThread(t);
- } }.start();
+ } } );
}
}
});
@@ -228,7 +230,16 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase {
shell.open();
}
});
- Assert.assertTrue("GLWindow didn't become visible natively!", AWTRobotUtil.waitForRealized(glWindow, awtRobotWaitAction, true));
+ final Runnable waitAction = new Runnable() {
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ try {
+ Thread.sleep(10);
+ } catch (final InterruptedException e) { }
+ }
+ } };
+ Assert.assertEquals(true, NewtTestUtil.waitForVisible(glWindow, true, waitAction));
+ Assert.assertEquals(true, GLTestUtil.waitForRealized(glWindow, true, waitAction));
Assert.assertNotNull( canvas1.getNativeWindow() );
System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
@@ -272,7 +283,7 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase {
canvas1.dispose();
glWindow.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, waitAction));
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java
index 0578492e2..fd6a3691c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java
@@ -41,6 +41,7 @@ import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.swt.NewtCanvasSWT;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
@@ -205,14 +206,14 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase {
return;
}
if(e.getKeyChar()=='f') {
- new Thread() {
+ glWindow.invokeOnNewThread(null, false, new Runnable() {
public void run() {
final Thread t = glWindow.setExclusiveContextThread(null);
System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
glWindow.setFullscreen(!glWindow.isFullscreen());
System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets());
glWindow.setExclusiveContextThread(t);
- } }.start();
+ } } );
}
}
});
@@ -235,7 +236,7 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase {
shell.open();
}
});
- Assert.assertTrue("GLWindow didn't become visible natively!", AWTRobotUtil.waitForRealized(glWindow, awtRobotWaitAction, true));
+ Assert.assertTrue("GLWindow didn't become visible natively!", NewtTestUtil.waitForRealized(glWindow, true, awtRobotWaitAction));
Assert.assertNotNull( canvas1.getNativeWindow() );
System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities());
@@ -279,7 +280,7 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase {
canvas1.dispose();
glWindow.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null));
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java
index 9a422f411..329a08a48 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTBug628ResizeDeadlockAWT.java
@@ -50,7 +50,8 @@ import com.jogamp.opengl.GLCapabilities ;
import com.jogamp.opengl.GLEventListener ;
import com.jogamp.opengl.GLProfile;
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
-
+import com.jogamp.common.util.InterruptSource;
+import com.jogamp.common.util.InterruptedRuntimeException;
import com.jogamp.nativewindow.swt.SWTAccessor;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.event.KeyAdapter;
@@ -59,6 +60,7 @@ import com.jogamp.newt.opengl.GLWindow ;
import com.jogamp.newt.swt.NewtCanvasSWT ;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
////////////////////////////////////////////////////////////////////////////////
@@ -143,14 +145,13 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
////////////////////////////////////////////////////////////////////////////////
- static class ResizeThread extends Thread {
+ static class ResizeThread extends InterruptSource.Thread {
volatile boolean shallStop = false;
private final Shell _shell ;
private int _n ;
public ResizeThread( final Shell shell )
{
- super();
_shell = shell ;
}
@@ -196,9 +197,9 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
display.asyncExec( resizeAction );
display.wake();
- Thread.sleep( 50L ) ;
+ java.lang.Thread.sleep( 50L ) ;
} catch( final InterruptedException e ) {
- break ;
+ throw new InterruptedRuntimeException(e);
}
}
System.err.println("*R-Exit* shallStop "+shallStop+", disposed "+_shell.isDisposed());
@@ -207,7 +208,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
////////////////////////////////////////////////////////////////////////////////
- static class KeyfireThread extends Thread
+ static class KeyfireThread extends InterruptSource.Thread
{
volatile boolean shallStop = false;
Display _display;
@@ -216,6 +217,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
public KeyfireThread(final Robot robot, final Display display)
{
+ super();
_robot = robot;
_display = display;
}
@@ -231,7 +233,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
AWTRobotUtil.waitForIdle(_robot);
AWTRobotUtil.newtKeyPress(_n, _robot, true, KeyEvent.VK_0, 10);
AWTRobotUtil.newtKeyPress(_n, _robot, false, KeyEvent.VK_0, 0);
- Thread.sleep( 40L ) ;
+ java.lang.Thread.sleep( 40L ) ;
_n++;
if(!_display.isDisposed()) {
_display.wake();
@@ -348,7 +350,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
dsc.shell.setSize( 400, 450 ) ;
dsc.shell.open() ;
} } );
- Assert.assertTrue("GLWindow didn't become visible natively!", AWTRobotUtil.waitForRealized(glWindow, dsc.awtRobotWaitAction, true));
+ Assert.assertTrue("GLWindow didn't become visible natively!", NewtTestUtil.waitForRealized(glWindow, true, dsc.awtRobotWaitAction));
AWTRobotUtil.requestFocus(robot, glWindow, false);
AWTRobotUtil.setMouseToClientLocation(robot, glWindow, 50, 50);
@@ -368,7 +370,7 @@ public class TestNewtCanvasSWTBug628ResizeDeadlockAWT extends UITestCase {
}
{
- final Thread t = new Thread(new Runnable() {
+ final Thread t = new InterruptSource.Thread(null, new Runnable() {
@Override
public void run() {
try {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java
index 0d9effb30..93b1af15a 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestNewtCanvasSWTGLn.java
@@ -57,6 +57,7 @@ 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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.GLReadBufferUtil;
@@ -194,7 +195,7 @@ public class TestNewtCanvasSWTGLn extends UITestCase {
canvas1.setNEWTChild(glWindow1);
}
- Assert.assertTrue("GLWindow didn't become visible natively!", AWTRobotUtil.waitForRealized(glWindow1, awtRobotWaitAction, true));
+ Assert.assertTrue("GLWindow didn't become visible natively!", NewtTestUtil.waitForRealized(glWindow1, true, awtRobotWaitAction));
System.err.println("GLWindow LOS.0: "+glWindow1.getLocationOnScreen(null));
System.err.println("NewtCanvasSWT LOS.0: "+canvas1.getNativeWindow().getLocationOnScreen(null));
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor01.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor01.java
new file mode 100644
index 000000000..bf98a8e95
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor01.java
@@ -0,0 +1,200 @@
+/**
+ * Copyright 2010 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.jogl.swt;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.junit.util.JunitTracer;
+import com.jogamp.nativewindow.swt.SWTAccessor;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+/**
+ * Tests {@link SWTAccessor#getWindowHandle(org.eclipse.swt.widgets.Control)} on a basic simple SWT window.
+ * <p>
+ * Bug 1362 inspired this unit test, i.e. finding the issue of SWT >= 4.10 + GTK3.
+ * </p>
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSWTAccessor01 extends UITestCase {
+
+ static int duration = 250;
+
+ Display display = null;
+ Shell shell = null;
+ Composite composite = null;
+
+ @BeforeClass
+ public static void startup() {
+ if( Platform.getOSType() == Platform.OSType.MACOS ) {
+ // NSLocking issues on OSX and AWT, able to freeze whole test suite!
+ // Since this test is merely a technical nature to validate the accessor w/ SWT
+ // we can drop it w/o bothering.
+ JunitTracer.setTestSupported(false);
+ return;
+ }
+ }
+
+ protected void init() throws InterruptedException, InvocationTargetException {
+ System.err.println("SWT Platform: "+SWT.getPlatform()+", Version "+SWT.getVersion());
+ System.err.println("GTK_VERSION: "+SWTAccessor.GTK_VERSION());
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ display = new Display();
+ Assert.assertNotNull( display );
+ shell = new Shell( display );
+ Assert.assertNotNull( shell );
+ shell.setLayout( new GridLayout(3, false) );
+ shell.setBackground(new Color(display, 0, 0, 255));
+ new Text(shell, SWT.NONE).setText("1");
+ new Text(shell, SWT.NONE).setText("2");
+ new Text(shell, SWT.NONE).setText("3");
+ new Text(shell, SWT.NONE).setText("4");
+ composite = new Composite( shell, SWT.NO_BACKGROUND /** | SWT.EMBEDDED */ );
+ composite.setLayout( new FillLayout() );
+ composite.setBackground(new Color(display, 0, 255, 0));
+ final GridData gd = new GridData (GridData.FILL, GridData.FILL, true /* grabExcessHorizontalSpace */, true /* grabExcessVerticalSpace */);
+ composite.setLayoutData(gd);
+ new Text(shell, SWT.NONE).setText("6");
+ new Text(shell, SWT.NONE).setText("7");
+ new Text(shell, SWT.NONE).setText("8");
+ new Text(shell, SWT.NONE).setText("9");
+ Assert.assertNotNull( composite );
+ }});
+ }
+
+ protected void release() throws InterruptedException, InvocationTargetException {
+ Assert.assertNotNull( display );
+ Assert.assertNotNull( shell );
+ Assert.assertNotNull( composite );
+
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ composite.dispose();
+ shell.close();
+ shell.dispose();
+ display.dispose();
+ display = null;
+ shell = null;
+ composite = null;
+ }});
+ }
+
+ protected void runTest() throws InterruptedException, InvocationTargetException {
+ init();
+ final Canvas canvas[] = { null };
+ try {
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ canvas[0] = new Canvas (composite, SWT.NONE);
+ canvas[0].setBackground(new Color(display, 255, 255, 255));
+ canvas[0].setForeground(new Color(display, 255, 0, 0));
+ canvas[0].addPaintListener (new PaintListener() {
+ public void paintControl(final PaintEvent e) {
+ final Rectangle r = canvas[0].getClientArea();
+ e.gc.fillRectangle(0, 0, r.width, r.height);
+ e.gc.drawRectangle(50, 50, r.width-100, r.height-100);
+ e.gc.drawString("I am a Canvas", r.width/2, r.height/2);
+ }});
+ try {
+ System.err.println("Window handle.0 0x"+Long.toHexString(SWTAccessor.getWindowHandle(canvas[0])));
+ } catch (final Exception e) {
+ System.err.println(e.getMessage());
+ }
+ shell.setText( getClass().getName() );
+ shell.setBounds( 0, 0, 700, 700 );
+ shell.open();
+ canvas[0].redraw();
+ }});
+
+ System.err.println("Window handle.1 0x"+Long.toHexString(SWTAccessor.getWindowHandle(canvas[0])));
+
+ final long lStartTime = System.currentTimeMillis();
+ final long lEndTime = lStartTime + duration;
+ try {
+ while( (System.currentTimeMillis() < lEndTime) && !composite.isDisposed() ) {
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ // blocks on linux .. display.sleep();
+ try {
+ Thread.sleep(10);
+ } catch (final InterruptedException e) { }
+ }
+ }});
+ }
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ System.err.println("Window handle.X 0x"+Long.toHexString(SWTAccessor.getWindowHandle(canvas[0])));
+ }});
+ }
+ catch( final Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ } finally {
+ release();
+ }
+ }
+
+ @Test
+ public void test() throws InterruptedException, InvocationTargetException {
+ runTest();
+ }
+
+ public static void main(final String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ duration = MiscUtils.atoi(args[++i], duration);
+ }
+ }
+ org.junit.runner.JUnitCore.main( TestSWTAccessor01.class.getName() );
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java
new file mode 100644
index 000000000..6694df65a
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor02NewtGLWindow.java
@@ -0,0 +1,256 @@
+/**
+ * Copyright 2010 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.jogl.swt;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.os.Platform;
+import com.jogamp.junit.util.JunitTracer;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos;
+import com.jogamp.nativewindow.swt.SWTAccessor;
+import com.jogamp.newt.swt.NewtCanvasSWT;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+/**
+ * Tests utilizing {@link SWTAccessor#getWindowHandle(org.eclipse.swt.widgets.Control)}
+ * for NEWT native window reparenting also using GL rendering {@link GLWindow#reparentWindow(NativeWindow, int, int, int)}.
+ * <p>
+ * This tests re-creates {@link NewtCanvasSWT}'s implementation ad-hock, allowing simplified debugging.
+ * </p>
+ * <p>
+ * Enhanced version of {@link TestSWTAccessor01}.
+ * </p>
+ * <p>
+ * Bug 1362 inspired this unit test, i.e. finding the issue of SWT >= 4.10 + GTK3.
+ * </p>
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestSWTAccessor02NewtGLWindow extends UITestCase {
+
+ static int duration = 250;
+
+ Display display = null;
+ Shell shell = null;
+ Composite composite = null;
+
+ @BeforeClass
+ public static void startup() {
+ if( Platform.getOSType() == Platform.OSType.MACOS ) {
+ // NSLocking issues on OSX and AWT, able to freeze whole test suite!
+ // Since this test is merely a technical nature to validate the accessor w/ SWT
+ // we can drop it w/o bothering.
+ JunitTracer.setTestSupported(false);
+ return;
+ }
+ }
+
+ protected void init() throws InterruptedException, InvocationTargetException {
+ System.err.println("SWT Platform: "+SWT.getPlatform()+", Version "+SWT.getVersion());
+ System.err.println("GTK_VERSION: "+SWTAccessor.GTK_VERSION());
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ display = new Display();
+ Assert.assertNotNull( display );
+ shell = new Shell( display );
+ Assert.assertNotNull( shell );
+ shell.setLayout( new GridLayout(3, false) );
+ shell.setBackground(new Color(display, 0, 0, 255));
+ new Text(shell, SWT.NONE).setText("1");
+ new Text(shell, SWT.NONE).setText("2");
+ new Text(shell, SWT.NONE).setText("3");
+ new Text(shell, SWT.NONE).setText("4");
+ composite = new Composite( shell, SWT.NO_BACKGROUND /** | SWT.EMBEDDED */ );
+ composite.setLayout( new FillLayout() );
+ composite.setBackground(new Color(display, 0, 255, 0));
+ final GridData gd = new GridData (GridData.FILL, GridData.FILL, true /* grabExcessHorizontalSpace */, true /* grabExcessVerticalSpace */);
+ composite.setLayoutData(gd);
+ new Text(shell, SWT.NONE).setText("6");
+ new Text(shell, SWT.NONE).setText("7");
+ new Text(shell, SWT.NONE).setText("8");
+ new Text(shell, SWT.NONE).setText("9");
+ Assert.assertNotNull( composite );
+ }});
+ }
+
+ protected void release(final GLWindow glwin) throws InterruptedException, InvocationTargetException {
+ Assert.assertNotNull( display );
+ Assert.assertNotNull( shell );
+ Assert.assertNotNull( composite );
+
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ glwin.destroy();
+ composite.dispose();
+ shell.close();
+ shell.dispose();
+ display.dispose();
+ display = null;
+ shell = null;
+ composite = null;
+ }});
+ }
+
+ protected void runTest() throws InterruptedException, InvocationTargetException {
+ init();
+
+ final GLCapabilities caps = new GLCapabilities(GLProfile.getGL2ES2());
+ final GLWindow glwin = GLWindow.create(caps);
+ final GearsES2 demo = new GearsES2();
+ glwin.addGLEventListener(demo);
+ glwin.setSize(600, 600);
+
+ final Canvas canvas[] = { null };
+ try {
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ canvas[0] = new Canvas (composite, SWT.NO_BACKGROUND);
+ // Bug 1362 fix or workaround: Seems SWT/GTK3 at least performs lazy initialization
+ // Minimal action required: setBackground of the parent canvas before reparenting!
+ canvas[0].setBackground(new Color(display, 255, 255, 255));
+ shell.setText( getClass().getName() );
+ shell.setBounds( 0, 0, 700, 700 );
+ shell.open();
+
+ // A full rolled-out native window reparenting example, very suitable to debug
+ final long parentWinHandle = SWTAccessor.getWindowHandle(canvas[0]);
+ final AbstractGraphicsScreen aScreen = NativeWindowFactory.createScreen(NativeWindowFactory.createDevice(null, true /* own */), -1);
+ final UpstreamWindowHookMutableSizePos upstreamSizePosHook = new UpstreamWindowHookMutableSizePos(0, 0, 600, 600, 600, 600);
+ final Listener listener = new Listener () {
+ @Override
+ public void handleEvent (final Event event) {
+ switch (event.type) {
+ case SWT.Paint:
+ glwin.display();
+ break;
+ case SWT.Move:
+ case SWT.Resize: {
+ final Rectangle nClientArea = canvas[0].getClientArea();
+ if( null != nClientArea ) {
+ upstreamSizePosHook.setSurfaceSize(nClientArea.width, nClientArea.height);
+ upstreamSizePosHook.setWinSize(nClientArea.width, nClientArea.height);
+ upstreamSizePosHook.setWinPos(nClientArea.x, nClientArea.y);
+ if( SWT.Resize == event.type ) {
+ glwin.setSize(nClientArea.width, nClientArea.height);
+ }
+ }
+ }
+ break;
+ case SWT.Dispose:
+ glwin.destroy();
+ break;
+ }
+ }
+ };
+ canvas[0].addListener (SWT.Move, listener);
+ canvas[0].addListener (SWT.Resize, listener);
+ canvas[0].addListener (SWT.Paint, listener);
+ canvas[0].addListener (SWT.Dispose, listener);
+
+ final NativeWindow parentWindow = NativeWindowFactory.createWrappedWindow(aScreen, 0 /* surfaceHandle*/, parentWinHandle, upstreamSizePosHook);
+ glwin.reparentWindow(parentWindow, 0, 0, 0);
+ final Rectangle r = canvas[0].getClientArea();
+ glwin.setSize(r.width, r.height);
+ glwin.setVisible(true);
+ canvas[0].redraw();
+ }});
+
+ System.err.println("Window handle.1 0x"+Long.toHexString(SWTAccessor.getWindowHandle(canvas[0])));
+
+ final long lStartTime = System.currentTimeMillis();
+ final long lEndTime = lStartTime + duration;
+ try {
+ while( (System.currentTimeMillis() < lEndTime) && !composite.isDisposed() ) {
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ if( !display.readAndDispatch() ) {
+ // blocks on linux .. display.sleep();
+ try {
+ Thread.sleep(10);
+ } catch (final InterruptedException e) { }
+ }
+ }});
+ }
+ SWTAccessor.invoke(true, new Runnable() {
+ public void run() {
+ System.err.println("Window handle.X 0x"+Long.toHexString(SWTAccessor.getWindowHandle(canvas[0])));
+ }});
+ }
+ catch( final Throwable throwable ) {
+ throwable.printStackTrace();
+ Assume.assumeNoException( throwable );
+ }
+ } finally {
+ release(glwin);
+ }
+ }
+
+ @Test
+ public void test() throws InterruptedException, InvocationTargetException {
+ runTest();
+ }
+
+ public static void main(final String args[]) {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ duration = MiscUtils.atoi(args[++i], duration);
+ }
+ }
+ org.junit.runner.JUnitCore.main( TestSWTAccessor02NewtGLWindow.class.getName() );
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java
index 7072ed9ea..b8ba3b97e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTBug643AsyncExec.java
@@ -51,14 +51,15 @@ import com.jogamp.opengl.GLProfile;
import jogamp.newt.swt.SWTEDTUtil;
import jogamp.newt.swt.event.SWTNewtEventFactory;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.nativewindow.swt.SWTAccessor;
import com.jogamp.newt.NewtFactory;
import com.jogamp.newt.opengl.GLWindow ;
import com.jogamp.newt.swt.NewtCanvasSWT ;
import com.jogamp.opengl.swt.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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
@@ -110,7 +111,7 @@ public class TestSWTBug643AsyncExec extends UITestCase {
////////////////////////////////////////////////////////////////////////////////
- static class AsyncExecEDTFeederThread extends Thread {
+ static class AsyncExecEDTFeederThread extends InterruptSource.Thread {
volatile boolean shallStop = false;
private final Display swtDisplay ;
private final jogamp.newt.DisplayImpl newtDisplay;
@@ -118,7 +119,6 @@ public class TestSWTBug643AsyncExec extends UITestCase {
public AsyncExecEDTFeederThread( final Display swtDisplay, final com.jogamp.newt.Display newtDisplay )
{
- super();
this.swtDisplay = swtDisplay ;
this.newtDisplay = (jogamp.newt.DisplayImpl)newtDisplay;
}
@@ -152,7 +152,7 @@ public class TestSWTBug643AsyncExec extends UITestCase {
// only perform async exec on valid and already running NEWT EDT!
newtDisplay.runOnEDTIfAvail(false, newtAsyncAction);
}
- Thread.sleep( 50L ) ;
+ java.lang.Thread.sleep( 50L ) ;
} catch( final InterruptedException e ) {
break ;
}
@@ -241,7 +241,7 @@ public class TestSWTBug643AsyncExec extends UITestCase {
if( glWindowPreVisible ) {
newtDisplay.setEDTUtil(new SWTEDTUtil(newtDisplay, dsc.display)); // Especially Windows requires creation access via same thread!
glWindow.setVisible(true);
- AWTRobotUtil.waitForRealized(glWindow, true);
+ NewtTestUtil.waitForRealized(glWindow, true, null);
Thread.sleep(120); // let it render a bit, before consumed by SWT
}
glad = glWindow;
@@ -275,7 +275,7 @@ public class TestSWTBug643AsyncExec extends UITestCase {
}
{
- final Thread t = new Thread(new Runnable() {
+ final Thread t = new InterruptSource.Thread(null, new Runnable() {
@Override
public void run() {
try {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java
index c880b1f13..3ce6113f9 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsAWT.java
@@ -165,9 +165,9 @@ public class TestTiledPrintingGearsAWT extends TiledPrintingAWTBase {
frame.pack();
frame.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas2, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas2, true, null));
animator.setUpdateFPSFrames(60, System.err);
animator.start();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java
index 48f1dbdb1..0c111328d 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsNewtAWT.java
@@ -170,9 +170,9 @@ public class TestTiledPrintingGearsNewtAWT extends TiledPrintingAWTBase {
frame.pack();
frame.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas2, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas1, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(canvas2, true, null));
animator.setUpdateFPSFrames(60, System.err);
animator.start();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
index 41d438f5d..5ad629fe0 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT.java
@@ -211,9 +211,9 @@ public class TestTiledPrintingGearsSwingAWT extends TiledPrintingAWTBase {
frame.setVisible(true);
} } ) ;
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel2, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel2, true, null));
animator.setUpdateFPSFrames(60, System.err);
animator.start();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
index b069e8dba..2727e2792 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingGearsSwingAWT2.java
@@ -206,8 +206,8 @@ public class TestTiledPrintingGearsSwingAWT2 extends TiledPrintingAWTBase {
frame.setVisible(true);
} } ) ;
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true, null));
if( null != animator ) {
animator.setUpdateFPSFrames(60, System.err);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java
index 3b48ccf6b..c8912f524 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledPrintingNIOImageSwingAWT.java
@@ -225,9 +225,9 @@ public class TestTiledPrintingNIOImageSwingAWT extends UITestCase {
frame.setVisible(true);
} } ) ;
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel2, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel1, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glJPanel2, true, null));
// paint offscreen: array 72dpi ARGB
{
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java
index be662fd1f..9c4943176 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TiledPrintingAWTBase.java
@@ -39,6 +39,7 @@ import java.awt.print.PrinterException;
import java.awt.print.PrinterJob;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
+import java.util.Locale;
import com.jogamp.opengl.GLAutoDrawable;
import javax.print.StreamPrintService;
@@ -139,7 +140,7 @@ public abstract class TiledPrintingAWTBase extends UITestCase {
final String simpleTestName = getSimpleTestName(".");
final String onoffscrn = 0 > offscrnImageType ? "on_screen" : "offscrn_"+offscrnImageType;
final String aa = 0 <= numSamples ? "aa"+numSamples : "aaN";
- return String.format("%-"+maxSimpleTestNameLen+"s-n%04d-%s-dpi%03d-%s-tSz%04dx%04d-resize%d.%s",
+ return String.format((Locale)null, "%-"+maxSimpleTestNameLen+"s-n%04d-%s-dpi%03d-%s-tSz%04dx%04d-resize%d.%s",
simpleTestName, printCount, onoffscrn, dpi, aa, tileWidth, tileHeight, resizeWithinPrintTest?1:0, suffix).replace(' ', '_');
}
private PrintableBase doPrintAutoImpl(final Container cont, final PrinterJob job,
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java
index f90b32009..572871233 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1TextureImmModeSink.java
@@ -97,7 +97,7 @@ public class DemoGL2ES1TextureImmModeSink implements GLEventListener, TextureDra
}
final GL2ES1 gl = FixedFuncUtil.wrapFixedFuncEmul(_gl, ShaderSelectionMode.AUTO, null, forceFFPEmu, verboseFFPEmu);
- final URLConnection testTextureUrlConn = IOUtil.getResource(PNGTstFiles.class, "test-ntscP_3-01-160x90.png");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscP_3-01-160x90.png", PNGTstFiles.class.getClassLoader(), PNGTstFiles.class);
try {
final InputStream testTextureStream = testTextureUrlConn.getInputStream();
textureData = TextureIO.newTextureData(gl.getGLProfile(), testTextureStream , false /* mipmap */, TextureIO.PNG);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/ImageTstFiles.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/ImageTstFiles.java
new file mode 100644
index 000000000..25bb7e788
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/ImageTstFiles.java
@@ -0,0 +1,128 @@
+/**
+ * Copyright 2014 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.jogl.util.texture;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLConnection;
+import java.util.ArrayList;
+
+import com.jogamp.common.util.IOUtil;
+
+public class ImageTstFiles {
+ public static final String[] pngFileNames = new String[] {
+ "bug724-transparent-grey_gimpexp.png",
+ "bug724-transparent-grey_orig.png",
+ "cross-grey-alpha-16x16.png",
+ "grayscale_texture.png",
+ "pointer-grey-alpha-16x24.png",
+ "test-ntscI_3-01-160x90.png",
+ "test-ntscI_4-01-160x90.png",
+ "test-ntscIG3-01-160x90.png",
+ "test-ntscIG4-01-160x90.png",
+ "test-ntscN_3-01-160x90.png",
+ "test-ntscN_4-01-160x90.png",
+ "test-ntscNG4-01-160x90.png",
+ "test-ntscP_3-01-160x90.png",
+ "test-ntscP_4-01-160x90.png"
+ };
+
+ public static final String[] jpgFileNames = new String[] {
+ "bug745_qttdef_post_frame.jpg",
+ "darwin_03_N_4-YCCK-640x452.jpg", // local
+ "darwin_03_N_4-YCCK.jpg", // local
+ "j1-baseline.jpg",
+ "j2-progressive.jpg",
+ "j3-baseline_gray.jpg",
+ "test-cmyk-01.jpg",
+ "test-ntscN_3-01-160x90-60pct-yuv422h-base.jpg",
+ "test-ntscN_3-01-160x90-60pct-yuv422h-prog.jpg",
+ "test-ntscN_3-01-160x90-90pct-yuv444-base.jpg",
+ "test-ntscN_3-01-160x90-90pct-yuv444-prog.jpg",
+ "test-ycck-01.jpg" };
+
+ public static final String[] tgaFileNames = new String[] {
+ "bug744-rle32.tga",
+ "bug982.rle32.256x256.tga",
+ "test-u32.tga"
+ };
+ public static final String[] ddsFileNames = new String[] {
+ "test-64x32_DXT1.dds",
+ "test-64x32_DXT5.dds",
+ "test-64x32_uncompressed.dds"
+ };
+
+ public static class NamedInputStream {
+ final String fullPath;
+ final String basePath;
+ final InputStream stream;
+ public NamedInputStream(final String fullPath, final String basePath, final InputStream stream) {
+ this.fullPath = fullPath;
+ this.basePath = basePath;
+ this.stream = stream;
+ }
+ }
+ public ArrayList<NamedInputStream> pngStreams;
+ public ArrayList<NamedInputStream> jpgStreams;
+ public ArrayList<NamedInputStream> tgaStreams;
+ public ArrayList<NamedInputStream> ddsStreams;
+ public ArrayList<NamedInputStream> allStreams;
+
+ private final ArrayList<NamedInputStream> init(final String[] source) throws IOException {
+ final ArrayList<NamedInputStream> sink = new ArrayList<NamedInputStream>();
+ for(int i=0; i<source.length; i++) {
+ final URLConnection testTextureUrlConn = IOUtil.getResource(source[i], this.getClass().getClassLoader(), this.getClass());
+ if( null != testTextureUrlConn ) {
+ final InputStream s = testTextureUrlConn.getInputStream();
+ if( null != s ) {
+ sink.add(new NamedInputStream(testTextureUrlConn.getURL().toString(), source[i], s));
+ }
+ }
+ }
+ return sink;
+ }
+
+ public void init() throws IOException {
+ pngStreams = init(pngFileNames);
+ jpgStreams = init(jpgFileNames);
+ tgaStreams = init(tgaFileNames);
+ ddsStreams = init(ddsFileNames);
+ allStreams = new ArrayList<NamedInputStream>();
+ allStreams.addAll(pngStreams);
+ allStreams.addAll(jpgStreams);
+ allStreams.addAll(tgaStreams);
+ allStreams.addAll(ddsStreams);
+ }
+ public void clear() {
+ pngStreams.clear();
+ jpgStreams.clear();
+ tgaStreams.clear();
+ ddsStreams.clear();
+ allStreams.clear();
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java
index a585e9eaf..71233d07c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestBug362DDSImageCreateFromData.java
@@ -56,7 +56,7 @@ public class TestBug362DDSImageCreateFromData {
}
private File initFile(final String filename) throws URISyntaxException {
- final URLConnection connection = IOUtil.getResource(getClass(), filename);
+ final URLConnection connection = IOUtil.getResource(filename, getClass().getClassLoader(), getClass());
Assert.assertNotNull(connection);
final URL url = connection.getURL();
final File file = new File(url.toURI());
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java
index 201d60a78..d2ce4e19b 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite01AWT.java
@@ -119,8 +119,8 @@ public class TestGLReadBufferUtilTextureIOWrite01AWT extends UITestCase {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
}
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glc, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glc, true, null));
Assert.assertEquals(JAWTUtil.isOffscreenLayerSupported() && offscreenLayer,
glc.isOffscreenLayerSurfaceEnabled());
animator.start();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java
index a7196150c..3ac5f3618 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java
@@ -144,8 +144,8 @@ public class TestGLReadBufferUtilTextureIOWrite02AWT extends UITestCase {
throwable.printStackTrace();
Assume.assumeNoException( throwable );
}
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glc, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glc, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glc, true, null));
Assert.assertEquals(JAWTUtil.isOffscreenLayerSupported() && offscreenLayer,
glc.isOffscreenLayerSurfaceEnabled());
animator.start();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java
index 8339831a0..7fc14a609 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java
@@ -28,6 +28,7 @@
package com.jogamp.opengl.test.junit.jogl.util.texture;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.GLAutoDrawable;
@@ -99,7 +100,7 @@ public class TestGLReadBufferUtilTextureIOWrite02NEWT extends UITestCase {
c=0;
snapshot(i++, null, drawable.getGL(), screenshot, TextureIO.PNG, null);
dw_old = dw;
- new Thread() {
+ new InterruptSource.Thread() {
@Override
public void run() {
glWindow.setSize(2*dw, 2*dh);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestImageTypeNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestImageTypeNEWT.java
new file mode 100644
index 000000000..952d54443
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestImageTypeNEWT.java
@@ -0,0 +1,92 @@
+/**
+ * Copyright 2015 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.jogl.util.texture;
+
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.texture.ImageType;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestImageTypeNEWT extends UITestCase {
+ ImageTstFiles imageTstFiles;
+
+ @Before
+ public void initTest() throws IOException {
+ imageTstFiles = new ImageTstFiles();
+ imageTstFiles.init();
+ }
+
+ @After
+ public void cleanupTest() {
+ imageTstFiles.clear();
+ }
+
+ public void testImpl(final List<ImageTstFiles.NamedInputStream> streams, final ImageType expImageType) throws InterruptedException, IOException {
+ for(int i=0; i<streams.size(); i++) {
+ final ImageTstFiles.NamedInputStream s = streams.get(i);
+ final ImageType t = new ImageType(s.stream);
+ System.err.printf("Test %3d: path %s, exp-type %s, has-type %s%n", i, s.basePath, expImageType, t);
+ Assert.assertEquals(expImageType, t);
+ }
+ }
+
+ @Test
+ public void test01AllPNG() throws InterruptedException, IOException {
+ testImpl(imageTstFiles.pngStreams, new ImageType(ImageType.T_PNG));
+ }
+
+ @Test
+ public void test02AllJPG() throws InterruptedException, IOException {
+ testImpl(imageTstFiles.jpgStreams, new ImageType(ImageType.T_JPG));
+ }
+
+ // TGA cannot be detected
+ // @Test
+ public void test03AllTGA() throws InterruptedException, IOException {
+ testImpl(imageTstFiles.tgaStreams, new ImageType(ImageType.T_TGA));
+ }
+
+ @Test
+ public void test04AllDDS() throws InterruptedException, IOException {
+ testImpl(imageTstFiles.ddsStreams, new ImageType(ImageType.T_DDS));
+ }
+
+ public static void main(final String args[]) throws IOException {
+ org.junit.runner.JUnitCore.main(TestImageTypeNEWT.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java
index 925382901..8ccc73f34 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGImage01NEWT.java
@@ -146,7 +146,7 @@ public class TestJPEGImage01NEWT extends UITestCase {
@Test
public void testReadES2_RGBn() throws InterruptedException, IOException, MalformedURLException {
final String fname = null == _fname ? "test-ntscN_3-01-160x90-90pct-yuv444-base.jpg" : _fname;
- final URLConnection urlConn = IOUtil.getResource(this.getClass(), fname);
+ final URLConnection urlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass());
testImpl(urlConn.getInputStream());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java
index 4fc774463..87a993de4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTBenchmarkNewtAWT.java
@@ -64,7 +64,7 @@ public class TestJPEGJoglAWTBenchmarkNewtAWT extends UITestCase {
{
final long t0 = System.currentTimeMillis();
for(int i = 0; i< loops; i++ ) {
- final URLConnection urlConn = IOUtil.getResource(this.getClass(), fname);
+ final URLConnection urlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass());
final InputStream istream = urlConn.getInputStream();
final JPEGImage image = JPEGImage.read(istream); // parsing & completion done !!!
final int internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA:GL.GL_RGB;
@@ -92,7 +92,7 @@ public class TestJPEGJoglAWTBenchmarkNewtAWT extends UITestCase {
{
final long t0 = System.currentTimeMillis();
for(int i = 0; i< loops; i++ ) {
- final URLConnection urlConn = IOUtil.getResource(this.getClass(), fname);
+ final URLConnection urlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass());
final InputStream istream = urlConn.getInputStream();
final JPEGImage image = JPEGImage.read(istream, TextureData.ColorSpace.YCbCr); // parsing & completion done !!!
final int internalFormat = (image.getBytesPerPixel()==4)?GL.GL_RGBA:GL.GL_RGB;
@@ -120,7 +120,7 @@ public class TestJPEGJoglAWTBenchmarkNewtAWT extends UITestCase {
{
final long t0 = System.currentTimeMillis();
for(int i = 0; i< loops; i++ ) {
- final URLConnection urlConn = IOUtil.getResource(this.getClass(), fname);
+ final URLConnection urlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass());
final InputStream istream = urlConn.getInputStream();
Buffer data = null;
try {
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java
index d5c80553d..b48000046 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java
@@ -101,7 +101,7 @@ public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase {
}
GLWindow testJOGLJpeg(final String fname) throws InterruptedException, IOException {
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), fname);
+ final URLConnection testTextureUrlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
final InputStream istream = testTextureUrlConn.getInputStream();
Assert.assertNotNull(istream);
@@ -160,7 +160,7 @@ public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase {
}
GLWindow testAWTJpeg(final String fname, final int xpos) throws InterruptedException, IOException {
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), fname);
+ final URLConnection testTextureUrlConn = IOUtil.getResource(fname, this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
final InputStream istream = testTextureUrlConn.getInputStream();
Assert.assertNotNull(istream);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java
index 114561666..b43fba479 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGTextureFromFileNEWT.java
@@ -82,63 +82,63 @@ public class TestJPEGTextureFromFileNEWT extends UITestCase {
@Before
public void initTest() throws IOException {
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-90pct-yuv444-base.jpg");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90-90pct-yuv444-base.jpg", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream01YUV444_Base = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream01YUV444_Base);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-90pct-yuv444-prog.jpg");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90-90pct-yuv444-prog.jpg", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream01YUV444_Prog = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream01YUV444_Prog);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-60pct-yuv422h-base.jpg");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90-60pct-yuv422h-base.jpg", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream01YUV422h_Base = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream01YUV422h_Base);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90-60pct-yuv422h-prog.jpg");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90-60pct-yuv422h-prog.jpg", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream01YUV422h_Prog = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream01YUV422h_Prog);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j1-baseline.jpg");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("j1-baseline.jpg", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream02YUV420_Base = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream02YUV420_Base);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j2-progressive.jpg");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("j2-progressive.jpg", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream02YUV420_Prog = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream02YUV420_Prog);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "j3-baseline_gray.jpg");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("j3-baseline_gray.jpg", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream02YUV420_BaseGray = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream02YUV420_BaseGray);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-cmyk-01.jpg");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-cmyk-01.jpg", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream03CMYK_01 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream03CMYK_01);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ycck-01.jpg");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ycck-01.jpg", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream03YCCK_01 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream03YCCK_01);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "bug745_qttdef_post_frame.jpg");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("bug745_qttdef_post_frame.jpg", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream04QTTDefPostFrame = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream04QTTDefPostFrame);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java
index 3918b6cb7..0506f840e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect00NEWT.java
@@ -128,7 +128,7 @@ public class TestPNGPixelRect00NEWT extends UITestCase {
final File out2F_f=new File(getSimpleTestName(".")+"-02-"+basename+"-flipped.png");
final File out2R_f=new File(getSimpleTestName(".")+"-03-"+basename+"-reversed.png");
final File out2RF_f=new File(getSimpleTestName(".")+"-04-"+basename+"-reversed_flipped.png");
- final URLConnection urlConn = IOUtil.getResource(this.getClass(), pathname+basename+".png");
+ final URLConnection urlConn = IOUtil.getResource(pathname+basename+".png", this.getClass().getClassLoader(), this.getClass());
if( null == urlConn ) {
throw new IOException("Cannot find "+pathname+basename+".png");
}
@@ -205,7 +205,7 @@ public class TestPNGPixelRect00NEWT extends UITestCase {
System.err.println("Test02: "+pathname+basename+".png, destFmt "+destFmt+", destMinStrideInBytes "+destMinStrideInBytes+", destIsGLOriented "+destIsGLOriented);
final File out1_f=new File(getSimpleTestName(".")+"-"+basename+"-orig.png");
- final URLConnection urlConn = IOUtil.getResource(this.getClass(), pathname+basename+".png");
+ final URLConnection urlConn = IOUtil.getResource(pathname+basename+".png", this.getClass().getClassLoader(), this.getClass());
final PNGPixelRect image1 = PNGPixelRect.read(urlConn.getInputStream(), destFmt, false /* directBuffer */, destMinStrideInBytes, destIsGLOriented);
System.err.println("PNGPixelRect - Orig: "+image1);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java
index e299932b3..b6a047d03 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGPixelRect01NEWT.java
@@ -156,7 +156,7 @@ public class TestPNGPixelRect01NEWT extends UITestCase {
if( null == _fname ) {
return;
}
- final URLConnection urlConn = IOUtil.getResource(this.getClass(), _fname);
+ final URLConnection urlConn = IOUtil.getResource(_fname, this.getClass().getClassLoader(), this.getClass());
if( null == urlConn ) {
throw new IOException("Cannot find "+_fname+".png");
}
@@ -170,7 +170,7 @@ public class TestPNGPixelRect01NEWT extends UITestCase {
}
for(int i=0; i<PNGTstFiles.allBasenames.length; i++) {
final String basename = PNGTstFiles.allBasenames[i];
- final URLConnection urlConn = IOUtil.getResource(this.getClass(), basename+".png");
+ final URLConnection urlConn = IOUtil.getResource(basename+".png", this.getClass().getClassLoader(), this.getClass());
if( null == urlConn ) {
throw new IOException("Cannot find "+basename+".png");
}
@@ -184,7 +184,7 @@ public class TestPNGPixelRect01NEWT extends UITestCase {
}
for(int i=0; i<PNGTstFiles.greyBasenames.length; i++) {
final String basename = PNGTstFiles.greyBasenames[i];
- final URLConnection urlConn = IOUtil.getResource(this.getClass(), basename+".png");
+ final URLConnection urlConn = IOUtil.getResource(basename+".png", this.getClass().getClassLoader(), this.getClass());
if( null == urlConn ) {
throw new IOException("Cannot find "+basename+".png");
}
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java
index 2d6b6da71..157fffb90 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileAWT.java
@@ -86,7 +86,7 @@ public class TestPNGTextureFromFileAWT extends UITestCase {
grayTextureStream = TestPNGTextureFromFileAWT.class.getResourceAsStream( "grayscale_texture.png" );
Assert.assertNotNull(grayTextureStream);
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90.png");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90.png", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java
index a82767f9a..d7017465e 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPNGTextureFromFileNEWT.java
@@ -82,44 +82,44 @@ public class TestPNGTextureFromFileNEWT extends UITestCase {
grayTextureStream = TestPNGTextureFromFileNEWT.class.getResourceAsStream( "grayscale_texture.png" );
Assert.assertNotNull(grayTextureStream);
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_3-01-160x90.png");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_3-01-160x90.png", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStreamN_3 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStreamN_3);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscN_4-01-160x90.png");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscN_4-01-160x90.png", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStreamN_4 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStreamN_4);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscNG4-01-160x90.png");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscNG4-01-160x90.png", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStreamNG4 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStreamNG4);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscI_3-01-160x90.png");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscI_3-01-160x90.png", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStreamI_3 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStreamI_3);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscIG3-01-160x90.png");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscIG3-01-160x90.png", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStreamIG3 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStreamIG3);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscI_4-01-160x90.png");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscI_4-01-160x90.png", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStreamI_4 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStreamI_4);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscIG4-01-160x90.png");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscIG4-01-160x90.png", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStreamIG4 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStreamIG4);
@@ -127,13 +127,13 @@ public class TestPNGTextureFromFileNEWT extends UITestCase {
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscP_3-01-160x90.png");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscP_3-01-160x90.png", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStreamP_3 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStreamP_3);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-ntscP_4-01-160x90.png");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-ntscP_4-01-160x90.png", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStreamP_4 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStreamP_4);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java
index 618797e66..653ccadfd 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestPixelFormatUtil01NEWT.java
@@ -83,7 +83,7 @@ public class TestPixelFormatUtil01NEWT extends UITestCase {
{
System.err.println("Test01: "+pathname+basename+".png, srcFmt "+srcFmt+", destMinStrideInBytes "+destMinStrideInBytes+", destIsGLOriented "+destIsGLOriented);
- final URLConnection urlConn = IOUtil.getResource(this.getClass(), pathname+basename+".png");
+ final URLConnection urlConn = IOUtil.getResource(pathname+basename+".png", this.getClass().getClassLoader(), this.getClass());
final PNGPixelRect image1 = PNGPixelRect.read(urlConn.getInputStream(), srcFmt, false /* directBuffer */, destMinStrideInBytes, false /* isGLOriented */);
System.err.println("PNGPixelRect - Orig: "+image1);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java
index 6e0af17da..23f4593d8 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTGATextureFromFileNEWT.java
@@ -69,19 +69,19 @@ public class TestTGATextureFromFileNEWT extends UITestCase {
@Before
public void initTest() throws IOException {
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "test-u32.tga");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("test-u32.tga", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream01U32 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream01U32);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "bug744-rle32.tga");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("bug744-rle32.tga", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream02RLE32 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream02RLE32);
}
{
- final URLConnection testTextureUrlConn = IOUtil.getResource(this.getClass(), "bug982.rle32.256x256.tga");
+ final URLConnection testTextureUrlConn = IOUtil.getResource("bug982.rle32.256x256.tga", this.getClass().getClassLoader(), this.getClass());
Assert.assertNotNull(testTextureUrlConn);
testTextureStream03RLE32 = testTextureUrlConn.getInputStream();
Assert.assertNotNull(testTextureStream03RLE32);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureIONEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureIONEWT.java
new file mode 100644
index 000000000..56d9d481e
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestTextureIONEWT.java
@@ -0,0 +1,165 @@
+/**
+ * Copyright 2015 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.jogl.util.texture;
+
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.test.junit.jogl.demos.TextureDraw01Accessor;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.TextureDraw01ES2Listener;
+import com.jogamp.opengl.test.junit.jogl.demos.gl2.TextureDraw01GL2Listener;
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.GLReadBufferUtil;
+import com.jogamp.opengl.util.texture.ImageType;
+import com.jogamp.opengl.util.texture.TextureData;
+import com.jogamp.opengl.util.texture.TextureIO;
+
+import org.junit.Assert;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestTextureIONEWT extends UITestCase {
+ static long duration = 100; // ms
+
+ ImageTstFiles imageTstFiles;
+
+ @Before
+ public void initTest() throws IOException {
+ imageTstFiles = new ImageTstFiles();
+ imageTstFiles.init();
+ }
+
+ @After
+ public void cleanupTest() {
+ imageTstFiles.clear();
+ }
+
+ public void testImpl(final List<ImageTstFiles.NamedInputStream> streams, final ImageType expImageType) throws InterruptedException, IOException {
+ for(int i=0; i<streams.size(); i++) {
+ final ImageTstFiles.NamedInputStream s = streams.get(i);
+ System.err.printf("Test %3d: path %s, exp-type %s%n", i, s.basePath, expImageType);
+ testImpl(s.stream, expImageType);
+ }
+ }
+ public void testImpl(final InputStream istream, final ImageType expImageType) throws InterruptedException, IOException {
+ final GLReadBufferUtil screenshot = new GLReadBufferUtil(true, false);
+ final GLProfile glp = GLProfile.isAvailable(GLProfile.GL2ES2) ? GLProfile.getGL2ES2() : GLProfile.getDefault();
+ final GLCapabilities caps = new GLCapabilities(glp);
+ caps.setAlphaBits(1);
+
+ final TextureData texData = TextureIO.newTextureData(glp, istream, false /* mipmap */, expImageType.type);
+ System.err.println("TextureData: "+texData);
+ Assert.assertEquals(expImageType, texData.getSourceImageType());
+
+ final GLWindow glad = GLWindow.create(caps);
+ glad.setTitle("TestTextureIONEWT."+expImageType.type);
+ // Size OpenGL to Video Surface
+ glad.setSize(texData.getWidth(), texData.getHeight());
+
+ // load texture from file inside current GL context to match the way
+ // the bug submitter was doing it
+ final GLEventListener gle = glp.isGL2ES2() ? new TextureDraw01ES2Listener( texData, 0 ) : new TextureDraw01GL2Listener( texData ) ;
+ glad.addGLEventListener(gle);
+ glad.addGLEventListener(new GLEventListener() {
+ boolean shot = false;
+
+ @Override public void init(final GLAutoDrawable drawable) {}
+
+ public void display(final GLAutoDrawable drawable) {
+ // 1 snapshot
+ if(null!=((TextureDraw01Accessor)gle).getTexture() && !shot) {
+ shot = true;
+ snapshot(0, null, drawable.getGL(), screenshot, TextureIO.PNG, null);
+ }
+ }
+
+ @Override public void dispose(final GLAutoDrawable drawable) { }
+ @Override public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { }
+ });
+
+ final Animator animator = new Animator(glad);
+ animator.setUpdateFPSFrames(60, null);
+ final QuitAdapter quitAdapter = new QuitAdapter();
+ glad.addKeyListener(quitAdapter);
+ glad.addWindowListener(quitAdapter);
+ glad.setVisible(true);
+ animator.start();
+
+ while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) {
+ Thread.sleep(100);
+ }
+
+ animator.stop();
+ glad.destroy();
+ }
+
+ @Test
+ public void test01AllPNG() throws InterruptedException, IOException {
+ testImpl(imageTstFiles.pngStreams, new ImageType(ImageType.T_PNG));
+ }
+
+ @Test
+ public void test02AllJPG() throws InterruptedException, IOException {
+ testImpl(imageTstFiles.jpgStreams, new ImageType(ImageType.T_JPG));
+ }
+
+ @Test
+ public void test03AllTGA() throws InterruptedException, IOException {
+ testImpl(imageTstFiles.tgaStreams, new ImageType(ImageType.T_TGA));
+ }
+
+ @Test
+ public void test04AllDDS() throws InterruptedException, IOException {
+ testImpl(imageTstFiles.ddsStreams, new ImageType(ImageType.T_DDS));
+ }
+
+ public static void main(final String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ i++;
+ duration = MiscUtils.atol(args[i], duration);
+ }
+ }
+ org.junit.runner.JUnitCore.main(TestTextureIONEWT.class.getName());
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestBug1211IRQ00NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestBug1211IRQ00NEWT.java
new file mode 100644
index 000000000..186c3a79a
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestBug1211IRQ00NEWT.java
@@ -0,0 +1,324 @@
+/**
+ * Copyright 2015 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.newt;
+
+import java.io.IOException;
+
+import org.junit.Assert;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.common.ExceptionUtils;
+import com.jogamp.common.util.InterruptSource;
+import com.jogamp.common.util.SourcedInterruptedException;
+import com.jogamp.common.util.VersionUtil;
+import com.jogamp.junit.util.SingletonJunitCase;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.util.EDTUtil;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+import com.jogamp.opengl.util.Animator;
+
+/**
+ * Unit test to identify Thread.interrupt() caller for DefaultEDTUtil.invokeImpl(..) wait interruption.
+ * <ul>
+ * <li>resize</li>
+ * <li>create/destroy</li>
+ * </ul>
+ */
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestBug1211IRQ00NEWT extends SingletonJunitCase {
+ static long durationTest00 = 1000; // ms
+ static long durationTest01 = 1000; // ms
+ static int width = 800;
+ static int height = 600;
+
+ static GLWindow createWindow(final GLCapabilitiesImmutable caps) {
+ Assert.assertNotNull(caps);
+ //
+ // Create native windowing resources .. X11/Win/OSX
+ //
+ final GLWindow glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+ glWindow.setSize(width, height);
+
+ glWindow.setUpdateFPSFrames(1, null);
+
+ final GearsES2 demo = new GearsES2();
+ demo.setVerbose(false);
+ glWindow.addGLEventListener(demo);
+
+ return glWindow;
+ }
+
+ static void destroyWindow(final GLWindow glWindow) throws InterruptedException {
+ if(null!=glWindow) {
+ glWindow.destroy();
+ Assert.assertEquals(false,glWindow.isNativeValid());
+ }
+ }
+
+ static class MyThread extends InterruptSource.Thread implements Thread.UncaughtExceptionHandler {
+ volatile boolean myThreadStarted = false;
+ volatile boolean myThreadStopped = false;
+
+ public MyThread(final Runnable target, final String name) {
+ super(null, target, name);
+ setUncaughtExceptionHandler(this);
+ }
+
+ public static void testInterrupted1() throws InterruptedException {
+ if( java.lang.Thread.interrupted() ) {
+ throw SourcedInterruptedException.wrap(
+ new InterruptedException(java.lang.Thread.currentThread().getName()+".testInterrupted -> TRUE (silent interruption)"));
+ }
+ }
+ public synchronized void testInterrupted(final boolean ignore) throws InterruptedException {
+ if( isInterrupted() ) {
+ final boolean current;
+ if( this == java.lang.Thread.currentThread() ) {
+ java.lang.Thread.interrupted(); // clear!
+ current = true;
+ } else {
+ current = false;
+ }
+ final int counter = getInterruptCounter(false);
+ final Throwable source = getInterruptSource(true);
+ final InterruptedException e = new SourcedInterruptedException(
+ getName()+".testInterrupted -> TRUE (current "+current+", counter "+counter+")",
+ null, source);
+ if( !ignore ) {
+ throw e;
+ } else {
+ ExceptionUtils.dumpThrowable("Ignored", e);
+ }
+ }
+ }
+
+ @Override
+ public void run() {
+ myThreadStarted = true;
+ try {
+ super.run();
+ } finally {
+ myThreadStopped = true;
+ }
+ }
+
+ @Override
+ public void uncaughtException(final java.lang.Thread t, final Throwable e) {
+ System.err.println("UncaughtException on Thread "+t.getName()+": "+e.getMessage());
+ ExceptionUtils.dumpThrowable("UncaughtException", e);
+ }
+ }
+
+
+ volatile boolean interrupt1 = false;
+ volatile boolean interrupt2 = false;
+ volatile boolean interruptInit0 = false;
+
+ public void initTest() {
+ interrupt1 = false;
+ interrupt2 = false;
+ }
+
+ /**
+ * Test whether resize triggers DefaultEDTUtil.invokeImpl(..) wait interruption.
+ */
+ public void subTest00() {
+ final MyThread t = (MyThread)Thread.currentThread();
+ final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ Assert.assertNotNull(caps);
+ final GLWindow window1 = createWindow(caps); // local
+ final EDTUtil edt = window1.getScreen().getDisplay().getEDTUtil();
+ final Animator anim = new Animator(window1);
+ try {
+ window1.setVisible(true);
+ Assert.assertEquals(true,window1.isVisible());
+ Assert.assertEquals(true,window1.isNativeValid());
+ anim.start();
+ boolean ok = true;
+ for(int i=0; ok && i*100<durationTest00; i++) {
+ Thread.sleep(100);
+ final int ow = window1.getWidth();
+ final int oh = window1.getHeight();
+ final int nw, nh;
+ if( 0 == i % 2 ) {
+ nw = ow + 100;
+ nh = oh + 100;
+ } else {
+ nw = ow - 100;
+ nh = oh - 100;
+ }
+ System.err.println("test00.resize["+i+"]: "+ow+"x"+oh+" -> "+nw+"x"+nh);
+ window1.setSize(nw, nh);
+ ok = 0==t.getInterruptCounter(false) && !t.isInterrupted() && edt.isRunning() && anim.isAnimating();
+ t.testInterrupted(false);
+ }
+ } catch (final InterruptedException e) {
+ ExceptionUtils.dumpThrowable("InterruptedException-1", e);
+ interrupt1 = true;
+ }
+ try {
+ anim.stop();
+ destroyWindow(window1);
+ t.testInterrupted(false);
+ } catch (final InterruptedException e) {
+ ExceptionUtils.dumpThrowable("InterruptedException-2", e);
+ interrupt2 = true;
+ }
+ Assert.assertEquals("interruptCounter not zero", 0, t.getInterruptCounter(false));
+ Assert.assertFalse("interrupt() occured!", t.isInterrupted());
+ Assert.assertFalse("Interrupt-1 occured!", interrupt1);
+ Assert.assertFalse("Interrupt-2 occured!", interrupt2);
+ }
+
+ /**
+ * Test whether create/destroy triggers DefaultEDTUtil.invokeImpl(..) wait interruption.
+ */
+ public void subTest01() {
+ final MyThread t = (MyThread)Thread.currentThread();
+ GLWindow lastWindow = null;
+ try {
+ final boolean ok = true;
+ for(int i=0; ok && i*100<durationTest01; i++) {
+ final GLCapabilities caps = new GLCapabilities(GLProfile.getDefault());
+ Assert.assertNotNull(caps);
+ final GLWindow window1 = createWindow(caps); // local
+ lastWindow = window1;
+ window1.setVisible(true);
+ Assert.assertEquals(true,window1.isVisible());
+ Assert.assertEquals(true,window1.isNativeValid());
+ System.err.println("test01.create["+i+"]: "+window1.getStateMaskString()+", "+window1.getWidth()+"x"+window1.getHeight());
+ final Animator anim = new Animator(window1);
+ anim.start();
+ Thread.sleep(100);
+ anim.stop();
+ destroyWindow(window1);
+ t.testInterrupted(false);
+ }
+ } catch (final InterruptedException e) {
+ ExceptionUtils.dumpThrowable("InterruptedException-1", e);
+ interrupt1 = true;
+ }
+ try {
+ destroyWindow(lastWindow);
+ t.testInterrupted(false);
+ } catch (final InterruptedException e) {
+ ExceptionUtils.dumpThrowable("InterruptedException-2", e);
+ interrupt2 = true;
+ }
+ Assert.assertEquals("interruptCounter not zero", 0, t.getInterruptCounter(false));
+ Assert.assertFalse("interrupt() occured!", t.isInterrupted());
+ Assert.assertFalse("Interrupt-1 occured!", interrupt1);
+ Assert.assertFalse("Interrupt-2 occured!", interrupt2);
+ }
+
+ @Test
+ public void testAll() {
+ interruptInit0 = false;
+ final MyThread t = new MyThread(new Runnable() {
+ public void run() {
+ final MyThread t = (MyThread)Thread.currentThread();
+ TestBug1211IRQ00NEWT test = null;
+ try {
+ System.err.println(VersionUtil.getPlatformInfo());
+ GLProfile.initSingleton();
+ test = new TestBug1211IRQ00NEWT();
+ t.testInterrupted(false);
+ } catch (final InterruptedException e) {
+ ExceptionUtils.dumpThrowable("InterruptedException-Init0", e);
+ interruptInit0 = true;
+ test = null;
+ }
+ t.clearInterruptSource();
+ if( null != test ) {
+ test.initTest();
+ test.subTest00();
+
+ test.initTest();
+ test.subTest01();
+ }
+ }
+ }, "MyMainThread");
+ t.start();
+ boolean interrupted = false;
+ try {
+ MyThread.testInterrupted1();
+ while( !t.myThreadStarted ) {
+ Thread.yield();
+ MyThread.testInterrupted1();
+ }
+ while( !t.myThreadStopped ) {
+ Thread.yield();
+ MyThread.testInterrupted1();
+ }
+ MyThread.testInterrupted1();
+ } catch (final InterruptedException e) {
+ ExceptionUtils.dumpThrowable("InterruptedException-All", e);
+ interrupted = true;
+ }
+ Assert.assertFalse("Thread Interrupt-All occured!", interrupted);
+ Assert.assertFalse("Interrupt-Init0 occured!", interruptInit0);
+ }
+
+ static int atoi(final String a) {
+ int i=0;
+ try {
+ i = Integer.parseInt(a);
+ } catch (final Exception ex) { ex.printStackTrace(); }
+ return i;
+ }
+
+ public static void main(final String args[]) throws IOException {
+ // We like to allow concurrent manual tests!
+ SingletonJunitCase.enableSingletonLock(false);
+
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time00")) {
+ durationTest00 = atoi(args[++i]);
+ } else if(args[i].equals("-time01")) {
+ durationTest01 = atoi(args[++i]);
+ } else if(args[i].equals("-width")) {
+ width = atoi(args[++i]);
+ } else if(args[i].equals("-height")) {
+ height = atoi(args[++i]);
+ }
+ }
+ System.out.println("durationTest00: "+durationTest00);
+ System.out.println("durationTest01: "+durationTest01);
+ System.out.println("defaultSize : "+width+"x"+height);
+ final String tstname = TestBug1211IRQ00NEWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+}
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..c6dc81342 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.NewtTestUtil;
+import com.jogamp.opengl.test.junit.util.TestUtil;
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 {
@@ -112,11 +113,12 @@ public class TestCloseNewtAWT extends UITestCase {
frame.setVisible(true);
}
});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(newtWindow, true));
- final WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(frame);
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ final GLWindow obj = newtWindow;
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(obj, true, null));
+ final TestUtil.WindowClosingListener closingListener = AWTRobotUtil.addClosingListener(frame);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true, closingListener));
+ Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true, closingListener, null));
}
public static void main(final String[] args) {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java
index 4426a087b..62e3df992 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestDisplayLifecycle02NEWT.java
@@ -43,9 +43,9 @@ import com.jogamp.newt.opengl.*;
import java.io.IOException;
-import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@@ -147,8 +147,8 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
// destruction.. ref count down, but keep all
window.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
Assert.assertEquals(screen,window.getScreen());
Assert.assertEquals(0,Display.getActiveDisplayNumber());
@@ -195,8 +195,8 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
System.err.println("duration: "+window.getTotalFPSDuration());
window.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
Assert.assertEquals(screen,window.getScreen());
Assert.assertEquals(false,window.isNativeValid());
@@ -300,7 +300,7 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
// destruction ...
window1.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window1, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window1, false, null));
Assert.assertNotNull(window1.getScreen());
Assert.assertEquals(false,window1.isNativeValid());
@@ -317,8 +317,8 @@ public class TestDisplayLifecycle02NEWT extends UITestCase {
// destruction
window2.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window2, false));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window2, false, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
Assert.assertNotNull(window2.getScreen());
Assert.assertEquals(false,window2.isNativeValid());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java
index 9dd96acdd..38620ad92 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows00NEWT.java
@@ -49,6 +49,8 @@ import com.jogamp.nativewindow.AbstractGraphicsDevice;
public class TestGLWindows00NEWT extends UITestCase {
static GLProfile glp;
static int width, height;
+ static boolean manual = false;
+ static int loopVisibleToggle = 10;
static long durationPerTest = 100; // ms
@BeforeClass
@@ -58,7 +60,7 @@ public class TestGLWindows00NEWT extends UITestCase {
glp = GLProfile.getDefault();
}
- static GLWindow createWindow(final Screen screen, final GLCapabilitiesImmutable caps)
+ static GLWindow createWindow(final Screen screen, final GLCapabilitiesImmutable caps, final boolean undecor)
throws InterruptedException
{
Assert.assertNotNull(caps);
@@ -78,7 +80,9 @@ public class TestGLWindows00NEWT extends UITestCase {
final GLEventListener demo = new GearsES2();
glWindow.addGLEventListener(demo);
+ glWindow.setUndecorated(undecor);
glWindow.setSize(512, 512);
+ System.err.println("XXX VISIBLE.0 -> TRUE");
glWindow.setVisible(true);
Assert.assertEquals(true,glWindow.isVisible());
Assert.assertEquals(true,glWindow.isNativeValid());
@@ -90,25 +94,103 @@ public class TestGLWindows00NEWT extends UITestCase {
if(null!=glWindow) {
glWindow.destroy();
Assert.assertEquals(false,glWindow.isNativeValid());
+ Assert.assertEquals(false,glWindow.isVisible());
}
}
@Test
- public void testWindow00() throws InterruptedException {
+ public void test01WindowCreateSimple() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
- final GLWindow window1 = createWindow(null, caps); // local
- Assert.assertEquals(true,window1.isNativeValid());
- Assert.assertEquals(true,window1.isVisible());
- final AbstractGraphicsDevice device1 = window1.getScreen().getDisplay().getGraphicsDevice();
+ final GLWindow window = createWindow(null, caps, false /* undecor */); // local
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+ final AbstractGraphicsDevice device1 = window.getScreen().getDisplay().getGraphicsDevice();
System.err.println("GLProfiles window1: "+device1.getConnection()+": "+GLProfile.glAvailabilityToString(device1));
for(int state=0; state*100<durationPerTest; state++) {
Thread.sleep(100);
}
- destroyWindow(window1);
+ destroyWindow(window);
+ }
+
+ @Test
+ public void test02WindowCreateUndecor() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
+ final GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ final GLWindow window = createWindow(null, caps, true /* undecor */); // local
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+
+ final AbstractGraphicsDevice device1 = window.getScreen().getDisplay().getGraphicsDevice();
+ System.err.println("GLProfiles window1: "+device1.getConnection()+": "+GLProfile.glAvailabilityToString(device1));
+
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+
+ destroyWindow(window);
+ }
+
+ @Test
+ public void test11WindowSimpleToggleVisibility() throws InterruptedException {
+ test1xWindowToggleVisibility(false /* undecor */, loopVisibleToggle);
+ }
+ @Test
+ public void test12WindowUndecorToggleVisibility() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
+ test1xWindowToggleVisibility(true /* undecor */, loopVisibleToggle);
+ }
+ private void test1xWindowToggleVisibility(final boolean undecor, final int loopVisibleToggle) throws InterruptedException {
+ final GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ final GLWindow window = createWindow(null, caps, undecor); // local
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+
+ window.display();
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+
+ for(int i=1; i<=loopVisibleToggle; i++) {
+ System.err.println("XXX VISIBLE."+i+" -> FALSE");
+ window.setVisible(false);
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+
+ window.display();
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+
+ System.err.println("XXX VISIBLE."+i+" -> TRUE");
+ window.setVisible(true);
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+ window.display();
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+ }
+
+ destroyWindow(window);
}
static int atoi(final String a) {
@@ -123,6 +205,10 @@ public class TestGLWindows00NEWT extends UITestCase {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
durationPerTest = atoi(args[++i]);
+ } else if(args[i].equals("-loopvt")) {
+ loopVisibleToggle = atoi(args[++i]);
+ } else if(args[i].equals("-manual")) {
+ manual = true;
}
}
System.out.println("durationPerTest: "+durationPerTest);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java
index ab8304504..00b31f400 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindows01NEWT.java
@@ -59,8 +59,7 @@ public class TestGLWindows01NEWT extends UITestCase {
}
static GLWindow createWindow(final Screen screen, final GLCapabilities caps,
- final int width, final int height, final boolean onscreen, final boolean undecorated,
- final boolean addGLEventListenerAfterVisible)
+ final int width, final int height, final boolean onscreen, final boolean addGLEventListenerAfterVisible)
throws InterruptedException
{
Assert.assertNotNull(caps);
@@ -79,7 +78,6 @@ public class TestGLWindows01NEWT extends UITestCase {
Assert.assertNotNull(glWindow);
}
- glWindow.setUndecorated(onscreen && undecorated);
Assert.assertEquals(false,glWindow.isVisible());
Assert.assertEquals(false,glWindow.isNativeValid());
@@ -122,16 +120,47 @@ public class TestGLWindows01NEWT extends UITestCase {
if(null!=glWindow) {
glWindow.destroy();
Assert.assertEquals(false,glWindow.isNativeValid());
+ Assert.assertEquals(false,glWindow.isVisible());
}
}
+
+ @Test
+ public void test01WindowSimple() throws InterruptedException {
+ final GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ final GLWindow window = createWindow(null, caps, width, height,
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
+ System.out.println("Created: "+window);
+ int state;
+ for(state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+ System.out.println("duration: "+window.getTotalFPSDuration());
+ destroyWindow(window);
+ }
+
+ @Test
+ public void test02WindowSimple() throws InterruptedException {
+ final GLCapabilities caps = new GLCapabilities(glp);
+ Assert.assertNotNull(caps);
+ final GLWindow window = createWindow(null, caps, width, height,
+ true /* onscreen */, true /*addGLEventListenerAfterVisible*/);
+ System.out.println("Created: "+window);
+ int state;
+ for(state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+ System.out.println("duration: "+window.getTotalFPSDuration());
+ destroyWindow(window);
+ }
+
@Test
- public void testWindowNativeRecreate01aSimple() throws InterruptedException {
+ public void test10WindowNativeRecreateSimple() throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
final GLWindow window = createWindow(null, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
@@ -155,12 +184,11 @@ public class TestGLWindows01NEWT extends UITestCase {
}
@Test
- public void testWindowNativeRecreate01bSimple() throws InterruptedException {
+ public void test11WindowNativeRecreateSimple() throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
final GLWindow window = createWindow(null, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- true /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, true /*addGLEventListenerAfterVisible*/);
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
@@ -184,44 +212,11 @@ public class TestGLWindows01NEWT extends UITestCase {
}
@Test
- public void testWindowDecor01aSimple() throws InterruptedException {
- final GLCapabilities caps = new GLCapabilities(glp);
- Assert.assertNotNull(caps);
- final GLWindow window = createWindow(null, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
- System.out.println("Created: "+window);
- int state;
- for(state=0; state*100<durationPerTest; state++) {
- Thread.sleep(100);
- }
- System.out.println("duration: "+window.getTotalFPSDuration());
- destroyWindow(window);
- }
-
- @Test
- public void testWindowDecor01bSimple() throws InterruptedException {
- final GLCapabilities caps = new GLCapabilities(glp);
- Assert.assertNotNull(caps);
- final GLWindow window = createWindow(null, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- true /*addGLEventListenerAfterVisible*/);
- System.out.println("Created: "+window);
- int state;
- for(state=0; state*100<durationPerTest; state++) {
- Thread.sleep(100);
- }
- System.out.println("duration: "+window.getTotalFPSDuration());
- destroyWindow(window);
- }
-
- @Test
- public void testWindowDecor02DestroyWinTwiceA() throws InterruptedException {
+ public void test21WindowDestroyWinTwiceA() throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
final GLWindow window = createWindow(null, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
int state;
for(state=0; state*100<durationPerTest; state++) {
Thread.sleep(100);
@@ -231,7 +226,7 @@ public class TestGLWindows01NEWT extends UITestCase {
}
@Test
- public void testWindowDecor03TwoWinOneDisplay() throws InterruptedException {
+ public void test22WindowTwoWinOneDisplay() throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
@@ -241,13 +236,11 @@ public class TestGLWindows01NEWT extends UITestCase {
final Screen screen = NewtFactory.createScreen(display, 0); // screen 0
Assert.assertNotNull(screen);
final GLWindow window1 = createWindow(screen, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
Assert.assertNotNull(window1);
final GLWindow window2 = createWindow(screen, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
Assert.assertNotNull(window2);
Assert.assertEquals(1,Display.getActiveDisplayNumber());
@@ -281,7 +274,7 @@ public class TestGLWindows01NEWT extends UITestCase {
}
@Test
- public void testWindowDecor03TwoWinTwoDisplays() throws InterruptedException {
+ public void test23WindowTwoWinTwoDisplays() throws InterruptedException {
final GLCapabilities caps = new GLCapabilities(glp);
Assert.assertNotNull(caps);
@@ -294,15 +287,13 @@ public class TestGLWindows01NEWT extends UITestCase {
final Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0
Assert.assertNotNull(screen1);
final GLWindow window1 = createWindow(screen1, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
Assert.assertNotNull(window1);
final Screen screen2 = NewtFactory.createScreen(display2, 0); // screen 0
Assert.assertNotNull(screen2);
final GLWindow window2 = createWindow(screen2, caps, width, height,
- true /* onscreen */, false /* undecorated */,
- false /*addGLEventListenerAfterVisible*/);
+ true /* onscreen */, false /*addGLEventListenerAfterVisible*/);
Assert.assertNotNull(window2);
Assert.assertEquals(2,Display.getActiveDisplayNumber());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestMultipleNewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestMultipleNewtCanvasAWT.java
index 2220fbcd9..1817334e8 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestMultipleNewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestMultipleNewtCanvasAWT.java
@@ -135,9 +135,9 @@ public class TestMultipleNewtCanvasAWT extends UITestCase {
}
});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(openGLComponent1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(openGLComponent2, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(openGLComponent1, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(openGLComponent2, true, null));
animator.start();
@@ -157,9 +157,9 @@ public class TestMultipleNewtCanvasAWT extends UITestCase {
frame.dispose();
}
});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(openGLComponent1, false));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(openGLComponent2, false));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(openGLComponent1, false, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(openGLComponent2, false, null));
}
static int atoi(final String a) {
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java
index 0ef554ec2..8e2d191b2 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowAndPointerIconNEWT.java
@@ -46,8 +46,8 @@ import com.jogamp.newt.Display;
import com.jogamp.newt.Display.PointerIcon;
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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.QuitAdapter;
import com.jogamp.opengl.util.Animator;
import com.jogamp.opengl.util.AnimatorBase;
@@ -94,7 +94,7 @@ public class TestWindowAndPointerIconNEWT extends SingletonJunitCase {
final int idx = 0;
{
PointerIcon _pointerIcon = null;
- final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "arrow-red-alpha-64x64.png" } );
+ final IOUtil.ClassResources res = new IOUtil.ClassResources(new String[] { "arrow-red-alpha-64x64.png" }, glWindow.getClass().getClassLoader(), null);
try {
_pointerIcon = disp.createPointerIcon(res, 0, 0);
System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
@@ -126,7 +126,7 @@ public class TestWindowAndPointerIconNEWT extends SingletonJunitCase {
glWindow.destroy();
if( NativeWindowFactory.isAWTAvailable() ) {
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null));
}
}
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..8cf7c500e 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);
@@ -68,8 +69,8 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
frame.validate();
frame.setVisible(true);
} });
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true, null));
//
// close with op: DO_NOTHING_ON_CLOSE -> NOP (default)
@@ -77,7 +78,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
WindowClosingMode op = glCanvas.getDefaultCloseOperation();
Assert.assertEquals(WindowClosingMode.DO_NOTHING_ON_CLOSE, op);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, closingListener)); // nop
+ Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, closingListener, null)); // nop
Thread.sleep(100);
Assert.assertEquals(true, frame.isDisplayable());
Assert.assertEquals(true, frame.isVisible());
@@ -95,7 +96,7 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
Thread.sleep(300);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, closingListener)); // no frame close, but GLCanvas's GL resources will be destroyed
+ Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, closingListener, null)); // no frame close, but GLCanvas's GL resources will be destroyed
Thread.sleep(100);
Assert.assertEquals(true, frame.isDisplayable());
Assert.assertEquals(true, frame.isVisible());
@@ -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);
@@ -129,8 +130,8 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
frame.validate();
frame.setVisible(true);
} });
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true, null));
//
// close with op: DO_NOTHING_ON_CLOSE -> NOP / HIDE (default)
@@ -141,8 +142,8 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
Thread.sleep(300);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, closingListener)); // hide
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false)); // hide -> invisible
+ Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, closingListener, null)); // hide
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false, null)); // hide -> invisible
Assert.assertEquals(true, frame.isDisplayable());
Assert.assertEquals(false, frame.isVisible());
Assert.assertEquals(true, glCanvas.isValid());
@@ -152,8 +153,8 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
public void run() {
frame.setVisible(true);
} });
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, true, null));
Assert.assertEquals(true, frame.isDisplayable());
Assert.assertEquals(true, frame.isVisible());
@@ -165,8 +166,8 @@ public class TestWindowClosingProtocol01AWT extends UITestCase {
op = glCanvas.getDefaultCloseOperation();
Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true, closingListener));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, false));
+ Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true, closingListener, null));
+ Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas, false, null));
Assert.assertEquals(false, frame.isDisplayable());
Assert.assertEquals(false, glCanvas.isValid());
Assert.assertEquals(false, glCanvas.isDisplayable());
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..232d333c3 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindowClosingProtocol02NEWT.java
@@ -44,7 +44,8 @@ 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.NewtTestUtil;
+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 = NewtTestUtil.addClosingListener(glWindow);
glWindow.addGLEventListener(new GearsES2());
glWindow.setSize(512, 512);
@@ -75,7 +76,7 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase {
Thread.sleep(300);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(glWindow, false, closingListener)); // nop
+ Assert.assertEquals(true, NewtTestUtil.closeWindow(glWindow, false, closingListener, null)); // nop
Assert.assertEquals(true, glWindow.isNativeValid());
Assert.assertEquals(true, closingListener.isWindowClosing());
closingListener.reset();
@@ -87,7 +88,7 @@ public class TestWindowClosingProtocol02NEWT extends UITestCase {
op = glWindow.getDefaultCloseOperation();
Assert.assertEquals(WindowClosingMode.DISPOSE_ON_CLOSE, op);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(glWindow, true, closingListener));
+ Assert.assertEquals(true, NewtTestUtil.closeWindow(glWindow, true, closingListener, null));
Assert.assertEquals(false, glWindow.isNativeValid());
Assert.assertEquals(true, closingListener.isWindowClosing());
}
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..24a6c58bf 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.NewtTestUtil;
+import com.jogamp.opengl.test.junit.util.TestUtil;
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 = NewtTestUtil.addClosingListener(glWindow);
glWindow.addGLEventListener(new GearsES2());
@@ -75,8 +76,8 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
frame.validate();
frame.setVisible(true);
} });
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, true, null));
Assert.assertEquals(true, frame.isDisplayable());
Assert.assertEquals(true, frame.isVisible());
Assert.assertEquals(true, newtCanvas.isValid());
@@ -94,8 +95,8 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
Thread.sleep(300);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, awtClosingListener)); // hide
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false)); // hide -> invisible
+ Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, false, awtClosingListener, null)); // hide
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, false, null)); // hide -> invisible
Assert.assertEquals(true, frame.isDisplayable());
Assert.assertEquals(false, frame.isVisible());
Assert.assertEquals(true, newtCanvas.isValid());
@@ -112,8 +113,8 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
public void run() {
frame.setVisible(true);
} });
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true, null));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, true, null));
Assert.assertEquals(true, frame.isDisplayable());
Assert.assertEquals(true, frame.isVisible());
@@ -129,8 +130,8 @@ public class TestWindowClosingProtocol03NewtAWT extends UITestCase {
Thread.sleep(300);
- Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true, awtClosingListener));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, false));
+ Assert.assertEquals(true, AWTRobotUtil.closeWindow(frame, true, awtClosingListener, null));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, false, null));
Assert.assertEquals(false, frame.isDisplayable());
Assert.assertEquals(false, frame.isVisible());
Assert.assertEquals(false, newtCanvas.isValid());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows02NEWT.java
new file mode 100644
index 000000000..5cdb7e118
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows02NEWT.java
@@ -0,0 +1,158 @@
+/**
+ * Copyright 2010 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.newt;
+
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+import com.jogamp.nativewindow.*;
+
+import com.jogamp.newt.*;
+import java.io.IOException;
+
+import com.jogamp.opengl.test.junit.util.MiscUtils;
+import com.jogamp.opengl.test.junit.util.UITestCase;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class TestWindows02NEWT extends UITestCase {
+ static int width, height;
+ static long durationPerTest = 100; // ms
+
+ @BeforeClass
+ public static void initClass() {
+ NativeWindowFactory.initSingleton();
+ width = 800;
+ height = 600;
+ }
+
+ static Window createWindow(final Capabilities caps, final int x, final int y, final int width, final int height, final boolean onscreen, final boolean undecorated) throws InterruptedException {
+ final boolean userPos = x>=0 && y>=0 ; // user has specified a position
+
+ Assert.assertNotNull(caps);
+ caps.setOnscreen(onscreen);
+ // System.out.println("Requested: "+caps);
+
+ //
+ // Create native windowing resources .. X11/Win/OSX
+ //
+ final Window window = NewtFactory.createWindow(caps);
+ Assert.assertNotNull(window);
+ final Screen screen = window.getScreen();
+ final Display display = screen.getDisplay();
+ window.setUndecorated(onscreen && undecorated);
+ if(userPos) {
+ window.setPosition(x, y);
+ }
+ window.setSize(width, height);
+ Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+ window.setVisible(true);
+ // System.err.println("************* Created: "+window);
+
+ Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertEquals(true,screen.isNativeValid());
+ Assert.assertEquals(true,window.isVisible());
+ Assert.assertEquals(true,window.isNativeValid());
+ Assert.assertEquals(width, window.getWidth());
+ Assert.assertEquals(height, window.getHeight());
+
+ final CapabilitiesImmutable chosenCapabilities = window.getGraphicsConfiguration().getChosenCapabilities();
+ Assert.assertNotNull(chosenCapabilities);
+ Assert.assertTrue(chosenCapabilities.getGreenBits()>=5);
+ Assert.assertTrue(chosenCapabilities.getBlueBits()>=5);
+ Assert.assertTrue(chosenCapabilities.getRedBits()>=5);
+ Assert.assertEquals(chosenCapabilities.isOnscreen(),onscreen);
+
+ return window;
+ }
+
+ static void destroyWindow(final Window window, final boolean last) {
+ if(null==window) {
+ return;
+ }
+ final Screen screen = window.getScreen();
+ final Display display = screen.getDisplay();
+ window.destroy();
+ // System.err.println("************* Destroyed: "+window);
+ if(last) {
+ Assert.assertEquals(false,screen.isNativeValid());
+ Assert.assertEquals(false,display.isNativeValid());
+ } else {
+ Assert.assertEquals(true,screen.isNativeValid());
+ Assert.assertEquals(true,display.isNativeValid());
+ }
+ Assert.assertEquals(false,window.isNativeValid());
+ Assert.assertEquals(false,window.isVisible());
+ }
+
+
+ @Test
+ public void test01WindowDefault() throws InterruptedException {
+ final Capabilities caps = new Capabilities();
+ Assert.assertNotNull(caps);
+
+ final Window window = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */);
+ final CapabilitiesImmutable chosenCapabilities = window.getGraphicsConfiguration().getChosenCapabilities();
+ System.err.println("XXX: "+chosenCapabilities);
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+ destroyWindow(window, true);
+ }
+
+ @Test
+ public void test02WindowDefault() throws InterruptedException {
+ final Capabilities caps = new Capabilities();
+ Assert.assertNotNull(caps);
+ caps.setBackgroundOpaque(false);
+
+ final Window window = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */);
+ final CapabilitiesImmutable chosenCapabilities = window.getGraphicsConfiguration().getChosenCapabilities();
+ System.err.println("XXX: "+chosenCapabilities);
+ for(int state=0; state*100<durationPerTest; state++) {
+ Thread.sleep(100);
+ }
+ destroyWindow(window, true);
+ }
+
+ public static void main(final String args[]) throws IOException {
+ for(int i=0; i<args.length; i++) {
+ if(args[i].equals("-time")) {
+ durationPerTest = MiscUtils.atol(args[++i], durationPerTest);
+ }
+ }
+ System.out.println("durationPerTest: "+durationPerTest);
+ final String tstname = TestWindows02NEWT.class.getName();
+ org.junit.runner.JUnitCore.main(tstname);
+ }
+
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
index 39c6c9f4d..5f88d1c6f 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/BaseNewtEventModifiers.java
@@ -40,6 +40,7 @@ import org.junit.FixMethodOrder;
import org.junit.Test ;
import org.junit.runners.MethodSorters;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.common.util.RunnableTask;
import com.jogamp.newt.event.MouseEvent;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
@@ -344,20 +345,17 @@ public abstract class BaseNewtEventModifiers extends UITestCase {
}
_testMouseListener.setModifierCheckEnabled( true ) ;
- Throwable throwable = null;
// final Object sync = new Object();
final RunnableTask rt = new RunnableTask( testAction, null, true, System.err );
try {
// synchronized(sync) {
- new Thread(rt, "Test-Thread").start();
+ new InterruptSource.Thread(null, rt, "Test-Thread").start();
int i=0;
- while( !rt.isExecuted() && null == throwable ) {
+ while( rt.isInQueue() ) {
System.err.println("WAIT-till-done: eventDispatch() #"+i++);
eventDispatch();
}
- if(null==throwable) {
- throwable = rt.getThrowable();
- }
+ final Throwable throwable = rt.getThrowable();
if(null!=throwable) {
throw new RuntimeException(throwable);
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java
index 8cc266147..8f58ec7d9 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersAWTCanvas.java
@@ -73,9 +73,9 @@ public class TestNewtEventModifiersAWTCanvas extends BaseNewtEventModifiers {
_testFrame.setVisible( true ) ;
}
}) ;
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(_testFrame, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(canvas, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(canvas, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(_testFrame, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForVisible(canvas, true, null));
+ Assert.assertTrue(AWTRobotUtil.waitForRealized(canvas, true, null));
AWTRobotUtil.assertRequestFocusAndWait(null, canvas, canvas, null, null); // programmatic
Assert.assertNotNull(_robot);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java
index 3db61b37b..7b45e590b 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNEWTWindowAWT.java
@@ -40,6 +40,7 @@ import org.junit.runners.MethodSorters;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
/**
* Test whether or not event modifiers are properly delivered by NEWT.
@@ -61,8 +62,9 @@ public class TestNewtEventModifiersNEWTWindowAWT extends BaseNewtEventModifiers
_glWindow.setPosition(TEST_FRAME_X, TEST_FRAME_Y);
_glWindow.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForVisible(_glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(_glWindow, true));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(_glWindow, true, null));
+ final GLWindow obj = _glWindow;
+ Assert.assertTrue(NewtTestUtil.waitForRealized(obj, true, null));
AWTRobotUtil.assertRequestFocusAndWait(null, _glWindow, _glWindow, null, null); // programmatic
Assert.assertNotNull(_robot);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java
index 1d19f527f..0fb34a062 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtEventModifiersNewtCanvasAWT.java
@@ -47,6 +47,7 @@ import com.jogamp.newt.awt.NewtCanvasAWT ;
import com.jogamp.newt.opengl.GLWindow ;
import com.jogamp.opengl.test.junit.jogl.demos.es2.RedSquareES2;
import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
/**
* Test whether or not event modifiers are preserved by NEWT when
@@ -83,9 +84,10 @@ public class TestNewtEventModifiersNewtCanvasAWT extends BaseNewtEventModifiers
_testFrame.setVisible( true ) ;
}
} ) ;
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(_testFrame, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(_glWindow, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(_glWindow, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(_testFrame, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(_glWindow, true, null));
+ final GLWindow obj = _glWindow;
+ Assert.assertTrue(NewtTestUtil.waitForRealized(obj, true, null));
AWTRobotUtil.assertRequestFocusAndWait(null, _glWindow, _glWindow, null, null); // programmatic
Assert.assertNotNull(_robot);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java
index 0b96f92b9..40ae3d29d 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodeModifiersAWT.java
@@ -127,7 +127,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase {
frame1.setVisible(true);
} } );
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true, null));
testImpl(glWindow);
@@ -253,7 +253,7 @@ public class TestNewtKeyCodeModifiersAWT extends UITestCase {
glWindow1KA.setVerbose(false);
glWindow.addKeyListener(glWindow1KA);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, true, null));
// Continuous animation ..
final Animator animator = new Animator(glWindow);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java
index 60ea0e570..821063ee5 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyCodesAWT.java
@@ -122,7 +122,7 @@ public class TestNewtKeyCodesAWT extends UITestCase {
frame1.setVisible(true);
} } );
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true, null));
testImpl(glWindow);
@@ -243,7 +243,7 @@ public class TestNewtKeyCodesAWT extends UITestCase {
glWindow1KA.setVerbose(false);
glWindow.addKeyListener(glWindow1KA);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, true, null));
// Continuous animation ..
final Animator animator = new Animator(glWindow);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java
index 112a7453d..e48193ed0 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventAutoRepeatAWT.java
@@ -137,7 +137,7 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
frame1.setVisible(true);
} } );
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true, null));
testImpl(glWindow);
@@ -261,7 +261,7 @@ public class TestNewtKeyEventAutoRepeatAWT extends UITestCase {
glWindow1KA.setVerbose(false);
glWindow.addKeyListener(glWindow1KA);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, true, null));
// Continuous animation ..
final Animator animator = new Animator(glWindow);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java
index e3fa18ae4..c4fee01f0 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyEventOrderAWT.java
@@ -126,7 +126,7 @@ public class TestNewtKeyEventOrderAWT extends UITestCase {
frame1.setVisible(true);
} } );
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true, null));
testImpl(glWindow);
@@ -210,7 +210,7 @@ public class TestNewtKeyEventOrderAWT extends UITestCase {
glWindow1KA.setVerbose(false);
glWindow.addKeyListener(glWindow1KA);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, true, null));
// Continuous animation ..
final Animator animator = new Animator(glWindow);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java
index e951ba2ee..87dc1576d 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestNewtKeyPressReleaseUnmaskRepeatAWT.java
@@ -121,7 +121,7 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT extends UITestCase {
frame1.setVisible(true);
} } );
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true, null));
testImpl(glWindow);
@@ -166,7 +166,7 @@ public class TestNewtKeyPressReleaseUnmaskRepeatAWT extends UITestCase {
final SimpleKeyPressRelease simpleKeyPressRelease = new SimpleKeyPressRelease();
glWindow.addKeyListener(simpleKeyPressRelease);
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow, true));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow, true, null));
// Continuous animation ..
final Animator animator = new Animator(glWindow);
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..d3728e2be 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
@@ -147,8 +147,8 @@ public class TestParentingFocus01SwingAWTRobot extends UITestCase {
public void run() {
frame1.setVisible(true);
} } );
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame1, true, null));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow1, true, null));
AWTRobotUtil.clearAWTFocus(robot);
Assert.assertTrue(AWTRobotUtil.toFrontAndRequestFocus(robot, frame1));
@@ -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, null) ) {
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");
@@ -217,7 +217,7 @@ public class TestParentingFocus01SwingAWTRobot extends UITestCase {
Assume.assumeNoException( throwable );
}
glWindow1.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow1, false, null));
}
static int atoi(final String a) {
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..b6a95caff 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
@@ -171,8 +171,8 @@ public class TestParentingFocus02SwingAWTRobot extends UITestCase {
public void run() {
jFrame1.setVisible(true);
} } );
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(jFrame1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, true));
+ Assert.assertEquals(true, AWTRobotUtil.waitForVisible(jFrame1, true, null));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow1, true, null));
AWTRobotUtil.clearAWTFocus(robot);
Assert.assertTrue(AWTRobotUtil.toFrontAndRequestFocus(robot, jFrame1));
@@ -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, null) ) {
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, null) ) {
System.err.println("Info: Focus prev. gained, but NewtCanvasAWT didn't loose it. Gainer: "+glWindow1FA+"; Looser "+newtCanvasAWTFA);
}
@@ -280,7 +280,7 @@ public class TestParentingFocus02SwingAWTRobot extends UITestCase {
} });
glWindow1.destroy();
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow1, false, null));
}
@Test
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java
index cade05478..14cb9065e 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/event/TestParentingFocus03KeyTraversalAWT.java
@@ -53,6 +53,7 @@ import com.jogamp.opengl.*;
import com.jogamp.opengl.util.Animator;
import com.jogamp.newt.*;
import com.jogamp.newt.opengl.*;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.KeyAdapter;
import com.jogamp.newt.event.KeyEvent;
@@ -64,12 +65,19 @@ import jogamp.newt.driver.DriverClearFocus;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
import com.jogamp.opengl.test.junit.newt.parenting.NewtAWTReparentingKeyAdapter;
+import com.jogamp.opengl.test.junit.newt.parenting.NewtReparentingKeyAdapter;
/**
* Testing focus <i>key</i> traversal of an AWT component tree with {@link NewtCanvasAWT} attached.
* <p>
* {@link Frame} [ Button*, {@link NewtCanvasAWT} . {@link GLWindow} ]
* </p>
+ * <p>
+ * The demo code uses {@link NewtReparentingKeyAdapter} including {@link NEWTDemoListener} functionality.
+ * </p>
+ * <p>
+ * Manual invocation via main allows setting each tests's duration in milliseconds, e.g.{@code -duration 10000}, and many more, see {@link #main(String[])}
+ * </p>
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParentingFocus03KeyTraversalAWT extends UITestCase {
@@ -154,7 +162,7 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase {
final GLEventListener demo1 = new GearsES2(1);
setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
- glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null));
+ glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1));
glWindow1.addKeyListener(new KeyAdapter() {
public void keyReleased(final KeyEvent e) {
if( !e.isPrintableKey() || e.isAutoRepeat() ) {
@@ -203,8 +211,8 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase {
frame1.validate();
frame1.setVisible(true);
}});
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glWindow1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, true));
+ Assert.assertEquals(true, NewtTestUtil.waitForVisible(glWindow1, true, null));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow1, true, null));
Assert.assertEquals(newtCanvasAWT1.getNativeWindow(),glWindow1.getParent());
AWTRobotUtil.clearAWTFocus(robot);
Assert.assertTrue(AWTRobotUtil.toFrontAndRequestFocus(robot, frame1));
@@ -228,14 +236,14 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase {
// bWest -> glWin
AWTRobotUtil.keyType(0, robot, java.awt.event.KeyEvent.VK_TAB, cWest, null);
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA));
+ Assert.assertTrue("Did not gain focus", NewtTestUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA, null));
Assert.assertEquals(true, glWindow1FA.focusGained());
Assert.assertEquals(true, bWestFA.focusLost());
Thread.sleep(durationPerTest/numFocus);
// glWin -> bEast
AWTRobotUtil.keyType(0, robot, java.awt.event.KeyEvent.VK_TAB, glWindow1, null);
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cEast, bEastFA, glWindow1FA));
+ Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cEast, bEastFA, glWindow1FA, null));
Assert.assertEquals(true, bEastFA.focusGained());
Assert.assertEquals(true, glWindow1FA.focusLost());
Thread.sleep(durationPerTest/numFocus);
@@ -245,13 +253,13 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase {
//
// bEast -> glWin
AWTRobotUtil.keyType(0, robot, java.awt.event.KeyEvent.VK_BACK_SPACE, cEast, null);
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bEastFA));
+ Assert.assertTrue("Did not gain focus", NewtTestUtil.waitForFocus(glWindow1, glWindow1FA, bEastFA, null));
Assert.assertEquals(true, glWindow1FA.focusGained());
Assert.assertEquals(true, bEastFA.focusLost());
Thread.sleep(durationPerTest/numFocus);
AWTRobotUtil.keyType(0, robot, java.awt.event.KeyEvent.VK_BACK_SPACE, glWindow1, null);
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cWest, bWestFA, glWindow1FA));
+ Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cWest, bWestFA, glWindow1FA, null));
Assert.assertEquals(true, bWestFA.focusGained());
Assert.assertEquals(true, glWindow1FA.focusLost());
Thread.sleep(durationPerTest/numFocus);
@@ -264,7 +272,7 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase {
}
});
} catch (final Exception ex) { ex.printStackTrace(); }
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA));
+ Assert.assertTrue("Did not gain focus", NewtTestUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA, null));
Assert.assertEquals(true, glWindow1FA.focusGained());
Assert.assertEquals(true, bWestFA.focusLost());
Thread.sleep(durationPerTest/numFocus);
@@ -277,7 +285,7 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase {
}
});
} catch (final Exception ex) { ex.printStackTrace(); }
- Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cWest, bWestFA, glWindow1FA));
+ Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(cWest, bWestFA, glWindow1FA, null));
Assert.assertEquals(true, bWestFA.focusGained());
Assert.assertEquals(true, glWindow1FA.focusLost());
Thread.sleep(durationPerTest/numFocus);
@@ -287,7 +295,7 @@ public class TestParentingFocus03KeyTraversalAWT extends UITestCase {
{
// Short: Assert.assertTrue("Did not gain focus", AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA));
// More verbose:
- final boolean ok = AWTRobotUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA);
+ final boolean ok = NewtTestUtil.waitForFocus(glWindow1, glWindow1FA, bWestFA, null);
System.err.println("glWindow hasFocus "+glWindow1.hasFocus());
System.err.println("glWindow1FA "+glWindow1FA);
System.err.println("bWestFA "+bWestFA);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java
index ac8d28427..b4b640280 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00bNEWT.java
@@ -44,7 +44,7 @@ import com.jogamp.newt.Screen;
import com.jogamp.newt.MonitorMode;
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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
@@ -119,7 +119,7 @@ public class TestScreenMode00bNEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isNativeValid());
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java
index deab32e03..31a16b8c6 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode00cNEWT.java
@@ -49,8 +49,8 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import java.util.List;
@@ -110,7 +110,7 @@ public class TestScreenMode00cNEWT extends UITestCase {
static void destroyWindow(final Window window) throws InterruptedException {
if(null!=window) {
window.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, false, null));
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java
index 353856fe5..ab8ad8661 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01aNEWT.java
@@ -49,8 +49,8 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import java.util.List;
@@ -111,7 +111,7 @@ public class TestScreenMode01aNEWT extends UITestCase {
static void destroyWindow(final Window window) throws InterruptedException {
if(null!=window) {
window.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, false, null));
}
}
@@ -219,7 +219,7 @@ public class TestScreenMode01aNEWT extends UITestCase {
Assert.assertEquals(false,window0.isVisible());
Assert.assertEquals(false,window0.isNativeValid());
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java
index 29068afca..60d61f905 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java
@@ -49,8 +49,8 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
@@ -105,7 +105,7 @@ public class TestScreenMode01bNEWT extends UITestCase {
static void destroyWindow(final Window window) throws InterruptedException {
if(null!=window) {
window.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, false, null));
}
}
@@ -121,7 +121,7 @@ public class TestScreenMode01bNEWT extends UITestCase {
testScreenModeChangeImpl(screen, monitorVp.getX(), monitorVp.getY());
} finally {
screen.removeReference();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
}
}
@@ -141,7 +141,7 @@ public class TestScreenMode01bNEWT extends UITestCase {
testScreenModeChangeImpl(screen, monitorVp.getX(), monitorVp.getY());
} finally {
screen.removeReference();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java
index 06173a9f1..61a8527a7 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java
@@ -48,8 +48,8 @@ import com.jogamp.newt.Window;
import com.jogamp.newt.MonitorMode;
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.MiscUtils;
+import com.jogamp.opengl.test.junit.util.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
@@ -105,7 +105,7 @@ public class TestScreenMode01cNEWT extends UITestCase {
static void destroyWindow(final Window window) throws InterruptedException {
if(null!=window) {
window.destroy();
- AWTRobotUtil.waitForRealized(window, false); // don't override a previous assertion failure
+ NewtTestUtil.waitForRealized(window, false, null); // don't override a previous assertion failure
}
}
@@ -121,7 +121,7 @@ public class TestScreenMode01cNEWT extends UITestCase {
testScreenFullscreenImpl(screen, monitorVp.getX(), monitorVp.getY(), false, null);
} finally {
screen.removeReference();
- AWTRobotUtil.waitForRealized(screen, false); // don't override a previous assertion failure
+ NewtTestUtil.waitForRealized(screen, false, null); // don't override a previous assertion failure
}
}
@@ -141,7 +141,7 @@ public class TestScreenMode01cNEWT extends UITestCase {
testScreenFullscreenImpl(screen, monitorVp.getX(), monitorVp.getY(), false, null);
} finally {
screen.removeReference();
- AWTRobotUtil.waitForRealized(screen, false); // don't override a previous assertion failure
+ NewtTestUtil.waitForRealized(screen, false, null); // don't override a previous assertion failure
}
}
@@ -164,7 +164,7 @@ public class TestScreenMode01cNEWT extends UITestCase {
testScreenFullscreenImpl(screen, monitorVp.getX()+50, monitorVp.getY()+50, true, monitors);
} finally {
screen.removeReference();
- AWTRobotUtil.waitForRealized(screen, false); // don't override a previous assertion failure
+ NewtTestUtil.waitForRealized(screen, false, null); // don't override a previous assertion failure
}
}
@@ -184,7 +184,7 @@ public class TestScreenMode01cNEWT extends UITestCase {
testScreenFullscreenImpl(screen, monitorVp.getX()-50, monitorVp.getY()+50, true, null);
} finally {
screen.removeReference();
- AWTRobotUtil.waitForRealized(screen, false); // don't override a previous assertion failure
+ NewtTestUtil.waitForRealized(screen, false, null); // don't override a previous assertion failure
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java
index 3247b87ac..7b22dea65 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java
@@ -50,7 +50,7 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import java.util.List;
@@ -142,7 +142,7 @@ public class TestScreenMode01dNEWT extends UITestCase {
static void destroyWindow(final Window window) throws InterruptedException {
if(null!=window) {
window.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, false, null));
}
}
@@ -189,7 +189,7 @@ public class TestScreenMode01dNEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isRealized());
Assert.assertEquals(false,window.isNativeValid());
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
@@ -279,7 +279,7 @@ public class TestScreenMode01dNEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isRealized());
Assert.assertEquals(false,window.isNativeValid());
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
@@ -386,7 +386,7 @@ public class TestScreenMode01dNEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isRealized());
Assert.assertEquals(false,window.isNativeValid());
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java
index 90952f502..d512df3d7 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02aNEWT.java
@@ -50,7 +50,7 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import java.util.List;
import com.jogamp.nativewindow.util.Dimension;
@@ -92,7 +92,7 @@ public class TestScreenMode02aNEWT extends UITestCase {
static void destroyWindow(final Window window) throws InterruptedException {
if(null!=window) {
window.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, false, null));
}
}
@@ -240,7 +240,7 @@ public class TestScreenMode02aNEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isNativeValid());
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java
index 11e863217..8388a9ad0 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode02bNEWT.java
@@ -49,7 +49,7 @@ import com.jogamp.newt.MonitorMode;
import com.jogamp.newt.opengl.GLWindow;
import com.jogamp.newt.util.MonitorModeUtil;
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.NewtTestUtil;
import com.jogamp.opengl.test.junit.util.UITestCase;
import com.jogamp.opengl.util.Animator;
@@ -106,7 +106,7 @@ public class TestScreenMode02bNEWT extends UITestCase {
static void destroyWindow(final Window window) throws InterruptedException {
if(null!=window) {
window.destroy();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, false, null));
}
}
@@ -249,7 +249,7 @@ public class TestScreenMode02bNEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
Assert.assertEquals(false,window.isNativeValid());
- Assert.assertTrue(AWTRobotUtil.waitForRealized(screen, false));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(screen, false, null));
Assert.assertEquals(false,screen.isNativeValid());
Assert.assertEquals(false,display.isNativeValid());
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
index ae873eaf0..7e92c8438 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java
@@ -1,5 +1,5 @@
/**
- * Copyright 2011 JogAmp Community. All rights reserved.
+ * Copyright 2011, 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:
@@ -30,94 +30,37 @@ package com.jogamp.opengl.test.junit.newt.parenting;
import java.awt.Frame;
import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowHolder;
import com.jogamp.nativewindow.util.InsetsImmutable;
import com.jogamp.newt.Window;
-import com.jogamp.newt.awt.NewtCanvasAWT;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.test.junit.util.NEWTDemoListener;
-import com.jogamp.opengl.test.junit.util.QuitAdapter;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
-public class NewtAWTReparentingKeyAdapter extends NEWTDemoListener {
+/**
+ * AWT specializing demo functionality of {@link NewtReparentingKeyAdapter}, includes {@link NEWTDemoListener}.
+ */
+public class NewtAWTReparentingKeyAdapter extends NewtReparentingKeyAdapter {
final Frame frame;
- final NewtCanvasAWT newtCanvasAWT;
- public NewtAWTReparentingKeyAdapter(final Frame frame, final NewtCanvasAWT newtCanvasAWT, final GLWindow glWindow, final QuitAdapter quitAdapter) {
- super(glWindow, quitAdapter, null);
+ public NewtAWTReparentingKeyAdapter(final Frame frame, final NativeWindowHolder winHolder, final GLWindow glWindow) {
+ super(winHolder, glWindow);
this.frame = frame;
- this.newtCanvasAWT = newtCanvasAWT;
- }
-
- public void keyPressed(final KeyEvent e) {
- if( e.isAutoRepeat() || e.isConsumed() ) {
- return;
- }
- if( 0 == e.getModifiers() ) { // all modifiers go to super class ..
- final int keySymbol = e.getKeySymbol();
- switch (keySymbol) {
- case KeyEvent.VK_L:
- e.setConsumed(true);
- final com.jogamp.nativewindow.util.Point p0 = newtCanvasAWT.getNativeWindow().getLocationOnScreen(null);
- final com.jogamp.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null);
- printlnState("[location]", "AWT "+p0+", NEWT "+p1);
- break;
- case KeyEvent.VK_R:
- e.setConsumed(true);
- quitAdapterOff();
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- if(glWindow.getParent()==null) {
- printlnState("[reparent pre - glWin to HOME]");
- glWindow.reparentWindow(newtCanvasAWT.getNativeWindow(), -1, -1, 0 /* hints */);
- } else {
- if( null != frame ) {
- final InsetsImmutable nInsets = glWindow.getInsets();
- final java.awt.Insets aInsets = frame.getInsets();
- int dx, dy;
- if( nInsets.getTotalHeight()==0 ) {
- dx = aInsets.left;
- dy = aInsets.top;
- } else {
- dx = nInsets.getLeftWidth();
- dy = nInsets.getTopHeight();
- }
- final int topLevelX = frame.getX()+frame.getWidth()+dx;
- final int topLevelY = frame.getY()+dy;
- printlnState("[reparent pre - glWin to TOP.1]", topLevelX+"/"+topLevelY+" - insets " + nInsets + ", " + aInsets);
- glWindow.reparentWindow(null, topLevelX, topLevelY, 0 /* hint */);
- } else {
- printlnState("[reparent pre - glWin to TOP.0]");
- glWindow.reparentWindow(null, -1, -1, 0 /* hints */);
- }
- }
- printlnState("[reparent post]");
- glWindow.requestFocus();
- glWindow.setExclusiveContextThread(t);
- quitAdapterOn();
- } }.start();
- break;
- }
- }
- super.keyPressed(e);
}
@Override
public void setTitle() {
- setTitle(frame, newtCanvasAWT, glWindow);
+ setTitle(frame, winHolder.getNativeWindow(), glWindow);
}
- public static void setTitle(final Frame frame, final NewtCanvasAWT glc, final Window win) {
+ public void setTitle(final Frame frame, final NativeWindow nw, final Window win) {
final CapabilitiesImmutable chosenCaps = win.getChosenCapabilities();
final CapabilitiesImmutable reqCaps = win.getRequestedCapabilities();
final CapabilitiesImmutable caps = null != chosenCaps ? chosenCaps : reqCaps;
final String capsA = caps.isBackgroundOpaque() ? "opaque" : "transl";
{
- final java.awt.Rectangle b = glc.getBounds();
- frame.setTitle("NewtCanvasAWT["+capsA+"], win: ["+b.x+"/"+b.y+" "+b.width+"x"+b.height+"], pix: "+glc.getNativeWindow().getSurfaceWidth()+"x"+glc.getNativeWindow().getSurfaceHeight());
+ frame.setTitle("Frame["+capsA+"], win: "+getNativeWinTitle(nw));
}
- final float[] sDPI = win.getPixelsPerMM(new float[2]);
- sDPI[0] *= 25.4f;
- sDPI[1] *= 25.4f;
- win.setTitle("GLWindow["+capsA+"], win: "+win.getBounds()+", pix: "+win.getSurfaceWidth()+"x"+win.getSurfaceHeight()+", sDPI "+sDPI[0]+" x "+sDPI[1]);
+ super.setTitle(nw, win);
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtJFXReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtJFXReparentingKeyAdapter.java
new file mode 100644
index 000000000..3ed847ae3
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtJFXReparentingKeyAdapter.java
@@ -0,0 +1,102 @@
+/**
+ * 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.newt.parenting;
+
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowHolder;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.InsetsImmutable;
+import com.jogamp.newt.Window;
+import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
+
+import javafx.geometry.Bounds;
+
+/**
+ * JavaFX specializing demo functionality of {@link NewtReparentingKeyAdapter}, includes {@link NEWTDemoListener}.
+ */
+public class NewtJFXReparentingKeyAdapter extends NewtReparentingKeyAdapter {
+ final javafx.stage.Stage frame;
+
+ public NewtJFXReparentingKeyAdapter(final javafx.stage.Stage frame, final NativeWindowHolder winHolder, final GLWindow glWindow) {
+ super(winHolder, glWindow);
+ this.frame = frame;
+ }
+
+ @Override
+ public void keyPressed(final KeyEvent e) {
+ if( e.isAutoRepeat() || e.isConsumed() ) {
+ return;
+ }
+ if( 0 == e.getModifiers() ) { // all modifiers go to super class ..
+ final int keySymbol = e.getKeySymbol();
+ switch (keySymbol) {
+ case KeyEvent.VK_R:
+ e.setConsumed(true);
+ quitAdapterOff();
+ glWindow.invokeOnNewThread(null, false, new Runnable() {
+ public void run() {
+ final java.lang.Thread t = glWindow.setExclusiveContextThread(null);
+ if(glWindow.getParent()==null) {
+ printlnState("[reparent pre - glWin to HOME: child pos "+winHolder.getNativeWindow().getX()+"/"+winHolder.getNativeWindow().getY()+"]");
+ glWindow.reparentWindow(winHolder.getNativeWindow(), winHolder.getNativeWindow().getX(), winHolder.getNativeWindow().getY(), 0 /* hints */);
+ glWindow.setPosition(winHolder.getNativeWindow().getX(), winHolder.getNativeWindow().getY());
+ } else {
+ final com.jogamp.nativewindow.util.Point p0 = winHolder.getNativeWindow().getLocationOnScreen(null);
+ final com.jogamp.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null);
+ printlnState("[reparent pre - glWin to TOP.1] frame ", p0+", glWindow "+p1);
+ glWindow.reparentWindow(null, p1.getX(), p1.getY(), 0 /* hint */);
+ }
+ printlnState("[reparent post]");
+ glWindow.requestFocus();
+ glWindow.setExclusiveContextThread(t);
+ quitAdapterOn();
+ } } );
+ break;
+ }
+ }
+ super.keyPressed(e);
+ }
+
+ @Override
+ public void setTitle() {
+ setTitle(frame, winHolder.getNativeWindow(), glWindow);
+ }
+ public void setTitle(final javafx.stage.Stage frame, final NativeWindow nw, final Window win) {
+ final CapabilitiesImmutable chosenCaps = win.getChosenCapabilities();
+ final CapabilitiesImmutable reqCaps = win.getRequestedCapabilities();
+ final CapabilitiesImmutable caps = null != chosenCaps ? chosenCaps : reqCaps;
+ final String capsA = caps.isBackgroundOpaque() ? "opaque" : "transl";
+ {
+ frame.setTitle("Frame["+capsA+"], win: "+getNativeWinTitle(nw));
+ }
+ super.setTitle(nw, win);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtReparentingKeyAdapter.java
new file mode 100644
index 000000000..339230d48
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtReparentingKeyAdapter.java
@@ -0,0 +1,111 @@
+/**
+ * Copyright 2011, 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.newt.parenting;
+
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowHolder;
+import com.jogamp.newt.Window;
+import com.jogamp.newt.event.KeyEvent;
+import com.jogamp.newt.opengl.GLWindow;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
+import com.jogamp.opengl.GLAnimatorControl;
+
+/**
+ * Extending demo functionality of {@link NEWTDemoListener}
+ * <ul>
+ * <li>L: Print parent and (child) {@link GLWindow} location</li>
+ * <li>R: Toggel parenting (top-level/child)</li>
+ * </ul>
+ */
+public class NewtReparentingKeyAdapter extends NEWTDemoListener {
+ final NativeWindowHolder winHolder;
+
+ public NewtReparentingKeyAdapter(final NativeWindowHolder winHolder, final GLWindow glWindow) {
+ super(glWindow, null);
+ this.winHolder = winHolder;
+ }
+
+ @Override
+ public void keyPressed(final KeyEvent e) {
+ if( e.isAutoRepeat() || e.isConsumed() ) {
+ return;
+ }
+ if( 0 == e.getModifiers() ) { // all modifiers go to super class ..
+ final int keySymbol = e.getKeySymbol();
+ switch (keySymbol) {
+ case KeyEvent.VK_L:
+ e.setConsumed(true);
+ final com.jogamp.nativewindow.util.Point p0 = winHolder.getNativeWindow().getLocationOnScreen(null);
+ final com.jogamp.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null);
+ printlnState("[location]", "Parent "+p0+", NEWT "+p1);
+ break;
+ case KeyEvent.VK_R:
+ e.setConsumed(true);
+ quitAdapterOff();
+ glWindow.invokeOnNewThread(null, false, new Runnable() {
+ public void run() {
+ final java.lang.Thread t = glWindow.setExclusiveContextThread(null);
+ if(glWindow.getParent()==null) {
+ printlnState("[reparent pre - glWin to HOME: child pos "+winHolder.getNativeWindow().getX()+"/"+winHolder.getNativeWindow().getY()+"]");
+ glWindow.reparentWindow(winHolder.getNativeWindow(), -1, -1, 0 /* hints */);
+ } else {
+ final com.jogamp.nativewindow.util.Point p0 = winHolder.getNativeWindow().getLocationOnScreen(null);
+ final com.jogamp.nativewindow.util.Point p1 = glWindow.getLocationOnScreen(null);
+ printlnState("[reparent pre - glWin to TOP.1] frame ", p0+", glWindow "+p1);
+ glWindow.reparentWindow(null, p1.getX(), p1.getY(), 0 /* hint */);
+ }
+ printlnState("[reparent post]");
+ glWindow.requestFocus();
+ glWindow.setExclusiveContextThread(t);
+ quitAdapterOn();
+ } } );
+ break;
+ }
+ }
+ super.keyPressed(e);
+ }
+
+ @Override
+ public void setTitle() {
+ setTitle(winHolder.getNativeWindow(), glWindow);
+ }
+ String getNativeWinTitle(final NativeWindow nw) {
+ return "["+nw.getX()+"/"+nw.getY()+" "+nw.getWidth()+"x"+nw.getHeight()+"], pix: "+nw.getSurfaceWidth()+"x"+nw.getSurfaceHeight();
+ }
+ public void setTitle(final NativeWindow nw, final Window win) {
+ final CapabilitiesImmutable chosenCaps = win.getChosenCapabilities();
+ final CapabilitiesImmutable reqCaps = win.getRequestedCapabilities();
+ final CapabilitiesImmutable caps = null != chosenCaps ? chosenCaps : reqCaps;
+ final String capsA = caps.isBackgroundOpaque() ? "opaque" : "transl";
+ final float[] sDPI = win.getPixelsPerMM(new float[2]);
+ sDPI[0] *= 25.4f;
+ sDPI[1] *= 25.4f;
+ win.setTitle("GLWindow["+capsA+"], win: "+win.getBounds()+", pix: "+win.getSurfaceWidth()+"x"+win.getSurfaceHeight()+", sDPI "+sDPI[0]+" x "+sDPI[1]);
+ }
+}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
index 591ce5f4e..6e3c7c3e7 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -51,7 +51,8 @@ import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
public class TestParenting01NEWT extends UITestCase {
static int width, height;
static long durationPerTest = 600;
- static long waitAbout10FramesAt30fps = 10*34; // 10 frames @ 30fps
+ static boolean manual = false;
+ static int loopVisibleToggle = 10;
static GLCapabilities glCaps;
@BeforeClass
@@ -61,6 +62,37 @@ public class TestParenting01NEWT extends UITestCase {
glCaps = new GLCapabilities(null);
}
+ private static void waitForFrames(final String waitFor, final int prefixIdx,
+ final GLWindow glWindow1, final GLWindow glWindow2,
+ final long TO, final boolean doAssert) {
+ final long t0 = System.currentTimeMillis();
+ int a, b;
+ long t1;
+ do {
+ try { Thread.sleep(16); } catch (final InterruptedException e) { }
+ if( null != glWindow1 ) {
+ a = glWindow1.getTotalFPSFrames();
+ } else {
+ a = -1;
+ }
+ if( null != glWindow2 ) {
+ b = glWindow2.getTotalFPSFrames();
+ } else {
+ b = -1;
+ }
+ t1 = System.currentTimeMillis();
+ } while ( ( 0 == a || 0 == b ) && TO > ( t1 - t0 ) );
+ System.err.println("Frames for "+waitFor+": A"+prefixIdx+": "+a+", B"+prefixIdx+": "+b);
+ if( doAssert ) {
+ if( null != glWindow1 ) {
+ Assert.assertTrue("No frames."+prefixIdx+" displayed on window1 during "+TO+"ms", 0 < a);
+ }
+ if( null != glWindow2 ) {
+ Assert.assertTrue("No frames."+prefixIdx+" displayed on window2 during "+TO+"ms", 0 < b);
+ }
+ }
+ }
+
@Test
public void test01CreateVisibleDestroy() throws InterruptedException {
Assert.assertEquals(0,Display.getActiveDisplayNumber());
@@ -109,44 +141,43 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0,Display.getActiveDisplayNumber());
// visible test
+ for(int i=1; i<=loopVisibleToggle; i++) {
+ Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
+ Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
+ System.err.println("XXX VISIBLE."+i+" -> TRUE");
+ glWindow1.setVisible(true);
+ Assert.assertEquals(true, glWindow1.isVisible());
+ Assert.assertEquals(true, glWindow1.isNativeValid());
+ Assert.assertEquals(true, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow2.isNativeValid());
+ Assert.assertEquals(1,display.getReferenceCount());
+ Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertNotNull(display.getEDTUtil());
+ Assert.assertEquals(true,display.getEDTUtil().isRunning());
+ Assert.assertEquals(2,screen.getReferenceCount());
+ Assert.assertEquals(true,screen.isNativeValid());
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ waitForFrames("window1.setVisible(true)", 1, glWindow1, glWindow2, 2000, true);
+
+ System.err.println("XXX VISIBLE."+i+" -> FALSE");
+ glWindow1.setVisible(false);
+ Assert.assertEquals(false, glWindow1.isVisible());
+ Assert.assertEquals(true, glWindow1.isNativeValid());
+ Assert.assertEquals(false, glWindow2.isVisible());
+ Assert.assertEquals(true, glWindow2.isNativeValid());
+
+ glWindow1.resetFPSCounter();
+ glWindow2.resetFPSCounter();
+ }
Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
+ System.err.println("XXX VISIBLE.3 -> TRUE");
glWindow1.setVisible(true);
- System.err.println("Frames for setVisible(true): A1: "+glWindow1.getTotalFPSFrames()+", B1: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
-
- Assert.assertEquals(true, glWindow1.isVisible());
- Assert.assertEquals(true, glWindow1.isNativeValid());
- Assert.assertEquals(true, glWindow2.isVisible());
- Assert.assertEquals(true, glWindow2.isNativeValid());
- Assert.assertEquals(1,display.getReferenceCount());
- Assert.assertEquals(true,display.isNativeValid());
- Assert.assertNotNull(display.getEDTUtil());
- Assert.assertEquals(true,display.getEDTUtil().isRunning());
- Assert.assertEquals(2,screen.getReferenceCount());
- Assert.assertEquals(true,screen.isNativeValid());
- Assert.assertEquals(1,Display.getActiveDisplayNumber());
-
- glWindow1.setVisible(false);
- Assert.assertEquals(false, glWindow1.isVisible());
- Assert.assertEquals(true, glWindow1.isNativeValid());
- Assert.assertEquals(false, glWindow2.isVisible());
- Assert.assertEquals(true, glWindow2.isNativeValid());
-
- glWindow1.resetFPSCounter();
- glWindow2.resetFPSCounter();
- Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
- Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
- glWindow1.setVisible(true);
- System.err.println("Frames for setVisible(true): A2: "+glWindow1.getTotalFPSFrames()+", B2: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
-
Assert.assertEquals(true, glWindow1.isVisible());
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
+ waitForFrames("window1.setVisible(true)", 2, glWindow1, glWindow2, 2000, true);
glWindow1.resetFPSCounter();
glWindow2.resetFPSCounter();
@@ -165,9 +196,7 @@ public class TestParenting01NEWT extends UITestCase {
while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) {
Thread.sleep(100);
}
- System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFPSFrames()+", B3: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("animator.start()", 3, glWindow1, glWindow2, 2000, true);
Assert.assertEquals(true, animator1.pause());
Assert.assertEquals(false, animator1.isAnimating());
@@ -188,10 +217,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true, animator2.isAnimating());
Assert.assertEquals(false, animator2.isPaused());
Assert.assertNotNull(animator2.getThread());
- Thread.sleep(waitAbout10FramesAt30fps);
- System.err.println("Frames for setVisible(true): A4: "+glWindow1.getTotalFPSFrames()+", B4: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("animator.resume()", 4, glWindow1, glWindow2, 2000, true);
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
@@ -243,15 +269,13 @@ public class TestParenting01NEWT extends UITestCase {
glWindow2.resetFPSCounter();
Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
+ System.err.println("XXX VISIBLE.4 -> TRUE");
glWindow1.setVisible(true);
Assert.assertEquals(true, glWindow1.isVisible());
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
-
- System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFPSFrames()+", B3: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("window1.setVisible(true) recreate", 5, glWindow1, glWindow2, 2000, true);
Assert.assertEquals(1,display.getReferenceCount());
Assert.assertEquals(true,display.isNativeValid());
@@ -287,11 +311,17 @@ public class TestParenting01NEWT extends UITestCase {
@Test
public void test02aReparentTop2WinReparentRecreate() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
test02ReparentTop2WinImpl(true);
}
@Test
public void test02bReparentTop2WinReparentNative() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
test02ReparentTop2WinImpl(false);
}
@@ -348,12 +378,10 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true,screen1.isNativeValid());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
Assert.assertEquals(true, glWindow1.isVisible());
- System.err.println("Frames for setVisible(true) A1: "+glWindow1.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
-
+ waitForFrames("window1.setVisible(true)", 1, glWindow1, null, 2000, true);
Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
- glWindow2.setVisible(true);
+ glWindow2.setVisible(true);
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
@@ -362,8 +390,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true,screen1.isNativeValid());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
Assert.assertEquals(true, glWindow2.isVisible());
- System.err.println("Frames for setVisible(true) B1: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
+ waitForFrames("window2.setVisible(true)", 2, glWindow1, glWindow2, 2000, true);
final Animator animator1 = new Animator(glWindow1);
animator1.setUpdateFPSFrames(1, null);
@@ -405,9 +432,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertSame(glWindow1,glWindow2.getParent());
- Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("reparentWindow.child(parent, "+reparentRecreate+"), "+reparentAction, 10, glWindow1, glWindow2, 2000, true);
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
@@ -448,9 +473,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertNull(glWindow2.getParent());
- Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("reparentWindow.top(parent, "+reparentRecreate+"), "+reparentAction, 11, glWindow1, glWindow2, 2000, true);
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
@@ -523,11 +546,17 @@ public class TestParenting01NEWT extends UITestCase {
@Test
public void test03aReparentWin2TopReparentRecreate() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
test03ReparentWin2TopImpl(true);
}
@Test
public void test03bReparentWin2TopReparentNative() throws InterruptedException {
+ if( manual ) {
+ return;
+ }
test03ReparentWin2TopImpl(false);
}
@@ -579,10 +608,6 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertEquals(0, glWindow1.getTotalFPSFrames());
Assert.assertEquals(0, glWindow2.getTotalFPSFrames());
glWindow1.setVisible(true);
- System.err.println("Frames for setVisible(): A1: "+glWindow1.getTotalFPSFrames()+", B1: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow1.getTotalFPSFrames());
-
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
@@ -592,6 +617,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertSame(glWindow1,glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ waitForFrames("window1.setVisible(true)", 1, glWindow1, glWindow2, 2000, true);
final Animator animator1 = new Animator(glWindow1);
animator1.setUpdateFPSFrames(1, null);
@@ -630,9 +656,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
- Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("reparentWindow.top(parent, "+reparentRecreate+"), "+reparentAction, 10, glWindow1, glWindow2, 2000, true);
Assert.assertNull(glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());
@@ -665,9 +689,7 @@ public class TestParenting01NEWT extends UITestCase {
Assert.assertTrue(Window.ReparentOperation.ACTION_INVALID != reparentAction);
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
- Thread.sleep(20*16); // Wait for a few frames since counter could be reset - 20 frames at 60Hz
- System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B3 "+glWindow2.getTotalFPSFrames());
- Assert.assertTrue(0 < glWindow2.getTotalFPSFrames());
+ waitForFrames("reparentWindow.child(parent, "+reparentRecreate+"), "+reparentAction, 11, glWindow1, glWindow2, 2000, true);
Assert.assertSame(glWindow1,glWindow2.getParent());
Assert.assertSame(screen1,glWindow2.getScreen());
@@ -759,6 +781,10 @@ public class TestParenting01NEWT extends UITestCase {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
durationPerTest = atoi(args[++i]);
+ } else if(args[i].equals("-loopvt")) {
+ loopVisibleToggle = atoi(args[++i]);
+ } else if(args[i].equals("-manual")) {
+ manual = true;
} else if(args[i].equals("-asMain")) {
asMain = true;
}
@@ -768,8 +794,8 @@ public class TestParenting01NEWT extends UITestCase {
try {
TestParenting01NEWT.initClass();
final TestParenting01NEWT m = new TestParenting01NEWT();
- m.test02aReparentTop2WinReparentRecreate();
m.test01CreateVisibleDestroy();
+ m.test02aReparentTop2WinReparentRecreate();
} catch (final Throwable t ) {
t.printStackTrace();
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java
index 3878e8ba5..b030bc5e4 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01aAWT.java
@@ -114,8 +114,8 @@ public class TestParenting01aAWT extends UITestCase {
final Animator animator1 = new Animator(glWindow1);
animator1.setUpdateFPSFrames(1, null);
animator1.start();
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow1, true));
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow1, true));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glWindow1, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glWindow1, true, null));
while(animator1.isAnimating() && animator1.getTotalFPSDuration()<durationPerTest) {
Thread.sleep(100);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
index b53da38d7..175b3c675 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01cSwingAWT.java
@@ -47,6 +47,7 @@ import javax.swing.WindowConstants;
import com.jogamp.opengl.*;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.common.util.InterruptSource;
import com.jogamp.newt.*;
import com.jogamp.newt.opengl.*;
import com.jogamp.newt.awt.NewtCanvasAWT;
@@ -140,7 +141,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
animator1.start();
final GLDisturbanceAction disturbanceAction = new GLDisturbanceAction(glWindow1);
- new Thread(disturbanceAction).start();
+ new InterruptSource.Thread(null, disturbanceAction).start();
disturbanceAction.waitUntilRunning();
final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
@@ -177,8 +178,8 @@ public class TestParenting01cSwingAWT extends UITestCase {
jFrame1.setVisible(true);
}
});
- Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glWindow1, true));
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glWindow1, true));
+ Assert.assertEquals(true, NewtTestUtil.waitForRealized(glWindow1, true, null));
+ Assert.assertEquals(true, NewtTestUtil.waitForVisible(glWindow1, true, null));
// visible test
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
@@ -195,14 +196,14 @@ public class TestParenting01cSwingAWT extends UITestCase {
System.err.println("Demos: 3 - !Visible");
jFrame1.setVisible(false);
} });
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glWindow1, false));
+ Assert.assertEquals(true, NewtTestUtil.waitForVisible(glWindow1, false, null));
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
System.err.println("Demos: 4 - Visible");
jFrame1.setVisible(true);
} });
- Assert.assertEquals(true, AWTRobotUtil.waitForVisible(glWindow1, true));
+ Assert.assertEquals(true, NewtTestUtil.waitForVisible(glWindow1, true, null));
final boolean wasOnscreen = glWindow1.getChosenCapabilities().isOnscreen();
@@ -274,7 +275,7 @@ public class TestParenting01cSwingAWT extends UITestCase {
animator1.start();
final GLDisturbanceAction disturbanceAction = new GLDisturbanceAction(glWindow1);
- new Thread(disturbanceAction).start();
+ new InterruptSource.Thread(null, disturbanceAction).start();
disturbanceAction.waitUntilRunning();
final NewtCanvasAWT newtCanvasAWT = new NewtCanvasAWT(glWindow1);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java
index e23b36f07..f0cc0454c 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting01dAWT.java
@@ -145,8 +145,8 @@ public class TestParenting01dAWT extends UITestCase {
});
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent());
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow1, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow1, true));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glWindow1, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glWindow1, true, null));
glWindow1.display();
Assert.assertEquals("Init Counter Invalid "+glelCounter, 1, glelCounter.initCount);
Assert.assertEquals("Dispose Counter Invalid "+glelCounter, 0, glelCounter.disposeCount);
@@ -172,14 +172,14 @@ public class TestParenting01dAWT extends UITestCase {
// GL state shall be preserved!
//
glWindow1.setVisible(false);
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow1, false));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glWindow1, false, null));
System.err.println(getSimpleTestName(".")+": Start Reparent #2");
final Window.ReparentOperation rop2 = glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow(), -1, -1, reparentingHints);
System.err.println(getSimpleTestName(".")+": Result Reparent #2: "+rop2);
Assert.assertEquals(Window.ReparentOperation.ACTION_NATIVE_CREATION, rop2);
glWindow1.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForVisible(glWindow1, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(glWindow1, true));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(glWindow1, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(glWindow1, true, null));
glWindow1.display();
if( triggerPreserveGLState ) {
Assert.assertEquals("Init Counter Invalid (Preserve Failed 2) "+glelCounter, 1, glelCounter.initCount);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java
index 6a7066820..b56010bc4 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java
@@ -37,7 +37,8 @@ import org.junit.runners.MethodSorters;
import com.jogamp.opengl.*;
import com.jogamp.nativewindow.*;
-
+import com.jogamp.nativewindow.util.Point;
+import com.jogamp.nativewindow.util.PointImmutable;
import com.jogamp.newt.*;
import com.jogamp.newt.event.*;
import com.jogamp.newt.opengl.*;
@@ -150,6 +151,7 @@ public class TestParenting02NEWT extends UITestCase {
glWindow1.addGLEventListener(demo1);
glWindow2.addGLEventListener(demo2);
+ glWindow2.addWindowListener(windowMoveDetection);
boolean shouldQuit = false;
long duration = durationPerTest;
@@ -163,8 +165,19 @@ public class TestParenting02NEWT extends UITestCase {
x += 1;
y += 1;
// glWindow1.setPosition(x,y);
- glWindow2.setPosition(glWindow1.getWidth()/2,glWindow1.getHeight()/2-y);
- Thread.sleep(step);
+ final PointImmutable expPos = new Point(glWindow1.getWidth()/2, glWindow1.getHeight()/2-y);
+ glWindow2.setPosition(expPos.getX(), expPos.getY());
+ {
+ int waitCount=0;
+ do {
+ Thread.sleep(step);
+ waitCount++;
+ } while( !windowMoved && waitCount < 10);
+ final boolean didWindowMove = windowMoved;
+ windowMoved = false;
+ final PointImmutable hasPos = new Point(glWindow2.getX(), glWindow2.getY());
+ System.err.println("Moved: exp "+expPos+", has "+hasPos+", equals "+expPos.equals(hasPos)+", didWindowMove "+didWindowMove+", waitCount "+waitCount);
+ }
while( null != ( event = eventFifo.get() ) ) {
final Window source = (Window) event.getSource();
@@ -186,6 +199,13 @@ public class TestParenting02NEWT extends UITestCase {
destroyWindow(null, null, window2, glWindow2);
destroyWindow(display, screen, window1, glWindow1);
}
+ volatile boolean windowMoved = false;
+ final WindowListener windowMoveDetection = new WindowAdapter() {
+ @Override
+ public void windowMoved(final WindowEvent e) {
+ windowMoved = true;
+ }
+ };
public static void setDemoFields(final GLEventListener demo, final Window window, final GLWindow glWindow, final boolean debug) {
Assert.assertNotNull(demo);
@@ -214,17 +234,7 @@ public class TestParenting02NEWT extends UITestCase {
}
}
final String tstname = TestParenting02NEWT.class.getName();
- org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
- tstname,
- "filtertrace=true",
- "haltOnError=false",
- "haltOnFailure=false",
- "showoutput=true",
- "outputtoformatters=true",
- "logfailedtests=true",
- "logtestlistenerevents=true",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
- "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } );
+ org.junit.runner.JUnitCore.main(tstname);
}
}
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
index 723b84081..005839cec 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting03AWT.java
@@ -47,6 +47,7 @@ import com.jogamp.opengl.*;
import com.jogamp.opengl.util.Animator;
import com.jogamp.newt.*;
import com.jogamp.newt.opengl.*;
+import com.jogamp.newt.opengl.util.NEWTDemoListener;
import com.jogamp.newt.awt.NewtCanvasAWT;
import java.io.IOException;
@@ -54,6 +55,14 @@ import java.io.IOException;
import com.jogamp.opengl.test.junit.util.*;
import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
+/**
+ * <p>
+ * The demo code uses {@link NewtReparentingKeyAdapter} including {@link NEWTDemoListener} functionality.
+ * </p>
+ * <p>
+ * Manual invocation via main allows setting each tests's duration in milliseconds, e.g.{@code -duration 10000}, and many more, see {@link #main(String[])}
+ * </p>
+ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestParenting03AWT extends UITestCase {
static Dimension glSize, fSize;
@@ -88,7 +97,7 @@ public class TestParenting03AWT extends UITestCase {
final GLEventListener demo1 = new GearsES2(1);
setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
- glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1, null));
+ glWindow1.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT1, glWindow1));
final GLAnimatorControl animator1 = new Animator(glWindow1);
animator1.start();
@@ -104,7 +113,7 @@ public class TestParenting03AWT extends UITestCase {
final GLEventListener demo2 = new GearsES2(1);
setDemoFields(demo2, glWindow2, false);
glWindow2.addGLEventListener(demo2);
- glWindow2.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT2, glWindow2, null));
+ glWindow2.addKeyListener(new NewtAWTReparentingKeyAdapter(frame1, newtCanvasAWT2, glWindow2));
animator2 = new Animator(glWindow2);
animator2.start();
}
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..cbc969589 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -28,7 +28,6 @@
package com.jogamp.opengl.test.junit.util;
-import jogamp.newt.WindowImplAccess;
import jogamp.newt.awt.event.AWTNewtEventFactory;
import java.lang.Thread.UncaughtExceptionHandler;
@@ -43,24 +42,17 @@ import java.awt.Robot;
import com.jogamp.nativewindow.NativeWindow;
import com.jogamp.nativewindow.NativeWindowFactory;
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 {
@@ -125,6 +117,7 @@ public class AWTRobotUtil {
System.err.println("******** clearAWTFocus.X");
}
+ // FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
public static int[] getCenterLocation(final Object obj, final boolean onTitleBarIfWindow)
throws InterruptedException, InvocationTargetException {
if(obj instanceof com.jogamp.newt.Window) {
@@ -163,6 +156,7 @@ public class AWTRobotUtil {
return new int[] { x0, y0 };
}
+ // FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
public static int[] getClientLocation(final Object obj, final int x, final int y)
throws InterruptedException, InvocationTargetException {
if(obj instanceof com.jogamp.newt.Window) {
@@ -239,6 +233,7 @@ public class AWTRobotUtil {
/**
* centerMouse
+ * FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
* @param onTitleBarIfWindow TODO
*/
public static void centerMouse(Robot robot, final Object obj, final boolean onTitleBarIfWindow)
@@ -254,6 +249,7 @@ public class AWTRobotUtil {
awtRobotMouseMove(robot, p0[0], p0[1] );
}
+ // FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
public static void setMouseToClientLocation(Robot robot, final Object obj, final int x, final int y)
throws AWTException, InterruptedException, InvocationTargetException {
@@ -266,6 +262,7 @@ public class AWTRobotUtil {
awtRobotMouseMove(robot, p0[0], p0[1] );
}
+ // FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
public static int getClickTimeout(final Object obj) {
if(obj instanceof com.jogamp.newt.Window) {
return com.jogamp.newt.event.MouseEvent.getClickTimeout();
@@ -284,6 +281,8 @@ public class AWTRobotUtil {
}
/**
+ * FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
+ *
* requestFocus, if robot is valid, use mouse operation,
* otherwise programmatic, ie call requestFocus
*/
@@ -293,6 +292,8 @@ public class AWTRobotUtil {
}
/**
+ * FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
+ *
* requestFocus, if robot is valid, use mouse operation,
* otherwise programmatic, ie call requestFocus
*/
@@ -332,6 +333,7 @@ public class AWTRobotUtil {
}});
}
+ // FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
public static void requestFocus(final Robot robot, final Object obj, final int x, final int y)
throws AWTException, InterruptedException, InvocationTargetException {
validateAWTEDTIsAlive();
@@ -350,6 +352,7 @@ public class AWTRobotUtil {
robot.delay( d );
}
+ // FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
public static boolean hasFocus(final Object obj) {
if(obj instanceof com.jogamp.newt.Window) {
return ((com.jogamp.newt.Window) obj).hasFocus();
@@ -364,55 +367,36 @@ public class AWTRobotUtil {
/**
*
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
* @return True if the Window became the global focused Window within TIME_OUT
*/
- public static boolean waitForFocus(final Object obj) throws InterruptedException {
+ public static boolean waitForFocus(final java.awt.Component comp, final Runnable waitAction) throws InterruptedException {
int wait;
- if(obj instanceof com.jogamp.newt.Window) {
- final com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj;
- for (wait=0; wait<POLL_DIVIDER && !win.hasFocus(); wait++) {
- Thread.sleep(TIME_SLICE);
- }
- } else if(NativeWindowFactory.isAWTAvailable() && obj instanceof java.awt.Component) {
- final java.awt.Component comp = (java.awt.Component) obj;
- final java.awt.KeyboardFocusManager kfm = java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager();
- for (wait=0; wait<POLL_DIVIDER && comp != kfm.getPermanentFocusOwner(); wait++) {
+ final java.awt.KeyboardFocusManager kfm = java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager();
+ for (wait=0; wait<POLL_DIVIDER && comp != kfm.getPermanentFocusOwner(); wait++) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
Thread.sleep(TIME_SLICE);
}
- } else {
- throw new RuntimeException("Neither AWT nor NEWT: "+obj);
}
return wait<POLL_DIVIDER;
}
/**
*
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
* @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 {
- if(!waitForFocus(obj)) {
+ public static boolean waitForFocus(final java.awt.Component comp, final FocusEventCountAdapter gain,
+ final FocusEventCountAdapter lost, final Runnable waitAction) throws InterruptedException {
+ if(!waitForFocus(comp, waitAction)) {
return false;
}
- return waitForFocus(gain, lost);
+ return TestUtil.waitForFocus(gain, lost, waitAction);
}
+ // FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
public static void assertRequestFocusAndWait(final Robot robot, final Object requestFocus, final Object waitForFocus,
final FocusEventCountAdapter gain, final FocusEventCountAdapter lost)
throws AWTException, InterruptedException, InvocationTargetException {
@@ -422,7 +406,13 @@ public class AWTRobotUtil {
for(i=0; i < RETRY_NUMBER && !hasFocus; i++) {
requestFocus(robot, requestFocus);
- hasFocus = waitForFocus(waitForFocus, gain, lost);
+ if(waitForFocus instanceof com.jogamp.newt.Window) {
+ hasFocus = NewtTestUtil.waitForFocus((com.jogamp.newt.Window)waitForFocus, gain, lost, null);
+ } else if(NativeWindowFactory.isAWTAvailable() && waitForFocus instanceof java.awt.Component) {
+ hasFocus = waitForFocus((java.awt.Component)waitForFocus, gain, lost, null);
+ } else {
+ throw new RuntimeException("Neither AWT nor NEWT: "+waitForFocus);
+ }
}
if(!hasFocus) {
System.err.print("*** AWTRobotUtil.assertRequestFocusAndWait() ");
@@ -459,6 +449,7 @@ public class AWTRobotUtil {
robot.delay(msDelay);
}
+ // FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
public static int keyType(final int i, final Robot robot, final int keyCode,
final Object obj, final KeyEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException
{
@@ -518,6 +509,8 @@ public class AWTRobotUtil {
}
/**
+ * FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
+ *
* @param keyCode TODO
* @param counter shall return the number of keys typed (press + release)
*/
@@ -550,6 +543,8 @@ public class AWTRobotUtil {
}
/**
+ * FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
+ *
* @param keyCode TODO
* @param counter shall return the number of keys typed (press + release)
*/
@@ -600,6 +595,7 @@ public class AWTRobotUtil {
robot.delay(actionDelay);
}
+ // FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
static int mouseClick(final int i, final Robot robot, final int mouseButton,
final Object obj, final InputEventCountAdapter counter) throws InterruptedException, AWTException, InvocationTargetException
{
@@ -631,6 +627,8 @@ public class AWTRobotUtil {
}
/**
+ * FIXME: AWTRobotUtil Cleanup: Use specific type for argument object
+ *
* @param mouseButton ie InputEvent.BUTTON1_MASK
* @param clickCount ie 1, or 2
*/
@@ -668,34 +666,17 @@ public class AWTRobotUtil {
/**
*
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
* @return True if the Component becomes <code>visible</code> within TIME_OUT
*/
- public static boolean waitForVisible(final Object obj, final boolean visible) throws InterruptedException {
+ public static boolean waitForVisible(final java.awt.Component comp, final boolean visible, final Runnable waitAction) throws InterruptedException {
int wait;
- if(obj instanceof com.jogamp.newt.Window) {
- final com.jogamp.newt.Window win = (com.jogamp.newt.Window) obj;
- for (wait=0; wait<POLL_DIVIDER && visible != win.isVisible(); wait++) {
- Thread.sleep(TIME_SLICE);
- }
- } else if(NativeWindowFactory.isAWTAvailable() && obj instanceof java.awt.Component) {
- final java.awt.Component comp = (java.awt.Component) obj;
- for (wait=0; wait<POLL_DIVIDER && visible != comp.isShowing(); wait++) {
+ for (wait=0; wait<POLL_DIVIDER && visible != comp.isShowing(); wait++) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
Thread.sleep(TIME_SLICE);
}
- } else {
- throw new RuntimeException("Neither AWT nor NEWT: "+obj);
- }
- 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;
}
@@ -703,46 +684,26 @@ public class AWTRobotUtil {
/**
* @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
- * @throws InterruptedException
- */
- public static boolean waitForRealized(final Object obj, final boolean realized) throws InterruptedException {
- return waitForRealized(obj, null, realized);
- }
-
- /**
- * @param obj the component 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 Object obj, final Runnable waitAction, final boolean realized) throws InterruptedException {
+ public static boolean waitForRealized(final java.awt.Component comp, final boolean realized, final Runnable waitAction) 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();
- }
- } 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();
+ while( (t1-t0) < TIME_OUT && realized != comp.isShowing() ) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
}
- } else if (NativeWindowFactory.isAWTAvailable() && obj instanceof java.awt.Component) {
- final java.awt.Component comp = (java.awt.Component) obj;
- while( (t1-t0) < TIME_OUT && realized != comp.isShowing() ) {
+ t1 = System.currentTimeMillis();
+ }
+ // if GLCanvas, ensure it got also painted -> drawable.setRealized(true);
+ if( (t1-t0) < TIME_OUT && comp instanceof GLAutoDrawable) {
+ final GLAutoDrawable glad = (GLAutoDrawable) comp;
+ t0 = System.currentTimeMillis();
+ while( (t1-t0) < TIME_OUT && realized != glad.isRealized() ) {
if( null != waitAction ) {
waitAction.run();
} else {
@@ -750,9 +711,10 @@ public class AWTRobotUtil {
}
t1 = System.currentTimeMillis();
}
- // if GLCanvas, ensure it got also painted -> drawable.setRealized(true);
- if( (t1-t0) < TIME_OUT && comp instanceof GLAutoDrawable) {
- final GLAutoDrawable glad = (GLAutoDrawable) comp;
+ if( (t1-t0) >= TIME_OUT ) {
+ // for some reason GLCanvas hasn't been painted yet, force it!
+ System.err.println("XXX: FORCE REPAINT PRE - glad: "+glad);
+ comp.repaint();
t0 = System.currentTimeMillis();
while( (t1-t0) < TIME_OUT && realized != glad.isRealized() ) {
if( null != waitAction ) {
@@ -762,130 +724,46 @@ public class AWTRobotUtil {
}
t1 = System.currentTimeMillis();
}
- if( (t1-t0) >= TIME_OUT ) {
- // for some reason GLCanvas hasn't been painted yet, force it!
- System.err.println("XXX: FORCE REPAINT PRE - glad: "+glad);
- comp.repaint();
- t0 = System.currentTimeMillis();
- while( (t1-t0) < TIME_OUT && realized != glad.isRealized() ) {
- if( null != waitAction ) {
- waitAction.run();
- } else {
- Thread.sleep(TIME_SLICE);
- }
- t1 = System.currentTimeMillis();
- }
- 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();
+ System.err.println("XXX: FORCE REPAINT POST - glad: "+glad);
}
- } 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;
- }
-
- /**
* 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 waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
* @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 Object obj, final boolean willClose, final WindowClosingListener closingListener) throws InterruptedException {
+ public static boolean closeWindow(final java.awt.Window win, final boolean willClose, final TestUtil.WindowClosingListener closingListener, final Runnable waitAction) throws InterruptedException {
closingListener.reset();
- if(obj instanceof java.awt.Window) {
- 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();
- AWTEDTExecutor.singleton.invoke(true, new Runnable() {
- public void run() {
- evtQ.postEvent(new java.awt.event.WindowEvent(win, java.awt.event.WindowEvent.WINDOW_CLOSING));
- } });
- } 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 wait<POLL_DIVIDER;
+ final java.awt.Toolkit tk = java.awt.Toolkit.getDefaultToolkit();
+ final java.awt.EventQueue evtQ = tk.getSystemEventQueue();
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ evtQ.postEvent(new java.awt.event.WindowEvent(win, java.awt.event.WindowEvent.WINDOW_CLOSING));
+ } });
+ return waitUntilClosed(willClose, closingListener, waitAction);
}
- public static WindowClosingListener addClosingListener(final Object obj) {
- WindowClosingListener cl = null;
- if(obj instanceof java.awt.Window) {
- final java.awt.Window win = (java.awt.Window) obj;
- final AWTWindowClosingAdapter acl = new AWTWindowClosingAdapter();
- AWTEDTExecutor.singleton.invoke(true, new Runnable() {
- public void run() {
- win.addWindowListener(acl);
- } } );
- cl = 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;
- } 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();
+ public static TestUtil.WindowClosingListener addClosingListener(final java.awt.Window win) {
+ final AWTWindowClosingAdapter acl = new AWTWindowClosingAdapter();
+ AWTEDTExecutor.singleton.invoke(true, new Runnable() {
+ public void run() {
+ win.addWindowListener(acl);
+ } } );
+ return acl;
}
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 +796,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..792dfa831
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/util/GLTestUtil.java
@@ -0,0 +1,108 @@
+/**
+ * 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 {
+
+ /**
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @return True if the GLContext becomes created or not within TIME_OUT
+ */
+ public static boolean waitForContextCreated(final GLAutoDrawable autoDrawable, final boolean created, final Runnable waitAction) 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;
+ }
+ }
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ }
+ return wait<POLL_DIVIDER;
+ }
+
+ /**
+ *
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @return True if the GLDrawable receives the expected surface size within TIME_OUT
+ */
+ public static boolean waitForSize(final GLDrawable drawable, final int width, final int height, final Runnable waitAction) throws InterruptedException {
+ int wait;
+ for (wait=0; wait<POLL_DIVIDER && ( width != drawable.getSurfaceWidth() || height != drawable.getSurfaceHeight() ) ; wait++) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ }
+ return wait<POLL_DIVIDER;
+ }
+
+ /**
+ * @param glad the GLAutoDrawable to wait for
+ * @param realized true if waiting for component to become realized, otherwise false
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT
+ * @throws InterruptedException
+ */
+ public static boolean waitForRealized(final GLAutoDrawable glad, final boolean realized, final Runnable waitAction) 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/MiscUtils.java b/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java
index 60f2f962c..bf656bb4d 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/MiscUtils.java
@@ -42,6 +42,7 @@ import java.util.List;
import com.jogamp.opengl.GLContext;
import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.InterruptSource;
public class MiscUtils {
public static boolean atob(final String str, final boolean def) {
@@ -160,7 +161,7 @@ public class MiscUtils {
return false;
}
- public static class StreamDump extends Thread {
+ public static class StreamDump extends InterruptSource.Thread {
final InputStream is;
final StringBuilder outString;
final OutputStream outStream;
diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTDemoListener.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTDemoListener.java
deleted file mode 100644
index 68a983a27..000000000
--- a/src/test/com/jogamp/opengl/test/junit/util/NEWTDemoListener.java
+++ /dev/null
@@ -1,468 +0,0 @@
-/**
- * Copyright 2015 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.net.URLConnection;
-
-import com.jogamp.common.util.IOUtil;
-import com.jogamp.nativewindow.CapabilitiesImmutable;
-import com.jogamp.nativewindow.ScalableSurface;
-import com.jogamp.newt.Display;
-import com.jogamp.newt.Display.PointerIcon;
-import com.jogamp.newt.event.KeyEvent;
-import com.jogamp.newt.event.KeyListener;
-import com.jogamp.newt.event.MouseAdapter;
-import com.jogamp.newt.event.MouseEvent;
-import com.jogamp.newt.opengl.GLWindow;
-import com.jogamp.opengl.util.Gamma;
-import com.jogamp.opengl.util.PNGPixelRect;
-
-import jogamp.newt.driver.PNGIcon;
-
-public class NEWTDemoListener extends MouseAdapter implements KeyListener {
- protected final GLWindow glWindow;
- protected final QuitAdapter quitAdapter;
- final PointerIcon[] pointerIcons;
- int pointerIconIdx = 0;
- float gamma = 1f;
- float brightness = 0f;
- float contrast = 1f;
- boolean confinedFixedCenter = false;
-
- public NEWTDemoListener(final GLWindow glWin, final QuitAdapter quitAdapter, final PointerIcon[] pointerIcons) {
- this.glWindow = glWin;
- this.quitAdapter = quitAdapter;
- if( null != pointerIcons ) {
- this.pointerIcons = pointerIcons;
- } else {
- this.pointerIcons = createPointerIcons(glWindow);
- }
- }
- public NEWTDemoListener(final GLWindow glWin, final PointerIcon[] pointerIcons) {
- this(glWin, null, pointerIcons);
- }
- public NEWTDemoListener(final GLWindow glWin) {
- this(glWin, null, null);
- }
-
- protected void printlnState(final String prelude) {
- System.err.println(prelude+": "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()+", state "+glWindow.getStateMaskString());
- }
- protected void printlnState(final String prelude, final String post) {
- System.err.println(prelude+": "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()+", state "+glWindow.getStateMaskString()+", "+post);
- }
- protected void quitAdapterOff() {
- if( null != quitAdapter ) {
- quitAdapter.enable(false);
- }
- }
- protected void quitAdapterOn() {
- if( null != quitAdapter ) {
- quitAdapter.clear();
- quitAdapter.enable(true);
- }
- }
-
- @Override
- public void keyPressed(final KeyEvent e) {
- if( e.isAutoRepeat() || e.isConsumed() ) {
- return;
- }
- final int keySymbol = e.getKeySymbol();
- switch(keySymbol) {
- case KeyEvent.VK_SPACE:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- if(glWindow.getAnimator().isPaused()) {
- glWindow.getAnimator().resume();
- } else {
- glWindow.getAnimator().pause();
- }
- }
- }.run();
- break;
- case KeyEvent.VK_A:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set alwaysontop pre]");
- glWindow.setAlwaysOnTop(!glWindow.isAlwaysOnTop());
- printlnState("[set alwaysontop post]");
- glWindow.setExclusiveContextThread(t);
- } }.start();
- break;
- case KeyEvent.VK_B:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set alwaysonbottom pre]");
- glWindow.setAlwaysOnBottom(!glWindow.isAlwaysOnBottom());
- printlnState("[set alwaysonbottom post]");
- glWindow.setExclusiveContextThread(t);
- } }.start();
- break;
- case KeyEvent.VK_C:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- if( null != pointerIcons ) {
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set pointer-icon pre]");
- final PointerIcon currentPI = glWindow.getPointerIcon();
- final PointerIcon newPI;
- if( pointerIconIdx >= pointerIcons.length ) {
- newPI=null;
- pointerIconIdx=0;
- } else {
- newPI=pointerIcons[pointerIconIdx++];
- }
- glWindow.setPointerIcon( newPI );
- printlnState("[set pointer-icon post]", currentPI+" -> "+glWindow.getPointerIcon());
- glWindow.setExclusiveContextThread(t);
- }
- } }.start();
- break;
- case KeyEvent.VK_D:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- // while( null != glWindow.getExclusiveContextThread() ) ;
- printlnState("[set undecorated pre]");
- glWindow.setUndecorated(!glWindow.isUndecorated());
- printlnState("[set undecorated post]");
- glWindow.setExclusiveContextThread(t);
- } }.start();
- break;
- case KeyEvent.VK_F:
- e.setConsumed(true);
- quitAdapterOff();
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set fullscreen pre]");
- if( glWindow.isFullscreen() ) {
- glWindow.setFullscreen( false );
- } else {
- if( e.isAltDown() ) {
- glWindow.setFullscreen( null );
- } else {
- glWindow.setFullscreen( true );
- }
- }
- printlnState("[set fullscreen post]");
- glWindow.setExclusiveContextThread(t);
- quitAdapterOn();
- } }.start();
- break;
- case KeyEvent.VK_G:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- final float newGamma = gamma + ( e.isShiftDown() ? -0.1f : 0.1f );
- System.err.println("[set gamma]: "+gamma+" -> "+newGamma);
- if( Gamma.setDisplayGamma(glWindow, newGamma, brightness, contrast) ) {
- gamma = newGamma;
- }
- } }.start();
- break;
- case KeyEvent.VK_I:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set pointer-visible pre]");
- glWindow.setPointerVisible(!glWindow.isPointerVisible());
- printlnState("[set pointer-visible post]");
- glWindow.setExclusiveContextThread(t);
- } }.start();
- break;
- case KeyEvent.VK_J:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set pointer-confined pre]", "warp-center: "+e.isShiftDown());
- final boolean confine = !glWindow.isPointerConfined();
- glWindow.confinePointer(confine);
- printlnState("[set pointer-confined post]", "warp-center: "+e.isShiftDown());
- if( e.isShiftDown() ) {
- setConfinedFixedCenter(confine);
- } else if( !confine ) {
- setConfinedFixedCenter(false);
- }
- glWindow.setExclusiveContextThread(t);
- } }.start();
- break;
- case KeyEvent.VK_M:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- // none: max-v
- // alt: max-h
- // shift: max-hv
- // ctrl: max-off
- final boolean horz, vert;
- if( e.isControlDown() ) {
- horz = false;
- vert = false;
- } else if( e.isShiftDown() ) {
- final boolean bothMax = glWindow.isMaximizedHorz() && glWindow.isMaximizedVert();
- horz = !bothMax;
- vert = !bothMax;
- } else if( !e.isAltDown() ) {
- horz = glWindow.isMaximizedHorz();
- vert = !glWindow.isMaximizedVert();
- } else if( e.isAltDown() ) {
- horz = !glWindow.isMaximizedHorz();
- vert = glWindow.isMaximizedVert();
- } else {
- vert = glWindow.isMaximizedVert();
- horz = glWindow.isMaximizedHorz();
- }
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set maximize pre]", "max[vert "+vert+", horz "+horz+"]");
- glWindow.setMaximized(horz, vert);
- printlnState("[set maximize post]", "max[vert "+vert+", horz "+horz+"]");
- glWindow.setExclusiveContextThread(t);
- } }.start();
- break;
- case KeyEvent.VK_P:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set position pre]");
- glWindow.setPosition(100, 100);
- printlnState("[set position post]");
- glWindow.setExclusiveContextThread(t);
- } }.start();
- break;
- case KeyEvent.VK_R:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set resizable pre]");
- glWindow.setResizable(!glWindow.isResizable());
- printlnState("[set resizable post]");
- glWindow.setExclusiveContextThread(t);
- } }.start();
- break;
- case KeyEvent.VK_S:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set sticky pre]");
- glWindow.setSticky(!glWindow.isSticky());
- printlnState("[set sticky post]");
- glWindow.setExclusiveContextThread(t);
- } }.start();
- break;
- case KeyEvent.VK_V:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- final boolean wasVisible = glWindow.isVisible();
- {
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set visible pre]");
- glWindow.setVisible(!wasVisible);
- printlnState("[set visible post]");
- glWindow.setExclusiveContextThread(t);
- }
- if( wasVisible && !e.isControlDown() ) {
- try {
- Thread.sleep(5000);
- } catch (final InterruptedException e) {
- e.printStackTrace();
- }
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[reset visible pre]");
- glWindow.setVisible(true);
- printlnState("[reset visible post]");
- glWindow.setExclusiveContextThread(t);
- }
- } }.start();
- break;
- case KeyEvent.VK_W:
- e.setConsumed(true);
- new Thread() {
- public void run() {
- final Thread t = glWindow.setExclusiveContextThread(null);
- printlnState("[set pointer-pos pre]");
- glWindow.warpPointer(glWindow.getSurfaceWidth()/2, glWindow.getSurfaceHeight()/2);
- printlnState("[set pointer-pos post]");
- glWindow.setExclusiveContextThread(t);
- } }.start();
- break;
- case KeyEvent.VK_X:
- e.setConsumed(true);
- final float[] hadSurfacePixelScale = glWindow.getCurrentSurfaceScale(new float[2]);
- final float[] reqSurfacePixelScale;
- if( hadSurfacePixelScale[0] == ScalableSurface.IDENTITY_PIXELSCALE ) {
- reqSurfacePixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
- } else {
- reqSurfacePixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
- }
- System.err.println("[set PixelScale pre]: had "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" -> req "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]);
- glWindow.setSurfaceScale(reqSurfacePixelScale);
- final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]);
- final float[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new float[2]);
- System.err.println("[set PixelScale post]: "+hadSurfacePixelScale[0]+"x"+hadSurfacePixelScale[1]+" (had) -> "+
- reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+
- valReqSurfacePixelScale[0]+"x"+valReqSurfacePixelScale[1]+" (val) -> "+
- hasSurfacePixelScale1[0]+"x"+hasSurfacePixelScale1[1]+" (has)");
- setTitle();
- }
- }
- @Override
- public void keyReleased(final KeyEvent e) { }
-
- public void setConfinedFixedCenter(final boolean v) {
- confinedFixedCenter = v;
- }
- @Override
- public void mouseMoved(final MouseEvent e) {
- if( e.isConfined() ) {
- mouseCenterWarp(e);
- }
- }
- @Override
- public void mouseDragged(final MouseEvent e) {
- if( e.isConfined() ) {
- mouseCenterWarp(e);
- }
- }
- @Override
- public void mouseClicked(final MouseEvent e) {
- if(e.getClickCount() == 2 && e.getPointerCount() == 1) {
- glWindow.setFullscreen(!glWindow.isFullscreen());
- System.err.println("setFullscreen: "+glWindow.isFullscreen());
- }
- }
- private void mouseCenterWarp(final MouseEvent e) {
- if(e.isConfined() && confinedFixedCenter ) {
- final int x=glWindow.getSurfaceWidth()/2;
- final int y=glWindow.getSurfaceHeight()/2;
- glWindow.warpPointer(x, y);
- }
- }
-
- public void setTitle() {
- setTitle(glWindow);
- }
- public static void setTitle(final GLWindow win) {
- final CapabilitiesImmutable chosenCaps = win.getChosenCapabilities();
- final CapabilitiesImmutable reqCaps = win.getRequestedCapabilities();
- final CapabilitiesImmutable caps = null != chosenCaps ? chosenCaps : reqCaps;
- final String capsA = caps.isBackgroundOpaque() ? "opaque" : "transl";
- final float[] sDPI = win.getPixelsPerMM(new float[2]);
- sDPI[0] *= 25.4f;
- sDPI[1] *= 25.4f;
- win.setTitle("GLWindow["+capsA+"], win: "+win.getBounds()+", pix: "+win.getSurfaceWidth()+"x"+win.getSurfaceHeight()+", sDPI "+sDPI[0]+" x "+sDPI[1]);
- }
-
- public static PointerIcon[] createPointerIcons(final GLWindow glWindow) {
- final PointerIcon[] pointerIcons = { null, null, null, null, null };
- {
- final Display disp = glWindow.getScreen().getDisplay();
- disp.createNative();
- int idx = 0;
- {
- PointerIcon _pointerIcon = null;
- final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "newt/data/cross-grey-alpha-16x16.png" } );
- try {
- _pointerIcon = disp.createPointerIcon(res, 8, 8);
- System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
- } catch (final Exception e) {
- e.printStackTrace();
- }
- pointerIcons[idx] = _pointerIcon;
- }
- idx++;
- {
- PointerIcon _pointerIcon = null;
- final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "newt/data/pointer-grey-alpha-16x24.png" } );
- try {
- _pointerIcon = disp.createPointerIcon(res, 0, 0);
- System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
- } catch (final Exception e) {
- e.printStackTrace();
- }
- pointerIcons[idx] = _pointerIcon;
- }
- idx++;
- {
- PointerIcon _pointerIcon = null;
- final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "arrow-red-alpha-64x64.png" } );
- try {
- _pointerIcon = disp.createPointerIcon(res, 0, 0);
- System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
- } catch (final Exception e) {
- e.printStackTrace();
- }
- pointerIcons[idx] = _pointerIcon;
- }
- idx++;
- {
- PointerIcon _pointerIcon = null;
- final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "arrow-blue-alpha-64x64.png" } );
- try {
- _pointerIcon = disp.createPointerIcon(res, 0, 0);
- System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
- } catch (final Exception e) {
- e.printStackTrace();
- }
- pointerIcons[idx] = _pointerIcon;
- }
- idx++;
- if( PNGIcon.isAvailable() ) {
- PointerIcon _pointerIcon = null;
- final IOUtil.ClassResources res = new IOUtil.ClassResources(glWindow.getClass(), new String[] { "jogamp-pointer-64x64.png" } );
- try {
- final URLConnection urlConn = res.resolve(0);
- final PNGPixelRect image = PNGPixelRect.read(urlConn.getInputStream(), null, false /* directBuffer */, 0 /* destMinStrideInBytes */, false /* destIsGLOriented */);
- System.err.printf("Create PointerIcon #%02d: %s%n", idx, image.toString());
- _pointerIcon = disp.createPointerIcon(image, 32, 0);
- System.err.printf("Create PointerIcon #%02d: %s%n", idx, _pointerIcon.toString());
- } catch (final Exception e) {
- e.printStackTrace();
- }
- pointerIcons[idx] = _pointerIcon;
- }
- idx++;
- }
- return pointerIcons;
- }
-
-} \ No newline at end of file
diff --git a/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java b/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java
index 361a6c230..5dcfb2f98 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/NEWTGLContext.java
@@ -67,8 +67,8 @@ public class NEWTGLContext {
Assert.assertNotNull(window);
window.setSize(width, height);
window.setVisible(true);
- Assert.assertTrue(AWTRobotUtil.waitForVisible(window, true));
- Assert.assertTrue(AWTRobotUtil.waitForRealized(window, true));
+ Assert.assertTrue(NewtTestUtil.waitForVisible(window, true, null));
+ Assert.assertTrue(NewtTestUtil.waitForRealized(window, true, null));
final GLDrawableFactory factory = GLDrawableFactory.getFactory(caps.getGLProfile());
final GLDrawable drawable = factory.createGLDrawable(window);
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..295690f8a
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/util/NewtTestUtil.java
@@ -0,0 +1,206 @@
+/**
+ * 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.newt.Screen;
+import com.jogamp.newt.Window;
+import com.jogamp.newt.event.WindowEvent;
+
+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+"]";
+ }
+ }
+ /**
+ *
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @return True if the Window became the global focused Window within TIME_OUT
+ */
+ public static boolean waitForFocus(final Window win, final Runnable waitAction) throws InterruptedException {
+ int wait;
+ for (wait=0; wait<POLL_DIVIDER && !win.hasFocus(); wait++) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ }
+ return wait<POLL_DIVIDER;
+ }
+
+ /**
+ *
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @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, final Runnable waitAction) throws InterruptedException {
+ if(!waitForFocus(win, waitAction)) {
+ return false;
+ }
+ return TestUtil.waitForFocus(gain, lost, waitAction);
+ }
+
+ /**
+ *
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @return True if the Window receives the expected surface size within TIME_OUT
+ */
+ public static boolean waitForSize(final Window window, final int width, final int height, final Runnable waitAction) throws InterruptedException {
+ int wait;
+ for (wait=0; wait<POLL_DIVIDER && ( width != window.getSurfaceWidth() || height != window.getSurfaceHeight() ) ; wait++) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ }
+ return wait<POLL_DIVIDER;
+ }
+
+ /**
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @return True if the Component becomes <code>visible</code> within TIME_OUT
+ */
+ public static boolean waitForVisible(final Window win, final boolean visible, final Runnable waitAction) throws InterruptedException {
+ int wait;
+ for (wait=0; wait<POLL_DIVIDER && visible != win.isVisible(); wait++) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ }
+ return wait<POLL_DIVIDER;
+ }
+
+ /**
+ * @param screen the Screen to wait for
+ * @param realized true if waiting for component to become realized, otherwise false
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT
+ * @throws InterruptedException
+ */
+ public static boolean waitForRealized(final Screen screen, final boolean realized, final Runnable waitAction) 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 realized true if waiting for component to become realized, otherwise false
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT
+ * @throws InterruptedException
+ */
+ public static boolean waitForRealized(final Window win, final boolean realized, final Runnable waitAction) 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 willClose indicating that the window will close, hence this method waits for the window to be closed
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @param obj either an AWT Window (Frame, JFrame) or NEWT Window
+ * @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, final Runnable waitAction) throws InterruptedException {
+ closingListener.reset();
+ WindowImplAccess.windowDestroyNotify(win);
+ return waitUntilClosed(willClose, closingListener, waitAction);
+ }
+}
+
+
+
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..835fe81a4
--- /dev/null
+++ b/src/test/com/jogamp/opengl/test/junit/util/TestUtil.java
@@ -0,0 +1,100 @@
+/**
+ * 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;
+
+public abstract class TestUtil {
+ public static 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 ;
+
+ /**
+ *
+ * @param waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @return True if the Window became the global focused Window within TIME_OUT
+ */
+ public static boolean waitForFocus(final FocusEventCountAdapter gain,
+ final FocusEventCountAdapter lost, final Runnable waitAction) throws InterruptedException {
+ int wait;
+ for (wait=0; wait<POLL_DIVIDER; wait++) {
+ if( ( null == lost || lost.focusLost() ) && ( null == gain || gain.focusGained() ) ) {
+ return true;
+ }
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ 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 waitAction if not null, Runnable shall wait {@link #TIME_SLICE} ms, if appropriate
+ * @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, final Runnable waitAction) throws InterruptedException {
+ int wait;
+ for (wait=0; wait<POLL_DIVIDER && !closingListener.isWindowClosing(); wait++) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ }
+ if(wait<POLL_DIVIDER && willClose) {
+ for (wait=0; wait<POLL_DIVIDER && !closingListener.isWindowClosed(); wait++) {
+ if( null != waitAction ) {
+ waitAction.run();
+ } else {
+ Thread.sleep(TIME_SLICE);
+ }
+ }
+ }
+ return wait<POLL_DIVIDER;
+ }
+}
+
+
+
diff --git a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
index 2b1bb7062..7003b3980 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java
@@ -36,6 +36,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.StringTokenizer;
import java.util.concurrent.atomic.AtomicInteger;
@@ -241,7 +242,7 @@ public abstract class UITestCase extends SingletonJunitCase {
final String aaext = caps.getSampleExtension();
postSNDetail = null != postSNDetail ? "-"+postSNDetail : "";
- filenameBaseName = String.format("%-"+maxSimpleTestNameLen+"s-n%04d%s-%-6s-%s-%s-B%s-F%s_I%s-D%02d-St%02d-Sa%02d_%s-%04dx%04d.%s",
+ filenameBaseName = String.format((Locale)null, "%-"+maxSimpleTestNameLen+"s-n%04d%s-%-6s-%s-%s-B%s-F%s_I%s-D%02d-St%02d-Sa%02d_%s-%04dx%04d.%s",
simpleTestName, sn, postSNDetail, caps.getGLProfile().getName(), accel,
scrnm, dblb, F_pfmt, pfmt, depthBits, stencilBits, samples, aaext,
width, height, fileSuffix).replace(' ', '_');