From a9eaf11b0d168db049bafc24260d6c0b4a000071 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 9 Apr 2010 04:30:24 +0200 Subject: junit: Add timeout (30s), enable offscreen test --- make/build-junit.xml | 2 +- .../junit/jogl/offscreen/TestOffscreen01NEWT.java | 25 ++++++++++++++++++++-- .../test/junit/jogl/offscreen/WindowUtilNEWT.java | 10 +++++---- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/make/build-junit.xml b/make/build-junit.xml index 636035f1d..f06035de3 100644 --- a/make/build-junit.xml +++ b/make/build-junit.xml @@ -66,7 +66,7 @@ - + diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java index a8caafb30..5800af9af 100755 --- a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java +++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java @@ -65,8 +65,26 @@ public class TestOffscreen01NEWT { } @Test - public void test1() { - if(false) { + public void test01OffscreenWindow() { + if(true) { + GLWindow windowOffscreen = WindowUtilNEWT.createGLWindow(caps, width, height, false, true, false); + GLEventListener demo = new RedSquare(); + GLWindow windowOnScreen = null; + WindowListener wl=null; + MouseListener ml=null; + SurfaceUpdatedListener ul=null; + + WindowUtilNEWT.run(windowOffscreen, null, windowOnScreen, wl, ml, ul, 2, true /*debug*/); + try { + Thread.sleep(1000); // 1000 ms + } catch (Exception e) {} + WindowUtilNEWT.shutdown(windowOffscreen, windowOnScreen); + } + } + + @Test + public void test02OffscreenSnapshotWithDemo() { + if(true) { GLWindow windowOffscreen = WindowUtilNEWT.createGLWindow(caps, width, height, false, true, false); GLEventListener demo = new RedSquare(); GLWindow windowOnScreen = null; @@ -75,6 +93,9 @@ public class TestOffscreen01NEWT { SurfaceUpdatedListener ul=null; WindowUtilNEWT.run(windowOffscreen, demo, windowOnScreen, wl, ml, ul, 2, true /*debug*/); + try { + Thread.sleep(1000); // 1000 ms + } catch (Exception e) {} WindowUtilNEWT.shutdown(windowOffscreen, windowOnScreen); } } diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java index 31ee7b552..b9541dbaf 100755 --- a/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java +++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/WindowUtilNEWT.java @@ -79,14 +79,16 @@ public class WindowUtilNEWT { GLWindow windowOnScreen, WindowListener wl, MouseListener ml, SurfaceUpdatedListener ul, int frames, boolean debug) { try { - if(debug) { + if(debug && null!=demo) { MiscUtils.setField(demo, "glDebug", new Boolean(true)); MiscUtils.setField(demo, "glTrace", new Boolean(true)); } - if(!MiscUtils.setField(demo, "window", windowOffscreen)) { - MiscUtils.setField(demo, "glWindow", windowOffscreen); + if(null!=demo) { + if(!MiscUtils.setField(demo, "window", windowOffscreen)) { + MiscUtils.setField(demo, "glWindow", windowOffscreen); + } + windowOffscreen.addGLEventListener(demo); } - windowOffscreen.addGLEventListener(demo); if ( null != windowOnScreen ) { if(null!=wl) { -- cgit v1.2.3